IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changes between Version 17 and Version 18 of MySqlReplication


Ignore:
Timestamp:
Nov 7, 2014, 10:01:56 AM (12 years ago)
Author:
Serge CHASTEL
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • MySqlReplication

    v17 v18  
    174174*) Make sure that slave01 and slave02 both run the exact same version of mysql
    175175
    176 *) Stop the replication on slave01
    177 {{{
    178 mysql@slave01> STOP SLAVE;
     176*) Stop the mysql server on slave01
     177{{{
     178shell@slave01> mysqladmin -u root -p shutdown now
    179179}}}
    180180
    181181*) RSync the contents of /var/lib/mysql on slave01 to /var/lib/mysql.slave01 on slave02
    182182{{{
    183 shell> rsync -av root@slave01:/var/lib/mysql /var/lib/mysql.slave01
     183shell@slave02> rsync -av root@slave01:/var/lib/mysql /var/lib/mysql.slave01
    184184}}}
    185185
    186186*) Stop the mysql server on slave02 if it is running, backup /etc/mysql/my.cnf on slave02 and copy /etc/mysql/my.cnf from slave01 there
    187187{{{
    188 shell> mysqladmin -u root -p shutdown now
    189 shell> cd /etc/mysql
    190 shell> mv my.cnf my.cnf.before_rsync
    191 shell> scp root@slave01:/etc/mysql/my.cnf .
     188shell@slave02> mysqladmin -u root -p shutdown now
     189shell@slave02> cd /etc/mysql
     190shell@slave02> mv my.cnf my.cnf.before_rsync
     191shell@slave02> scp root@slave01:/etc/mysql/my.cnf .
    192192}}}
    193193
    194194*) Edit /etc/mysql/my.cnf on slave02 and change the server-id.
    195 The server-id value has to be a number, I usually use
     195The server-id value has to be a number, I usually use YYYYMMDD<RUNNING NUMBER>, e.g. for the 5th slave install on 2025 Nov 6th (busy day), I would use:
     196{{{
     197server-id = 2025110605
     198}}}
     199
     200*) If you want to be super-safe (and if you have space), make a copy of the rsync on slave02
     201{{{
     202shell> cp -a /var/lib/mysql.slave01 /var/lib/mysql.slave01.sos
     203}}}
     204
     205*) Make mysql.slave01 the new mysql data directory
     206{{{
     207shell@slave02> mv /var/lib/mysql /var/lib/mysql.before_rsync.delete_me_when_working
     208shell@slave02> mv /var/lib/mysql.slave01 /var/lib/mysql
     209}}}
     210
     211*) Start the mysql server on slave02
     212{{{
     213shell@slave02> /etc/init.d/mysql zap
     214shell@slave02> /etc/init.d/mysql start
     215}}}
     216
    196217= Enjoy... =
    197218It might be necessary to tell the slave to ignore some updates: