In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article is about how to configure double master in mysql. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
Double master configuration of mysql
Suppose the ip of the two machines is machine one: 192.168.14.37, machine two: 192.168.14.38, and the server is linux Rhel 5.9.
Execute the create user statement on both servers:
Mysql: > create user 'repl'@'%' identified by' 135246password;-- create user repl password 135246
The server executes:
Mysql: > grant replication client,replication slave on *. * to 'repl'@'192.168.14.38' identified by' 135246 server;-- authorized server one can access server two remotely
Server 2 executes:
Mysql: > grant replication client,replication slave on *. * to 'repl'@'192.168.14.37' identified by' 135246 server;-- license server 2 can access server 1 remotely
Verify (enter the password when prompted):
Connect server two on server one
Mysql-h 192.168.14.38-u repl-p
Connect server one on server two
Mysql-h 192.168.14.37-u repl-p
View mysql:
First: vi / etc/my.cnf
On server 1, add the following:
[client] default-character-set=utf8 [mysql] default-character-set= UTF8 [mysqld] server_id = 1log-bincharacter-set-server=utf8# table name is case-insensitive lower_case_table_names=1#server_id = slave uniquely identify is 2show master status
You can get the MASTER_LOG_FILE and MASTER_LOG_POS information of server one and server two.
Suppose the first server is "localhost-bin.000004" and the second is "localhost-bin.000005" and "667"
Execute on server one:
Stop slave;CHANGE MASTER TO MASTER_HOST = '192.168.14.38, MASTER_USER =' repl', MASTER_PASSWORD = '135246, MASTER_LOG_FILE =' localhost-bin.000004', MASTER_LOG_POS = 120; start slave
Execute on server 2:
Stop slave;CHANGE MASTER TO MASTER_HOST = '192.168.14.37, MASTER_USER =' repl', MASTER_PASSWORD = '135246, MASTER_LOG_FILE =' localhost-bin.000005', MASTER_LOG_POS = 667; start slave
Finally, verify whether the primary primary synchronization is successful:
Add table example to server-mysql
Mysql: > create database example1; use example1;create table example1 (length int)
Finally, check server 2 to see if there is this database, this table, and this piece of data.
View synchronization status: show slave status\ G
If something goes wrong, you can see the error log.
Error leads to synchronization failure refer to mysql slave-skip-errors=all for in-depth understanding
Note: the two servers will not synchronize the data before setting double master.
Thank you for reading! This is the end of the article on "how to configure double master in mysql". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!
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.