MySQL master-slave replication and read/write separation

Source: Internet
Author: User

1, MySQL master-slave replication:
Type: 1, copy based on statement, copy Execution command. This method is used by default and is highly efficient.

        2、基于行的复制。将改变的内容复制         3、混合类型的复制

Copy process: Master records changes in the log and notifies the storage engine to commit, slave logs the master to the relay log, slave reads the events from the log and updates them to match the master.

2, MySQL read/write separation: Only write on the primary server, only read from the server

分类: 1、基于程序代码内部实现            2、基于中间代理层实现:客户端是mysql?间通过代理连接。amoeba是代理性产品。

Based on Java language development, things and stored procedures are not supported.

3. Time server: NTP service, port number: 123/UDP

Server-side master configuration file:/etc/ntp.conf

Client sync Time: Ntpdate server IP Address

4, the configuration of master-slave replication:

Configuration of the primary server:

1. Modify the master configuration file/etc/my.cnf

2. Add authorization from the server and restart the server to view the main server log files and offset location values: Show Master status;

From the server configuration:

1, modify the main configuration file/etc/my.cnf, note that the Server-id is different from the primary server

2, configuration and master server synchronization, confirm the successful connection to the primary server: show slave status\g;

Make sure that two threads connect successfully: Slave_io_running:yes and Slave_sql_running:yes

5. mysql read/write separation:

Amoeba:mysql distributed Database Agent layer software. Java-based development enables MySQL to be highly available, load balanced, read/write separated, and so on, requiring Java environment support.

The main configuration files are two: Amoeba.xml and Dbserver.xml

                    端口号:80666/tcp,启动命令 amoeba  start &

MySQL master-slave replication and read/write separation

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.