| | 170 | |
| | 171 | = Create a slave from another one = |
| | 172 | *) I assume that we want to create a mysql slave on host slave02 from a (running/functioning) slave named slave01 |
| | 173 | |
| | 174 | *) Make sure that slave01 and slave02 both run the exact same version of mysql |
| | 175 | |
| | 176 | *) Stop the replication on slave01 |
| | 177 | {{{ |
| | 178 | mysql@slave01> STOP SLAVE; |
| | 179 | }}} |
| | 180 | |
| | 181 | *) RSync the contents of /var/lib/mysql on slave01 to /var/lib/mysql.slave01 on slave02 |
| | 182 | {{{ |
| | 183 | shell> rsync -av root@slave01:/var/lib/mysql /var/lib/mysql.slave01 |
| | 184 | }}} |
| | 185 | |
| | 186 | *) 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 |
| | 187 | {{{ |
| | 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 . |
| | 192 | }}} |
| | 193 | |
| | 194 | *) 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 |