MySQL master master, master Slave, from config file

Source: Internet
Author: User

Master configuration file:

[Email protected] ~]# MORE/ETC/MY.CNF

[Mysqld]

Datadir=/var/lib/mysql

Socket=/var/lib/mysql/mysql.sock

User=mysql

# Disabling Symbolic-links is recommended to prevent assorted security risks

Symbolic-links=0

?

Log-bin=mysqlbin

Server-id = 1 #主机标示, integer

Read-only =0 #主机, read and write all can

Binlog-do-db =testdb01 #需要备份数据, more than one write multiple lines

Binlog-ignore-db =mysql #不需要备份的数据库, more than one write multiple lines

?

[Mysqld_safe]

Log-error=/var/log/mysqld.log

Pid-file=/var/run/mysqld/mysqld.pid

?

?

From the configuration file:

[Email protected] ~]# MORE/ETC/MY.CNF

[Mysqld]

Datadir=/var/lib/mysql

Socket=/var/lib/mysql/mysql.sock

User=mysql

# Disabling Symbolic-links is recommended to prevent assorted security risks

Symbolic-links=0

?

Log-bin=mysqlbin

?

Server-id = 2

Log_slave_updates=1

Master-host = 10.0.0.8

Master-user = Mysqlbak

Master-pass = abc123!

Master-port = 3306

Master-connect-retry=60 #如果从服务器发现主服务器断掉, Reconnect time > difference (seconds)

Replicate-do-db =TESTDB01 #只复制某个库

Replicate-ignore-db=mysql #不复制某个库

?

?

?

?

?

?

[Mysqld_safe]

Log-error=/var/log/mysqld.log

Pid-file=/var/run/mysqld/mysqld.pid

?

From the configuration file:

[Email protected] ~]$ MORE/ETC/MY.CNF

[Mysqld]

Datadir=/var/lib/mysql

Socket=/var/lib/mysql/mysql.sock

User=mysql

# Disabling Symbolic-links is recommended to prevent assorted security risks

Symbolic-links=0

?

Log-bin=mysqlbin

?

Server-id = 3

Master-host = 10.0.0.9

Master-user = mysqlbak02

Master-pass = abc123!

Master-port = 3306

Master-connect-retry=60 #如果从服务器发现主服务器断掉, Reconnect time > difference (seconds)

Replicate-do-db =TESTDB01 #只复制某个库

Replicate-ignore-db=mysql #不复制某个库

?

?

?

[Mysqld_safe]

Log-error=/var/log/mysqld.log

Pid-file=/var/run/mysqld/mysqld.pid

MySQL master master, master Slave, from config file

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.