In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article is about how to build a high-availability MySQL-HA in keepalived. The editor thinks it is very practical, so I share it with you to learn. I hope you can get something after reading this article.
The environment topology is as follows
MySQL-VIP:192.168.1.200 MySQL-master1:192.168.1.201 MySQL-master2:192.168.1.202 OS version: CentOS 5.4 MySQL version: 5.0.89 Keepalived version: 1.1.20
I. MySQL master-master configuration
1. Modify MySQL configuration file
If you want to enable the binlog log feature for both MySQL, add the log-bin=MySQL-bin option in the [MySQLd] section of the MySQL configuration file.
The server-ID of two MySQL cannot be the same. By default, the serverID of both MySQL is 1. You need to modify one of them to 2.
2. Set 192.168.1.201 as the primary server of 192.168.1.202
Create a new authorized user on 192.168.1.201
MySQL > grant replication slave on *. * to replication@% identified by replication; Query OK, 0 rows affected (0.00 sec) MySQL > show master status +-+ | File | Position | Binlog_Do_DB | Binlog_Ignore_DB | +- -- + | MySQL-bin.000003 | 374 | +- -+ 1 row in set (0.00 sec)
Set 192.168.1.201 as your primary server on 192.168.1.202
MySQL > change master to master_host=192.168.1.201,master_user=replication,master_password=replication,master_log_file=MySQL-bin.000003,master_log_pos=374
Query OK, 0 rows affected (0.05 sec)
MySQL > start slave
Query OK, 0 rows affected (0.00 sec)
MySQL > show slave statusG
* * 1. Row *
Slave_IO_State: Waiting for master to send event
Master_Host: 192.168.1.201
Master_User: replication
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: MySQL-bin.000003
Read_Master_Log_Pos: 374
Relay_Log_File: MySQL-master2-relay-bin.000002
Relay_Log_Pos: 235
Relay_Master_Log_File: MySQL-bin.000003
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
Replicate_Do_DB:
Replicate_Ignore_DB:
Replicate_Do_Table:
Replicate_Ignore_Table:
Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
Last_Errno: 0
Last_Error:
Skip_Counter: 0
Exec_Master_Log_Pos: 374
& nbsp
The above is how to build a high-availability MySQL-HA in keepalived. The editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.
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.