xtrabackup for populating slaves

Just been playing with Percona’sXtraBackup and the initial results are very good. I have been using it to populate new slaves from a master with no real downtime.

I found a couple of bugs in the innobackupex script which have been reported. I needed to change line 1760 to

my $wildcard = ‘*.{frm,MYD,MYI,MRG,TRG,TRN,opt,par,ARZ,ARM}’;

Update : This bug has been fixed in the recent 0.9 version

As we use both partitioned and archive tables (it appears the bug also exists in Innodb’s version as well)

The slaves were set up with clean installs of MySQL 5.1.35 (centos5 64bit) and the my.cnf was copied over changing the server-id.

On the host I ran

innobackupex-1.5.1 –stream=tar /tmp/ –slave-info -password=????? | ssh USERNAME@HOSTNAME “tar xfi – -C /var/lib/mysql”

When this had completed on the slave I ran

¬†innobackupex-1.5.1 –apply-log –use-memory=2G /var/lib/mysql

MySQL was then started on the slave and the slave process started using the information from the xtrabackup_slave_info file created on the slave.

CHANGE MASTER TO MASTER_HOST=’????????’, MASTER_USER=’?????’, MASTER_PASSWORD=’??????’, MASTER_LOG_FILE=’mysql-bin.005959′, MASTER_LOG_POS=64860928


Results are looking good so far

xtrabackup for populating slaves

Installing an Open VZ Container

These assume you are setting up a 64bit Centos container from the template centos-5-x86_64 in container 101

vzctl create 101 –ostemplate centos-5-x86_64
vzctl set 101 –ipadd 192.168.0.?? –save
vzctl set 101 –nameserver –nameserver –save
vzctl set 101 –save –hostname ??

Set the memory to 1GB

vzctl set 101 –save –vmguarpages 262144
vzctl set 101 –save –oomguarpages 262144
vzctl set 101 –save –privvmpages 262144:393216

and Disk to 10GB

vzctl set 101 –save –diskspace 10G

Start and enter the container

vzctl start 101
vzctl enter 101

Installing an Open VZ Container

Installing OpenVZ on Centos5

These instructions assume a clean base install of Centos 5.2 – 64Bit

cd /etc/yum.repos.d
wget http://download.openvz.org/openvz.repo
rpm –import http://download.openvz.org/RPM-GPG-Key-OpenVZ

Edit the file /etc/sysctl.conf and append the following lines to the end

# On Hardware Node we generally need
# packet forwarding enabled and proxy arp disabled
net.ipv4.ip_forward = 1
net.ipv6.conf.default.forwarding = 1
net.ipv6.conf.all.forwarding = 1
net.ipv4.conf.default.proxy_arp = 0
# Enables source route verification
net.ipv4.conf.all.rp_filter = 1
# Enables the magic-sysrq key
kernel.sysrq = 1
# We do not want all our interfaces to send redirects
net.ipv4.conf.default.send_redirects = 1
net.ipv4.conf.all.send_redirects = 0

Reboot the server

Install extra tools

yum install vzctl.x86_64 vzquota.x86_64
wget -c http://download.openvz.org/template/utils/vzyum/2.4.0-11/vzyum-2.4.0-11.noarch.rpm
rpm –nodeps -Uvh vzyum*.rpm
yum install vzpkg vzyum vzrpm43-python vzrpm44-python vzctl-lib

Download precreated templates from


and copy to /vz/template/cache

Installing OpenVZ on Centos5