Record mysql master Configuration

Source: Internet
Author: User


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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.