Create Replication User on master
mysql> create user dbsync@'192.168.188.%' identified by 'password';
mysql> grant replication slave, replication client on *.* to dbsync@'192.168.188.%';
Configure /etc/my.cnf on master
[mysqld]
log_bin=mysql-bin
binlog_format=row
server_id=1
relay-log=relay-bin
relay-log-index=relay-bin-index
Configure /etc/my.cnf on slave
[mysqld]
log_bin=mysql-bin
server_id=2
relay-log=relay-bin
relay-log-index=relay-bin-index
read-only=true
log-slave-updates=true
binlog-do-db=jiradb
replicate-do-db=jiradb
Create a Snapshot of DB on master
/* Open a session of terminal: */
mysql> FLUSH TABLES WITH READ LOCK;
/* Open another session of terminal: */
# mysqldump -uroot -p --databases jiradb --lock-all-tables >/tmp/dbdump.db
Import Snapshot of master DB to slave
# mysql -uroot -p </tmp/dbdump.db
Slave Configuration
mysql> CHANGE MASTER TO
MASTER_HOST='192.168.188.146',
MASTER_USER='dbsyncuser',
MASTER_PASSWORD='1234',
MASTER_LOG_FILE='mysql-bin.000002',
MASTER_LOG_POS=107;
mysql> start slave;
The master_log_file and master_log_pos shall be same with result of " show master status" on master.
show master status
Unlock MySQL on master
mysql> UNLOCK TABLES;