aptitude install mysql-server mysql-client
server-id = 1 log-slave-updates replicate-same-server-id = 0 auto_increment_increment = 5 auto_increment_offset = 1 report-host = sql2.example.com master-host = sql2.example.com master-user = username master-password = password innodb_flush_log_at_trx_commit = 1 sync_binlog = 1 skip-slave-start = true binlog-format = ROW log-bin = /var/log/mysql/bin.log log-bin-index = /var/log/mysql/log-bin.index log-error = /var/log/mysql/error.log relay-log = /var/log/mysql/relay.log relay-log-info-file = /var/log/mysql/relay-log.info relay-log-index = /var/log/mysql/relay-log.index
#comment out
#bind-address 127.0.0.1
server-id = 2 log-slave-updates replicate-same-server-id = 0 auto_increment_increment = 5 auto_increment_offset = 2 report-host = sql1.example.com master-host = sql1.example.com master-user = username master-password = password innodb_flush_log_at_trx_commit = 1 sync_binlog = 1 skip-slave-start = true binlog-format = ROW log-bin = /var/log/mysql/bin.log log-bin-index = /var/log/mysql/log-bin.index log-error = /var/log/mysql/error.log relay-log = /var/log/mysql/relay.log relay-log-info-file = /var/log/mysql/relay-log.info relay-log-index = /var/log/mysql/relay-log.index
restart mysql
/etc/init.d/mysql restart
mysql -u root -p CREATE USER 'username'@'sql2.example.com'
IDENTIFIED BY 'password'; GRANT ALL PRIVILEGES ON *.*
TO 'username'@'sql2.example.com'
WITH GRAND OPTION; FLUSH PRIVILEGES;
CREATE USER 'username'@'sql1.example.com'
TO 'username'@'sql1.example.com'
mysql -u username -ppassword -e "start slave"
No comments:
Post a Comment