Skip to content

Instantly share code, notes, and snippets.

View tanji's full-sized avatar

Guillaume Lefranc tanji

View GitHub Profile
@tanji
tanji / backup.sh
Created December 9, 2014 14:11
Simple innobackupex wrapper
#!/bin/bash
TODAY=$(date +%Y%m%d)
DOW=$(date +%w)
# check if sshfs is mounted. if not, do it
mount -f /mnt/backup
if [ $? -eq 0 ]
then
mount /mnt/backup
fi
mysql --password=foo! -e "set global wsrep_desync=ON"
@tanji
tanji / couchbase.yml
Created January 5, 2015 13:50
A couchbase 3.0 ansible playbook.
- hosts: lab
user: root
tasks:
- name: download couchbase package
get_url: url=http://packages.couchbase.com/releases/3.0.1/couchbase-server-enterprise_3.0.1-debian7_amd64.deb dest=/tmp/
- name: install couchbase package
apt: deb=/tmp/couchbase-server-enterprise_3.0.1-debian7_amd64.deb
- name: create couchbase datadir
file: path=/data/couchbase owner=couchbase group=couchbase state=directory
@tanji
tanji / haproxy-agent.go
Created May 28, 2015 17:37
HAProxy Agent
package main
import (
// "bytes"
"bufio"
_ "database/sql"
"fmt"
_ "github.com/go-sql-driver/mysql"
"github.com/jmoiron/sqlx"
"github.com/tanji/mariadb-tools/dbhelper"
@tanji
tanji / dateseq.sh
Created June 10, 2015 14:08
Date sequence generator
#!/bin/bash
if [ -z $1 ]
then
echo "example usage: $(basename $0) 20150401 20150530"
exit 1
fi
date=$1
while true
do
echo $date
sysbench \
--test=/usr/share/doc/sysbench/tests/db/oltp.lua \
--mysql-host=localhost \
--mysql-port=3306 \
--mysql-user=root \
--mysql-password=admin \
--mysql-db=test \
--mysql-table-engine=innodb \
--mysql-ignore-errors=all \
--oltp-test-mode=complex \
@tanji
tanji / MaxScale+Pacemaker.on.CentOS.7.md
Last active August 29, 2015 14:27 — forked from scottames/MaxScale+Pacemaker.on.CentOS.7.md
MaxScale & Pacemaker on CentOS 7

MaxScale & Pacemaker on CentOS 7

Install packages on both nodes

sudo yum install corosync pcs pacemaker maxscale

Set the password for the hacluster user [both nodes]

@tanji
tanji / multisource.md
Last active August 29, 2015 14:27
MONyog multisource monitor setup
  • Go to Customize -> "Manage Changes" tab
  • Select the drop down menu in the right top corner
  • Click "Add/Edit New Custom SQL Object"
  • Click "Add New CSO"
  • In "Name" enter Multisource_1
  • In "SQL Query" enter SHOW SLAVE 'db1' STATUS
  • In "Key columns" enter Seconds_Behind_Master,Slave_SQL_Running
  • In "Servers" enter the server list to which this multisource connection applies, or leave empty if it applies to all servers
  • Click on "Save" at the bottom
  • Go to Monitors -> Replication
[mysqld]
binlog_format=ROW
innodb_buffer_pool_size=64M
innodb_autoinc_lock_mode=2
innodb_flush_log_at_trx_commit=2
bind-address=0.0.0.0
#galera settings
wsrep_provider=/usr/lib64/galera/libgalera_smm.so
wsrep_cluster_name="my_wsrep_cluster"
wsrep_cluster_address=gcomm://192.168.50.101,192.168.50.102,192.168.50.103
version: '2'
services:
db1:
image: mariadb:latest
environment:
- MYSQL_ROOT_PASSWORD=admin
command: mysqld --log-bin --server-id=1
db2:
image: mariadb:latest
environment:
version: '2'
services:
node1:
image: mariadb:10.1
environment:
- TERM=xterm
- MYSQL_ROOT_PASSWORD=admin
- MYSQL_INITDB_SKIP_TZINFO=1
volumes:
- ~/Dev/docker/compose/galera/conf.d:/etc/mysql/conf.d