Home > Database > Mysql Tutorial > MySQL - some parameter configurations for master-slave replication

MySQL - some parameter configurations for master-slave replication

黄舟
Release: 2017-01-21 13:30:04
Original
1220 people have browsed it

In the previous blog post "MySQL - Master-Slave Replication (Read-Write Separation) Implementation", I introduced you to how to configure MySQL's master-slave replication, and briefly introduced some simple management operations of master-slave synchronization. In this blog post, I will introduce to you how to configure some parameters of MySQL master-slave replication. So let’s get down to business.

1. How to avoid some errors

For example, if a table in the slave database does not exist, causing the synchronization of the entire slave database to be stuck, etc., you can configure the my.cnf of the slave database and add the following configuration

slave-skip-errors = 1032,1062,126,1114,1146,1048,1396
Copy after login

When these error codes occur, the master-slave replication will still skip the error and continue to synchronize the next record

2. There is a database on the main database that does not need to be synchronized

If the main database There is a database on the main database that does not need to be synchronized. You can add

binlog-ignore-db = testdb
Copy after login

3 to the configuration file of the main database. 3. Only synchronize a certain database.

If you only want to synchronize a certain database, you can add # in the configuration file. ##

binlog-do-db =testdb
Copy after login

If neither exists, then all databases will be synchronized. If both exist, binlog-do-db will take priority. If there are multiple databases, then just fill in multiple records

4. A certain table is not synchronized

If you only want a certain table not to be synchronized, add it to the configuration file

replicate-ignore-table=testdb.test_table即可
Copy after login

5. Keep binary logs for 7 days

Because binlog must be enabled for master-slave replication, and binlog is likely to accumulate over time and overwrite the disk, so you can configure


expire-logs-days = 7
Copy after login

to only retain 7 days of binary logs

6. Limit binlog space Size

relay-log-space-limit = 16G
Copy after login
Limit the maximum binlog space to 16G to prevent the disk from being filled up by logs

The above is the content of some parameter configurations of MySQL-master-slave replication. For more related information, please Follow the PHP Chinese website (www.php.cn)!


source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template