Chapter 18 (Yahoo web hosting) . Replication 545 3. Move the
Chapter 18 . Replication 545 3. Move the snapshot data into the data directory on the slave. 4. Start the slave server. Since you don t have to get a snapshot from the master, you don t have to stop MySQL on the master. This is a key feature for systems where uptime of the master server is crucial. Examining this type of method a little closer might be helpful. I set up an example that starts from the beginning creating a snapshot on the master. This step has to be performed just this one time; afterward, it won t be necessary unless the master server must be stopped for some unforeseen reason. I am replicating only the ecommerce database. To do that, I add the following line to the [mysqld]section of the MySQL configuration file on the master: replicate-do-db = ecommerce I stop the MySQL server on the master and make a backup of the ecommerce database. cd /var/lib/mysql mkdir snapshot tar -zcvpf ecommerce.tgz ecommerce mv ecommerce.tgz snapshot On the master server, I now have a snapshot of the ecommerce database as it exists at this point in time. That snapshot is safely stored in the snapshotdirectory on the master server. I can restart the master server s MySQL process. I now copy that snapshot to the slave servers. Personally, I prefer to use scp for this task; you may want to use ftp or some other method for transferring the file to the slave server. On each slave server, I stop the MySQL server and then change to the data directory. Next I unarchive the snapshot file that I transferred from the master, and use that file to overwrite the existing ecommerce database folder and files after which I can start the MySQL server on the slave servers. The replication set is up and running, as evidenced by Figure 18-14. If one of the slave servers goes down for any reason, I can simply copy the snapshot that I already created from the master, stop the slave server, overwrite the database, and start the slave server again.
Please visit our professional web hosting services to find out about cheap and reliable webhost service that will surely answer all your demands.