MySQL master-slave copy of Lnmp (iv)

Source: Internet
Author: User
Tags crc32 mixed install perl

query whether the system has MySQL installed , and if so, remove it.

Rpm-qa | grep MySQL

to remove the installed MySQL:

Yum Remove mysql-libs-5.1.66-2.el6_3.x86_64

Install the required plugins:

Yum Install Perl perl-devel Libaio libaio-devel

installation Mysql-shared-compat Replace mysql-libs, if not replaced, when you delete mysql-libs, you will be prompted to postfix dependent on Mysql-libs

RPM-IVH mysql-shared-compat-5.6.26-1.el6.x86_64.rpm

To install the service side:

RPM-IVH mysql-server-5.6.26-1.el6.x86_64.rpm

To install the client:

RPM-IVH mysql-client-5.6.26-1.el6.x86_64.rpm

start mysql:

Service MySQL Start

stop mysql:

Service MySQL Stop

get the root password:
More/root/.mysql_secret

To modify the root password and delete the anonymous account:

/usr/bin/mysql_secure_installation--user=mysql

To modify the master server configuration file my.cnf:

#唯一性, cannot repeat
Server-id = 1
#二进制日志文件
Log-bin=mysql-bin

#二进制格式改为行row模式, three Modes statement statement mode, row row mode, mixed mixed mode
#当设置隔离级别为READ-commited must be set to the binary log format as row
#现在MySQL官方认为STATEMENT这个已经不再适合继续使用, but the mixed type can cause master-slave data inconsistency under the default transaction isolation level;
Binlog_format=row

#slave更新是否记入日志
Log-slave-updates=true
#启用gtid类型, otherwise the normal replication architecture
Gtid-mode=on
#强制GTID的一致性
Enforce-gtid-consistency=true
#主服信息记录库 = table or file
Master-info-repository=table
#中继日志信息记录库
Relay-log-info-repository=table
#同步主库信息
Sync-master-info=1
# Turn on library-based multi-threaded replication. Default is 0, do not open, maximum concurrent number is 1024 threads
Slave-parallel-workers=4
#校验码
Binlog-checksum=crc32
#主服校验
Master-verify-checksum=1
#从服校验
Slave-sql-verify-checksum=1
#二进制日志详细记录事件
Binlog-rows-query-log_events=1
#提供复制报告端口
report-port=3306
# Provide replication reporting host
report-host=192.168.2.61


# Here are some settings for the binary log
Binlog_cache_size = 4M
Max_binlog_size = 1G
Max_binlog_cache_size = 2G


# enable this parameter, which can be used to record event-related information in binary logging, to reduce the complexity of troubleshooting
# valid only for row Binlog format. When enabled, more debugging information is written to the Binlog, such as the SQL statement itself is written in. MYSQLBINLOG-VV can see.
Binlog-rows-query-log_events=1

# These two are enabled Relaylog automatic repair function, avoid due to the network and other external causes log corruption, master and slave stop.
Relay_log_purge = 1
Relay_log_recovery = 1

Modify the configuration file from server my.cnf:

Server-id = 2
Log-bin=mysql-bin
Binlog_format=row
Log-slave-updates=true
Gtid-mode=on
Enforce-gtid-consistency=true
Master-info-repository=table
Relay-log-info-repository=table
Sync-master-info=1
Slave-parallel-workers=4
Binlog-checksum=crc32
Master-verify-checksum=1
Slave-sql-verify-checksum=1
Binlog-rows-query-log_events=1

Binlog_cache_size = 4M
Max_binlog_size = 1G
Max_binlog_cache_size = 2G
Binlog-rows-query-log_events=1
Relay_log_purge = 1
Relay_log_recovery = 1

report-port=3306
report-host=192.168.2.63

go to MySQL:

Mysql-u root–p

Create a copy account and authorize :

Grant Replication Slave on * * to ' mysql ' @ ' 192.168.2.% ' identified by ' MySQL ';

Flush privileges; # Reload Permissions

To connect the main library from the library:

Change Master to master_host= ' 192.168.2.61 ', master_user= ' MySQL ', master_password= ' MySQL ', master_port=3306,master_ Auto_position=1;

Start slave;

View Status:

Show global variables like '%uuid%

Show Processlist;

show databases;

show slave status\g;

Show Master Status\g;


This article is from the It DreamWorks blog, so be sure to keep this source http://fly520.blog.51cto.com/2181586/1695817

MySQL master-slave copy of Lnmp (iv)

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.