[ start | index | login ]
start > knowledgebase > linux > miscapplications > setting up mysql replication

setting up mysql replication

Created by retep. Last edited by retep, 3 years and 81 days ago. Viewed 2,486 times. #3
[diff] [history] [edit] [rdf]
labels
attachments
In the master server mysqld section of /etc/my.cnf you should have something like:
[mysqld]
server-id=1
log-bin
# so user changes do not replicate to the slaves
replicate-ignore-db=mysql
log-warnings
log-slave-updates
skip-bdb

On the master server run:

GRANT REPLICATION SLAVE ON *.* TO 
mysql_slave@slaveserverip identified by 'somepassword'

In the slave MySQL server's /etc/my.cnf file you should have something like:

server-id       = 2
log-bin

Note that the server ids need to be unique for all the servers in your mysql replication cluster.

On the master server run:

SHOW MASTER STATUS
.

On the slave server's MySQL client use some of the values from that command to run the following:

CHANGE MASTER TO MASTER_HOST='masterserverip'
, MASTER_USER='mysql_slave',  MASTER_PASSWORD='somepassword'
, MASTER_LOG_FILE='logfilenameperabove-bin.000003'
, MASTER_LOG_POS=perabove;

SLAVE START;

请以发表评论身份登录
Powered by snipsnap.org Found a mistake in a howto? Let us know via an email to p.blikibugs at rimuhosting com.