MySQL Simple Replication Service Build

Source: Internet
Author: User
Tags ssh port

1. Install MySQL source (default in Centos7 does not include MySQL source)wgethttp//repo.mysql.com/mysql-community-release-el7-5.noarch.rpmRPM-IVH mysql-community-release-el7-5. noarch.rpmYum Installmysql-Server2. Configuring mysql-Master added in my.cnf: Prot=3306Log-bin=master-Binlog-bin-index=master-Bin.indexserver-ID=13new Replication User repl_user;grant replication Slave on after restarting MySQL*. * to Repl_user identified by'Xyzzy';4. Configure the standby MySQL add the following lines in the MY.CNF relay-log=slave-Binrelay-log-index=slave-Bin.indexserver-ID=25discover that the standby machine cannot connect to the master server Nmap-v Materip Discovery does not open SSH port 22 so open: Firewall-cmd--zone=public--add-port= A/TCP--Permanent6. Slave database error message: MySQL> Change MASTER to Master_host='192.168.52.129',Master_user='Repl',master_password='repl_1234',master_log_file='mysql-bin.000141',master_log_pos= -; ERROR1794(HY000): Slave is not Configuredor failed to initialize properly. Must at least set--server-IDTo Enableeither a master or a slave. Additional error messages can be foundinchThe mysqlerror log.mysql>show VARIABLES like'server_id';+---------------+-------+| variable_name | Value |+---------------+-------+| server_id |0|+---------------+-------+1RowinchSet (0.00sec) ID does not have an effective configuration inside there are [mysqld] and [Mysqld_safe], the new configuration file placement is not the same, add the new configuration to mysqld under the test, OK success. MySQL> Show variables like'server_id';+---------------+-------+| variable_name | Value |+---------------+-------+| server_id |2|+---------------+-------+1RowinchSet (0.00sec) MySQL>Change Master tomaster_host='192.168.122.1', master_port=3306,    Master_user='Repl_user',    master_password='Xyzzy'; Query OK,0Rows affected,2Warnings (0.05sec) MySQL>start slave; Query OK,0Rows Affected (0.01sec) to test the success of replication: Create a database on master: MySQL>CREATE DATABASE Cydb; Query OK,1Row affected (0.00sec) on slave to see if this database is available: MySQL>show databases;+--------------------+| Database |+--------------------+| Information_schema | | Cydb | | MySQL | | Performance_schema |+--------------------+4RowsinchSet (0.00sec) To this point, the simple replication environment has been successfully paired. 

MySQL Simple Replication Service Build

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.