Skip to content

Instantly share code, notes, and snippets.

View zerobatu's full-sized avatar

Claudio Alvarado zerobatu

  • Santiago, Chile
View GitHub Profile
@oinopion
oinopion / read-access.sql
Created October 5, 2016 13:00
How to create read only user in PostgreSQL
-- Create a group
CREATE ROLE readaccess;
-- Grant access to existing tables
GRANT USAGE ON SCHEMA public TO readaccess;
GRANT SELECT ON ALL TABLES IN SCHEMA public TO readaccess;
-- Grant access to future tables
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO readaccess;
@ocowchun
ocowchun / elasticsearch
Created July 14, 2016 10:10
Elasticsearch monit
check process elasticsearch with pidfile /var/run/elasticsearch.pid
start program = "/etc/init.d/elasticsearch start"
stop program = "/etc/init.d/elasticsearch stop"
if 5 restarts within 5 cycles then timeout
if loadavg (1min) > 0.8 then alert
if loadavg (5min) > 0.7 then alert
if failed host 127.0.0.1 port 9200 protocol http then restart