Home PC Games Linux Windows Database Network Programming Server Mobile  
  Home \ Database \ MySQL 5.6 master-slave replication configuration     - Talk about Java in the collection (Programming)

- Use Vagrant up a local development environment tutorials (Server)

- Using nmcli commands to manage network in RedHat / CentOS 7.x (Linux)

- ethtool implementation framework and application in Linux (Linux)

- How to use the Linux command compress JPEG images (Linux)

- Linux fast set ip bond (Linux)

- RedHat Performance Tuning (Server)

- Android Studio utility plug organize, create sharp artifact (Programming)

- How to install Linux Kernel 4.4 on Ubuntu (Linux)

- AWR Report (Database)

- Inject script commands manually annotated summary (Linux)

- ActiveMQ5.11.1 and JDK version matching relation (Linux)

- MySQL bulk insert data script (Database)

- Docker Basic and Advanced (Linux)

- Linux Getting Started tutorial: Ubuntu 14.04 in the installation Sogou Pinyin (Linux)

- The Java Properties class action (Programming)

- The maximum subsequence algorithm and optimization problems (Programming)

- Use PXE with kickstart to install Linux automatically (Linux)

- Use apt-p2p up a local Debian package cache (Server)

- Executable file format Explanation under Linux (Linux)

  MySQL 5.6 master-slave replication configuration
  Add Date : 2016-08-14      
  Environment Description:

MySQL5.6.21 two servers installed in CentOS6.5 of: master and slave

Master Server:


Port: 3316

Slave server:


Port: 3316

Configuration steps:

1, modify the master's my.cnf configuration file, open the log and set server-id.

2, modify the slave's my.cnf configuration file, open the read binary log and set server-id.

3, starting with the slave master connected to the slave.

4, check whether the configuration and troubleshooting.

1, modify the master's my.cnf configuration file in the [mysqld] By adding the following configuration:


log-bin = / usr / local / mysql56 / binlog / master-bin

log-bin-index = / usr / local / mysql56 / binlog / master-bin.index

server-id = 1


log-bin configuration is to open the binary log and the log written on the path configuration. Log records will be recorded master-bin.000001 way.

log-bin-index configuration directory is the binary log file. Each row is the binary path of the log file in the file.

server-id is the MySQL server service ID, used to distinguish the master-slave configuration of other servers.

After the configuration, restart the mysqld service.

NOTE: If you do not define log-bin filename is hostname hostname to name, once the host name changes, you will not see for looking for a binary file error. So better to display the specified file name.

2, modify the slave's my.cnf configuration file in the [mysqld] By adding the following configuration:

server-id = 11

relay-log = / usr / local / mysql56 / binlog / slave-relay-bin

relay-log-index = / usr / local / mysql56 / binlog / slave-relay-bin.index

server-id and master the same meaning, is used to distinguish different mysql servers.

relay-log to record the received relay binary logs. relay-log-index log path to save the received index. If you do not specify a file name is displayed, places hostname value name.

After saving can restart mysqld service.

3, starting with the slave master connected to the slave.

Log on to the slave mysql, the mysql>: to operate under.

1.1, mysql> stop slave; // stop the slave.

2.2, mysql> change master to

-> Master_host = '', // note that there is a comma

-> Master_port = 3316,

-> Master_user = 'root',

-> Master_password = 'root';

1.3, mysql> start slave;

4, check whether the configuration and troubleshooting

mysql> show slave status \ G;

In the printed state, view the value of the following two parameters:

Slave_IO_Running: Yes

Slave_SQL_Running: Yes

If the value of these two parameters are yes, then run properly, you can add a database or add a table in the master database, check the slave exists on the database.

If any one of these two parameters have not Yes, then there is a problem. Database error log file can be viewed on the slave view the error cause.

Common Cause:

1, server-id is consistent.

2, the user privilege. Permissions include: REPLICATION SLAVE, RELOAD, CREATE USER, SUPER.


3, consistent database UUID, if mysql is installed by bulk copy installed, there may UUID consistent database, enter the datadir database, modify auto.cnf. Freely modified under uuid values ​​in the service can restart mysqld.

4, Master database port is blocked by the firewall.
- HTTP and HTTPS request response process difference (Linux)
- Elaborate .NET Multithreading: Concepts (Programming)
- HashMap in Android and Java different implementations (Programming)
- Java reflection Introduction (Programming)
- Android Studio commonly used shortcuts and how to follow the Eclipse Shortcuts (Linux)
- IPTABLES configuration steps under Linux (Linux)
- Linux systems for entry-learning - Install Go language in Linux (Linux)
- Modify Linux terminal prompt path length (Linux)
- To use iostat display I / O status under Linux (Linux)
- Linux pwd command learning experience (Linux)
- Linux host system monitoring implement the cgi (Server)
- Node.js developers must know four JavaScript concepts (Programming)
- Linux, Oracle listen address modification (Database)
- Usage logs Python library (Programming)
- Nginx Proxy timeout Troubleshooting (Server)
- Linux Learning --- disk partition / relational representation + mount (Linux)
- Detailed LVM2 (Linux)
- Use MongoDB C # MongoDB official driving operation (Database)
- Use Ansible installation NGINX and NGINX Plus (Server)
- Getting Started with Linux system to learn: How to compress JPEG images on the command line (Linux)
  CopyRight 2002-2020 newfreesoft.com, All Rights Reserved.