Skip to content

Instantly share code, notes, and snippets.

@johnko
johnko / Percona XtraDB Cluster on FreeBSD 10
Last active August 29, 2015 14:01
These were my error logs. but it turns out Line 4 of var-log-mysql-error2.log was the hint I needed to get this working. /server/mysql/data/wsrep_recovery.lBRkgo could not be created because galera could not write to that directory
# grep mysql /etc/rc.conf
mysql_limits="YES"
mysql_dbdir="/server/mysql/data"
mysql_optfile="/server/mysql/my.cnf"
mysql_enable="YES"
mysql_args=""
@johnko
johnko / test.sh
Last active August 29, 2015 14:02
Testing FreeBSD ZFS... Also, how to create millions of files... CAUTION, ONLY DO THIS ON A TEST SYSTEM
#!/bin/sh
#########################################
# CAUTION, ONLY DO THIS ON A TEST SYSTEM
#########################################
# use GELI to onetime encrypt 4 hard drives to test with
for i in `seq 0 3` ; do geli onetime /dev/ada$i ; done
# append the ELI devices to a DEV variable
var keymap = {
'0': 48,
'1': 49,
'2': 50,
'3': 51,
'4': 52,
'5': 53,
'6': 54,
'7': 55,
'8': 56,
# this config needs haproxy-1.1.28 or haproxy-1.2.1
global
log 127.0.0.1 local0
log 127.0.0.1 local1 notice
#log loghost local0 info
maxconn 4096
#chroot /usr/share/haproxy
user haproxy
group haproxy
We couldn’t find that file to show.
We couldn’t find that file to show.
We couldn’t find that file to show.
@johnko
johnko / couch-start.sh
Created May 30, 2015 19:57
couch-start.sh
#!/bin/bash
# from https://gist.github.com/cpetersen/581657
NAME=$1
HOME="/root"
PATH="/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin"
/usr/bin/sudo -u root /usr/local/bin/couchdb -b -a /mnt/sde/$NAME/couchdb.ini -p /var/run/couchdb-$NAME.pid -e /var/log/couchdb-$NAME.err -o /var/log/couchdb-$NAME.out
sleep 1
echo '' >> /var/run/couchdb-$NAME.pidroot
@johnko
johnko / gist:aeedfcbe813c81af0ddf
Created May 30, 2015 20:01
monit couchdb by port
#################################################################
# couchdb
################################################################
#check process couchdb by port number
check host couchdb with address localhost
if failed port 5984 then alert
if failed url https://localhost:5984/ and content == '"couchdb"' then alert
group couchdb
@johnko
johnko / gist:7842883ec28dad5362b0
Created May 30, 2015 20:02
monit couchdb by port and restart
#################################################################
# couchdb
# http://nikosmarkopoulos.com/monitoring-couchdb-with-monit/
################################################################
check process couchdb
with pidfile /var/run/couchdb/couchdb.pid
start program = "/etc/init.d/couchdb start"
stop program = "/etc/init.d/couchdb stop"
if failed host localhost port 5984 proto http then restart