MySQL notater
From Teknologisk videncenter
simple Master slave replication setup
- See [1]
Master
my.cnf:
[mysqld]
log-bin
server-id=1
#Next is only required if the
#master is a slave as well
log-slave-updates
Setup up in shell
shell> mysqldump –master-data \
> master.sql
mysql> GRANT REPLICATION SLAVE ON *.*
-> to rpl_user@host IDENTIFIED BY
-> ‘rpl_pass’;
Slave
my.cnf:
[mysqld]
server-id=2
Setup in shell
shell> mysql < master.sql
mysql> CHANGE MASTER TO
-> MASTER_HOST=‘master host’,
-> MASTER_USER=‘rpl_user’,
->
MASTER_PASSWORD=‘rpl_pass’,
-> MASTER_PORT=MySQL_port;
mysql> SLAVE START;