Centos 6.3 under MySQL master copy notes

Source: Internet
Author: User
Tags copy log log centos iptables

The MySQL master-slave copy structure is based on the MySQL Bin-log log from the library by opening the IO process to receive the Bin-log log increment information from the main library, and save to the local relay log, and then by opening the MySQL process from relay The increment information obtained on log is translated into the SQL statement and written to the database.

The master-slave replication architecture can actually implement two functions

1. A database backup instance that serves as the main library from the library

2. Read-write Separation Main library is responsible for normal read and write data from the library only responsible for reading data

The actual production environment because many applications actually read the database more often than the number of write the database so in the beginning of the project development program to make a judgment for all read operations all push to from the library if the data can not be obtained from the library and then to the main library to obtain data in a sense to achieve a read-write separation of the main library to alleviate the IO pressure.

This architecture is recommended for use in production environments.

System Environment centos6.3 x64

Database mysql-5.6.10

MySQL master:192.168.100.90

MySQL slave:192.168.100.91

I. Deployment environment

1. Close Iptables and SELinux

# Service Iptables Stop

# Setenforce 0

# Vi/etc/sysconfig/selinux

---------------

Selinux=disabled

---------------

2. Install and configure MySQL portal http://showerlee.blog.51cto.com/2047005/1174141

Two. Master MySQL configuration: (MySQL Master)

Modify MySQL configuration file

# VI/ETC/MY.CNF

Add to

-----------------

# Replication Master Server

# Bin Log Path

Log-bin =/usr/local/mysql/log/bin.log

# Server ID Number

Server-id = 1

# Ignore MySQL system library replication

Binlog-ignore-db=mysql

Binlog-ignore-db=information_schema

------------

Restart Service

# Service Mysqld Restart

Login to MySQL background

# mysql-u root-p123456

View login account Now

> select User ();

Add sync account number to slave in master

This column more highlights: http://www.bianceng.cn/database/MySQL/

> Grant replication slave on *.* to ' slave ' @ ' 192.168.100.91 ' identified by ' 123456 ';

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.