In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
The following content mainly brings you two MySQL configuration master-slave databases. The knowledge mentioned here, which is slightly different from books, is summarized by professional and technical personnel in the process of contact with users, and has a certain value of experience sharing. I hope to bring help to the majority of readers.
Prepare: two MySQL databases
I. configure the master database
1. Add users
Mysql > grant replication slave on *. *\
-> to
-> slaveuser@ "192.168.4.12" authorized user / ip
-> identified by "111111"; password
2. Start the binlog log
[mysqld]
Server_id=1
Log-bin=master1
Binlog_format= "mixed"
3. Restart the database service
[root@mysql-1 ~] # systemctl restart mysqld
4 View log information
Mysql > show master status
Second, configure the slave database
1. Verify the authorized users provided by the main library
[root@mysql-2] # mysql- h292.168.4.11-uslaveuser-p111111
2. Modify configuration file to specify configuration file
[mysqld]
Server_id=2
Log-bin=master2
3. Specify the main database information
Mysql > change master to master_host= "192.168.4.11"
Master_user= "slaveuser"
Master_password= "111111"
Master_log_file= "master1.000001"
Master_log_pos=154
4. Start the service
Mysql > start slave
Shut down the service
Mysql > stop slave
Delete a service
Mysql > reset slave
5. View
Mysql > show slave status\ G
Slave_IO_Running: the Yes IO thread is already running
Slave_SQL_Running: the Yes SQL thread is already running
From multiple files in the database directory
[root@mysql-2 ~] # cat / var/lib/mysql/*
Master.info connection information of primary CVM
Relay-log.info interrupt log information
Hostname-relay-bin.xxxxxx interrupt Lo
Bogon-realy-bin.index interrupt log index file
Third, test master-slave synchronization configuration
1. Create a library on the main server
Mysql > create database ctoll
2. You can also view it from the server.
[one master, multiple followers]
Mysql > grant replication slave on *. *
To
Slaveuser@ "%"%-> multiple hosts
Identified by "111111"
For the above two MySQL configuration master-slave databases, if you need to know more, you can continue to pay attention to the innovation of our industry. If you need professional solutions, you can contact the pre-sales and after-sales on the official website. I hope this article can bring you some knowledge updates.
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.