复制代码 代码如下:
[mysqld]
server-id = 1
log-bin
innodb_flush_log_at_trx_commit=1
sync_binlog=1
datadir=/var/lib/mysql
character-set-server=utf8
init_connect='SET NAMES utf8'
复制代码 代码如下:
[mysqld]
server-id=2
datadir=/var/lib/mysql
character-set-server=utf8
init_connect='SET NAMES utf8'
复制代码 代码如下:
GRANT REPLICATION SLAVE ON *.*
TO '<slave_username>'@'<slave_ip>'
IDENTIFIED BY '<slave_password>';
复制代码 代码如下:
sudo innobackupex-1.5.1 --stream=tar /tmp/ | ssh <slave_host> "mkdir /tmp/db; tar xfi - -C /tmp/db/"
复制代码 代码如下:
innobackupex-1.5.1 --apply-log /tmp/db
innobackupex-1.5.1 --copy-back /tmp/db
chown -R mysql.mysql /var/lib/mysql/*
复制代码 代码如下:
CHANGE MASTER TO
MASTER_HOST='<master_host>',
MASTER_USER='<slave_username>',
MASTER_PASSWORD='<slave_password>',
MASTER_LOG_FILE='<see xtrabackup_binlog_info>',
MASTER_LOG_POS=<see xtrabackup_binlog_info>;
START SLAVE;
新闻热点
疑难解答