Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Analysis on modifying my.cnf and setting of main Library

2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces the modification of my.cnf and main library settings, hoping to supplement and update some knowledge, if there are other issues you need to know, you can continue to follow my updated article in the industry information.

Install ignore, refer to my previous blog. Clone the master library from the library. After cloning the master database, you need to modify the UUID in server-id and / data/mysql/auto.cnf, and modify the name of the pid file.

Modify my.cnf

Master: send binlog-do-db=autoopsslave only: accept replicate-do-db=autoops only

Main library settings:

Configuration file is opened log-bin=mysql-bin is generally opened from the library

Mysql > show variables like 'log_bin%' +-- +-+ | Variable_name | Value | +-- +-+ | log_bin | ON | | mysql > grant replication slave on *. * to 'rep'@'192.168.10.%' identified by' 123456' | Mysql > flush privileges

Main library:

Mysqldump-uroot-p-B autoops-events-- master-data=2-- single-transaction > rep.sql

View req.sql records MASTER_LOG_FILE and MASTER_LOG_POS

22-CHANGE MASTER TO MASTER_LOG_FILE='mysql-bin.000009', MASTER_LOG_POS=1564447

Note: use-single-transaction for innodb and-lock-all-tables for myisam.

Scp rep.sql root@192.168.10.36:/root

From the library:

Mysql-uroot-p123456

< /opt/rep.sql CHANGE MASTER TOMASTER_HOST='192.168.10.29',MASTER_PORT=3306,MASTER_USER='rep',MASTER_PASSWORD='123456',MASTER_LOG_FILE='mysql-bin.000009',MASTER_LOG_POS=1486295; /data/master.info //生成的文件 mysql>

Start slave

Mysql > show slave status\ G

Slave_IO_Running: Yes

Slave_SQL_Running: Yes

Relay-bin.index

/ data/3307/relay-bin.000001

/ data/3307/relay-bin.000002

Relay-log.info / Relay Lo

four hundred and twenty seven

Mysql-bin.000005

five hundred and ninety one

Read the above about the modification of my.cnf and the main library setting analysis, hoping to give you some help in practical application. Due to the limited space in this article, it is inevitable that there will be deficiencies and need to be supplemented. If you need more professional answers, you can contact us on the official website for 24-hour pre-sales and after-sales to help you answer questions at any time.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report