Difference between revisions of "MySQL notater"

From Teknologisk videncenter
Jump to: navigation, search
m (Slave)
m (simple Master slave replication setup)
Line 1: Line 1:
 
= simple Master slave replication setup =
 
= simple Master slave replication setup =
 +
*See [http://www.linuxforum.dk/2004/program/slides/carsten_pedersen/LinuxForum-MySQL.pdf]
 
== Master ==
 
== Master ==
 
my.cnf:
 
my.cnf:

Revision as of 07:50, 16 December 2009

simple Master slave replication setup

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;