In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly explains the "methods and steps of Mysql master-slave configuration". The content of the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "the methods and steps of Mysql master-slave configuration".
Master:192.168.0.17
Slave:192.168.0.18
1. Masterside
(1) modify the configuration parameters of Masterside
> > sudo vi / etc/my.cnf
Server-id = 17 # master ID number
Log-bin=/data/logbin/mysql-bin # Log path and File name
# binlog-do-db = db_test # synchronization db_test. If you close it here, all other libraries will be synchronized except what is not allowed.
# binlog-ignore-db = mysql # out of sync with mysql libraries, the following is the same as above
# binlog-ignore-db = test
# binlog-ignore-db = information_schema
> sudo service mysqld restart
(2) create a synchronization account and synchronize the database that has been created
> mysql-u root-p
Mysql > grant replication slave on *. * to rsync@'192.168.0.18' identified by '123456'
Mysql > flush privileges
Mysql > flush tables with read lock
Mysql > show master status
The values of file and position are mainly recorded here, which are used by the Slave side. As follows
File | Position |
+-
| | mysql-bin.000001 | 154 |
# Open another window
Tar-czf db_test.tgz / data/db_mysql/db_test
Scp db_test.tgz root@192.168.0.18:/data/db_mysql/
# Log in to another machine to decompress and ensure that the directory is the same as the configured tar-xzvf db_test.tgz
Mysql > unlock tables
2. Slave:
(1) modify the slave configuration parameters
> > sudo vi / etc/my.cnf
Server-id = 18 # ID number of server
Log-bin=/data/logbin/mysql-bin # Log path and File name
Relay-log-index=slave-relay-bin.index
Relay-log=slave-relay-bin
> sudo service mysqld restart
> mysql-u root-p
(2) Connect to Master
Change master to master_host='192.168.0.17', / / Master server Ip
Master_port=3306
Master_user='rsync'
Master_password='123456'
Logs generated by master_log_file='master-bin.000001',//Master server
Master_log_pos=154
(3) start Slave
Start slave
Thank you for reading, the above is the content of "the methods and steps of Mysql master-slave configuration". After the study of this article, I believe you have a deeper understanding of the methods and steps of Mysql master-slave configuration, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.