Linux centos5.6 version mysql5.6 master-slave Environment installation configuration

Source: Internet
Author: User
Tags curl

MySQL database supports the master-slave replication function of the database, so in the cluster has its unique advantages, the domestic and foreign large-scale Web site architecture system, has adopted the MySQL master-slave database configuration to achieve query load, database hot-standby and other functions. I am here to make a simple summary of how to configure the implementation.

Server configuration, specific IP, master and slave libraries as follows

Main Library ip:192.168.1.189 master server from library ip:192.168.1.188 slave server

The server system is: centos5.6, download the installation package specifically includes the following

Mysql-client-5.6.13-1.linux_glibc2.5.x86_64.rpmmysql-devel-5.6.13-1.linux_glibc2.5.x86_64. Rpmmysql-server-5.6.13-1.linux_glibc2.5.x86_64.rpmmysql-shared-5.6.13-1.linux_glibc2.5.x86_64. rpmmysql-shared-compat-5.6.13-1.linux_glibc2.5.x86_64.rpmmysql-test-5.6.13-1.linux_glibc2.5.x86_64.rpm

Install MySQL and install all the required RPM files via the Yum command

Yum-y Install Libaio libaio-devel perl-time-hires Curl curl-devel zlib-devel openssl-devel perl cpio expat-devel gettext- Devel perl-extutils-makemaker PERL-DBD-MYSQLRPM-IVH MYSQL-TEST-5.6.13-1.LINUX_GLIBC2.5.X86_64.RPMRPM-IVH mysql-shared-5.6.13-1.linux_glibc2.5.x86_64.rpm RPM-IVH mysql-shared-compat-5.6.13-1.linux_glibc2.5.x86_64.rpm RPM-IVH mysql-server-5.6.13-1.linux_glibc2.5.x86_64.rpm RPM-IVH mysql-devel-5.6.13-1.linux_glibc2.5.x86_64.rpm rpm -IVH mysql-client-5.6.13-1.linux_glibc2.5.x86_64.rpm

Second, modify the master and slave configuration, note that some parameters should be adjusted according to the actual situation, the specific steps are as follows

Main Library/ETC/MY.CNF configuration:

[Client]port = 3306socket =/state/partition1/mysql/mysql.sockdefault-character-set=utf8[mysqld]server-id= 1025log-bin=mysql-master-binbinlog_format = Mixedexpire_logs_days=15max_connections=1000innodb_flush_log_at_trx_ Commit=1sync_binlog=1binlog-do-db=denovo_ngbinlog-ignore-db=mysql,test,information_schemainnodb_buffer_pool_ Size = 46673mskip-name-resolvedatadir =/state/partition1/mysql/dataport = 3306socket =/state/partition1/mysql/ Mysql.sockkey_buffer_size=16mmax_allowed_packet=16mjoin_buffer_size = 512msort_buffer_size = 256Mread_rnd_buffer_ Size = 128M Innodb_buffer_pool_size = 40960msql_mode=no_engine_substitution,strict_trans_tables

From the library/etc/my.cnf configuration, the specific code is as follows

[Client]port = 3306socket =/state/partition1/mysql/mysql.sock[mysqld]server-id=1052datadir =/state/partition1/ Mysql/dataport = 3306socket =/state/partition1/mysql/mysql.sockuser=mysqllog-bin=mysql-slave-binmax_binlog_size= 1000mbinlog_format = mixedexpire_logs_days=7innodb_flush_log_at_trx_commit=1sync_binlog=1read_only=1binlog-do-db =denovo_ngbinlog-ignore-db=mysql,test,information_schemainnodb_buffer_pool_size = 36673Mskip-name-resolvemax_ Connections=1000max_user_connections=490max_connect_errors=2key_buffer_size=16mmax_allowed_packet=16mjoin_ Buffer_size = 512msort_buffer_size = 256mread_rnd_buffer_size = 128M Innodb_buffer_pool_size = 40960Msql_mode=NO_ENGINE _substitution,strict_trans_tables

Third, the master-slave Library account authorization operation:

Main Library

Grant Replication Slave on * * to ' jpsync ' @ ' 192.168.1.189 ' identified by ' jppasswd '; flush privileges;show master status; #查看主库信息

From the Library

Stop Slave;change Master to master_host= ' 192.168.1.188 ', master_port=3306,master_user= ' Jpsync ', master_password= '  JPPASSWD ', master_log_file= ' mysql-master-bin.000003 ', master_log_pos=408; Start slave;show slave status\g;

If it appears

Slave_IO_Running:YesSlave_SQL_Running:Yes

Indicates that MySQL master/slave library is successful.

Article Source Address: http://www.yoodb.com/article/display/273

Linux centos5.6 version mysql5.6 master-slave Environment installation configuration

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.