Bootstrap Galera Cluster for MySQL

The script is available at github. Only tested with Ubuntu 12.04 and RHEL 6.3.

$ git clone git@github.com:alyu/dbtools.git
$ cd dbtools/galera
$ ./bootstrap-galera.sh
!! Running this Galera bootstrap will wipe out any current MySQL installation that you have on your hosts !!
Continue? (Y/n):
Download Galera packages (Y/n):
What is your OS on your DB nodes [ubuntu|redhat]: (ubuntu)
Galera MySQL tarball (https://launchpad.net/codership-mysql/5.5/5.5.28-23.7/+download/mysql-5.5.28_wsrep_23.7-linux-x86_64.tar.gz): 
Galera wsrep library (https://launchpad.net/galera/2.x/23.2.2/+download/galera-23.2.2-amd64.deb): 
Downloading packages...
Generate install scripts (Y/n):
MySQL install dir (/usr/local):
MySQL data dir (/var/lib/mysql):
InnoDB buffer pools size (1G):
InnoDB log file size (1G):
Where are your Galera hosts () [ip1 ip2 ... ipN]: 10.0.3.140 10.0.3.150 10.0.3.160
Name your Galera Cluster (my_galera_cluster):
SST method [rsync|xtrabackup] (rsync):
Writeset slaves/parallel replication (1):
Generate tarball (Y/n):
SSH user (alex):
SSH pub key (/home/alex/.ssh/id_rsa.pub):
SSH port (22):
Creating tarball...
Deploy Galera (Y/n):
*** Bootstraping  10.0.3.140...
*** Installing Galera wsrep provider
Killing any MySQL server running...
...
Do you want to secure your Galera cluster (y/N): y
Enter a new MySQL root password: root123
Securing MySQL...
Galera Cluster for MySQL installed...
Done..0h:1m:52s

Tags: 

Simple helper scripts for managing lxc on Ubuntu

The scripts are available at github. Only tested on Ubuntu 12.04 LTS.

As default (for my dev env) each container will get its own separate mounted /opt (under host's /opt/lxc/\) and /mnt/dbext4 (/mnt/dbext4/lxc/\) and /mnt/dbxfs (/mnt/dbxfs/lxc/\). Containers will be named as 'name-seqno'. Paths/defaults can be changed by editing etc/config. There are no shared disks between the containers. Install:

Tags: 

Add MongoDB repo for apt and/or yum (bash)

#!/bin/bash

[ `whoami` != "root" ] && echo "Do: sudo $(basename $0)" && exit 1

install=$1

dist="Unknown"
regex_lsb="Description:[[:space:]]*([^ ]*)"
regex_etc="/etc/(.*)[-_]"

do_lsb () {
lsb=`lsb_release -d`
[[ $lsb =~ $regex_lsb ]] && dist=${BASH_REMATCH[1]} ; return 0
return 1
}

do_release_file () {
etc_files=`ls /etc/*[-_]{release,version} 2>/dev/null`
for file in $etc_files
do
  [[ $file =~ $regex_etc ]] && dist=${BASH_REMATCH[1]} ; break
done
}

if [ `command -v lsb_release` ]
then
  do_lsb
  [ $? -ne 0 ] && do_release_file
else

Tags: 

Unison OS X launchd plist

unison_sync.sh

#!/bin/bash
pref=my_unison_pref
pid=`pgrep unison`

[ -z $pid ] && $HOME/bin/unison $pref -auto -batch

unison_sync.plist

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
  <dict>
    <key>Label</key>
    <string>unison_sync</string>
    <key>ProgramArguments</key>
    <array>

Tags: 

Build unison 2.40.65 (ocaml 4.0) to work between Ubuntu 12.04 and OS X Mountain Lion

I could not find any pre-built binaries (macports) that worked properly out of the box between my laptop and the ubuntu server. So build your own.

NOTE: This will break unison with hosts that use unison 2.40.65 built with ocaml 3.x!

Tags: 

Pages

Subscribe to Front page feed