MASTER. Настройка репликации без простоя
Настройка конфигов
[mysqld] server-id = 1 binlog-format = mixed log-bin = mysql-bin datadir = /var/lib/mysql innodb_flush_log_at_trx_commit = 1 sync_binlog = 1
Рестартим mysql
service mysqld restart
CREATE USER slave@; GRANT REPLICATION SLAVE ON *.* TO slave@ IDENTIFIED BY " "; FLUSH PRIVILEGES;
mysqldump --skip-lock-tables --flush-logs --hex-blob --single-transaction --master-data=2 -A > ~/dump.sql
Настройка slave server
server-id = 100 binlog-format = mixed log_bin = mysql-bin relay-log = mysql-relay-bin log-slave-updates = 1 read-only = 1
Заливаем dump в пустую базу данных
head dump.sql -n100 | grep "MASTER_LOG_FILE"
head dump.sql -n100 | grep "MASTER_LOG_POS"
Заходим в консоль mysql и запускаем репликация
CHANGE MASTER TO MASTER_HOST='',MASTER_USER='slave',MASTER_PASSWORD=' ', MASTER_LOG_FILE=' ', MASTER_LOG_POS= ; START SLAVE; SHOW SLAVE STATUS \G