In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-07 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Environmental preparation:
Deploy one master, one slave and two servers to achieve master-slave replication. Binlog should be enabled for the master library, and the Server-id for the master library and slave library should be different.
Main library:
[root@db01 ~] # hostname-I10.0.0.51 172.16.1.51 [root@db01 ~] # egrep "log_bin | server-id" / etc/my.cnf server-id = 1 # master library Server-idlog_bin = mysql-bin # enable binlog slave library: [root@db02 ~] # hostname-I10.0.52 172.16.1.52 [root@db02 ~] # egrep "server-id" / etc/ My.cnf server-id = 2 # Server-id of slave library
Main library operation:
1. Create a user for master-slave connection
Mysql > grant replication slave on *. * to 'rep'@'172.16.1.%' identified by' 123456 is not MySQL > flush privileges;mysql > select user,host from mysql.user
2. Lock the table and prohibit data writing
Mysql > flush table with read lock
3. Open a new window to export the main database data.
[root@db01] # mysqldump-A-B-master-data=2 > / opt/3306.sql
4. Unlock and open the user write function
Mysql > unlock tables
5. Copy the backup data of the master database to the slave database
[root@db01 ~] # scp / opt/3306.sql 172.16.1.52:/opt/
From the library operation:
1. Import the complete equipment of the master library to the slave library.
[root@db02 ~] # mysql start slave;mysql > show slave status\ G
The following status message appears, indicating that the master-slave replication configuration is successful
Slave_IO_Running: YesSlave_SQL_Running: YesSeconds_Behind_Master: 0
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.