Record the mysql master configuration 1. First add the replication mysql account: www.2cto.com grant replication slave, replication client, RELOAD, super on *. *
'Replicate' @ '10. 10.1.69 'identified BY 'softc123'; flush privileges; 2. cp/usr/share/mysql/my-medium.cnf/etc/my. cnf3. modify my. cnf configuration file, configure mysql replication www.2cto.com server-id = 2master-connect-retry = response = testdbreplicate-ignore-db = primary = 1read_only = 1relay_log = mysql-relay-bin sync_binlog = primary = 1 (id auto-increment) settings, set another mysql TO 2) use the command TO modify the master configuration change master to MASTER_HOST = '10. 10.1.69 ', MASTER_USER = 'replicate', MASTER_PASSWORD = 'softc123 ',
MASTER_LOG_FILE = 'mysql-bin.000005 ', MASTER_LOG_POS = 0; (MASTER_HOST information can be written to the configuration file before mysql 5.5, which is not recommended for maintenance) 4. connection host slave start; -- View slave server status show slave status \ G; show master status; www.2cto.com 5. monitoring has written a simple monitoring shell script with reference to the Internet. It uses linux crontab for timed detection #! /Bin/sh/usr/bin/mysql-uroot-p123456-h127.0.0.1-e "slave start; "NUM = ($ (/usr/bin/mysql-uroot-p123456-h127.0.0.1-e" show slave status \ G "| grep-ie
Running | grep Yes | wc-l) if ["$ NUM"-eq "2"]; thenecho "slave start sucessfull .... "else echo" slave start fail .... "echo" replication test "| mail-s" linux shell email subject "xxx@xxxx.com # send an email to your mailbox exitfiecho $ NUM