MySQL master-slave installation précis-writers

Source: Internet
Author: User

Install two database version 5.7.19

10.168.21.180 GSM1 Gsm1.localdomain
10.168.21.181 gsm2 Gsm2.localdomain

Installing the Software
Configure/ETC/MY.CNF
Build Library mysqld--defaults-file=/etc/my.cnf--initialize--user=mysql
Start Mysqld_safe--defaults-file=/etc/my.cnf--user=mysql &
Change Password Set password = password (' rootroot ');
Upgrade Mysql_upgrade-uroot-prootroot


Master Library Backup Data
Mysqldump--single-transaction-uroot-prootroot-a--master-data=2 > Alldb.sql
--Change MASTER to master_log_file= ' mysql-bin.000002 ', master_log_pos=550;

Recovering data from a library
SCP Alldb.sql Gsm2:/root/backup
Mysql-uroot-prootroot <alldb.sql


Master Library Authorization: Create a backup user
Grant Replication Slave on * * to ' bak ' @ ' 10.168.% ' identified by ' rootroot ';
Flush privileges;


Configure the replication starting point from the library and start copying
Change MASTER to
Master_host= ' 10.168.21.180 ',
Master_user= ' Bak ',
Master_password= ' Rootroot ',
master_port=3306,
Master_log_file= ' mysql-bin.000002 ',
master_log_pos=550;

Start slave;

View status

Mysql>show slave status\g;*************************** 1. Row***************************slave_io_state:waiting forMaster toSend event Master_host:10.168.21.180Master_user:bak Master_port:3306Connect_retry: -Master_log_file:mysql-Bin.000002Read_master_log_pos:991relay_log_file:gsm2-Relay-Bin.000002Relay_log_pos:761Relay_master_log_file:mysql-Bin.000002Slave_io_running:yes Slave_sql_running:yes replicate_do_db:replicate _ignore_db:replicate_do_table:replicate_ignore_table:replicate_wild_do_table:replicate_wild_ Ignore_table:last_errno:0Last_error:skip_counter:0Exec_master_log_pos:991Relay_log_space:967until_condition:none Until_log_file:until_log_pos:0Master_ssl_allowed:no Master_SSL_CA_File:Master_SSL_CA_Path:Master_SS L_Cert:Master_SSL_Cipher:Master_SSL_Key:Seconds_Behind_Master:0master_ssl_verify_server_cert:no Last_io_errno:0Last_io_error:last_sql_errno:0Last_SQL_Error:Replicate_Ignore_Server_Ids:Master_Server_Id:33001master_uuid:8a0a909d-e469-11e7-95c0-005056b9c142 master_info_file:/Data0/Mysql/Data/Dbatest/master.info Sql_delay:0Sql_remaining_delay:NULLSlave_sql_running_state:slave hasRead  AllRelayLog; Waiting forMore updates Master_retry_count:86400Master_Bind:Last_IO_Error_Timestamp:Last_SQL_Error_Timestamp:Master_SSL _crl:master_ssl_crlpath:retrieved_gtid_set:executed_gtid_set:auto_po Sition:0Replicate_Rewrite_DB:Channel_Name:Master_TLS_Version:1Rowinch Set(0.00sec) Error:no query specified

MySQL master-slave installation précis-writers

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.