MySQL master-slave database configuration

Source: Internet
Author: User

In here yesterday do the master-slave database configuration record down, lest later toss

Database master-Slave configuration experience: master:192.168.16.247slave1:192.168.16.2481 Modify the configuration file/etc/mysql/my.cnf (if my.cnf already has the configuration item, modify it accordingly)                 Primary database: Server-id = 1log-bin = Mysql-binlog-bin-index = Mysql-bin.index#log_bin =/var/log/mysql/mysql-bin.logbinlog_do_db = Flyticket_safe from database: Server-id = 2master-ho ST = 192.168.16.247[Primary Database IP Address]master-user = newbackup[the user name connecting to the primary database]master-password = backup[connection Connect to the primary database password]master-port = 3306[Port]master-connect-retry = 60log-slave-updatesreplicate-do-db = Flyticke t_safe[database]log-bin = Mysql-binbinlog_format = Mixed#log_bin =/var/log/mysql/mysq L-bin.logexpire_logs_days = 10max_binlog_size = 100M2 Add users and authorizations separately on the master machine, such as: Execute on 247: GRANT REPLICATION SL   AVE on * * to ' newbackup ' @ ' 192.168.16.248 ' identified by ' backup '; 3 performed on Master: Flush tables with read lock;   SHOW MASTER STATUS; +------------------+----------+--------------+------------------+   | File | Position | binlog_do_db |   binlog_ignore_db | +------------------+----------+--------------+------------------+   |     mysql-bin.000003 |              1049 |                  |   | +------------------+----------+--------------+------------------+ unlock tables;4 perform change master to Master_ on slave Host= ' 192.168.16.235 ', master_user= ' newbackup247 ', master_password= ' backup ', master_log_file= ' mysql-bin.000001 ', master_log_pos=107; [Mysql-bin.000003 1049 changed to show Master STATUS in main database,]slave start;5 configuration semi-synchronous: [Some not supported] installation on Main Library: Install plugin Rpl_semi_sync_mast   Er soname ' semisync_master.so '; Whether the query was installed successfully: SELECT * from INFORMATION_SCHEMA. PLUGINS where plugin_name= ' Rpl_semi_sync_master ' \g installed from the library: Install PLUGIN rpl_semi_sync_slave soname ' semisync_slave.so   ‘;   Configuration on the main library: set global Rpl_semi_sync_master_enabled=1;set global rpl_semi_sync_master_timeout=1000; Configure from Library: Set global rpl_semi_sync_slave_enabled=1;6 View configuration from database show slave status \g

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.