In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly explains "how to use MySQL built-in replication function". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how to use the built-in copy function of MySQL.
The MySQL internal replication function is established between two or more servers and is achieved by setting a master-slave relationship between them. One of them is the master server and the other is the slave server. This section discusses in detail how to configure two servers, one as a master server and the other as a slave server. And describe the process of switching between them. This section is a configuration setup process on version 3.23.25 of MySQL, and is also tested on this version. MySQL developers recommend that it is best to use the latest version, and that both master and slave servers use the same version. At the same time, MySQL 3.23 is still a beta beta, and this version may not be backward compatible.
Configure the primary server
We will specify two servers. A (IP is 192.168.0.1) serves as the primary server (referred to as host for short). B (IP is 192.168.0.2) acts as a slave server (referred to as a slave for short).
1. Set up an account for backup
The implementation process of the replication function of MySQL is as follows: the slave (B) connects with the host (A), then reads the host's binary update log, and then merges the changes into its own. The slave needs a user account to connect with the host, so create an account on the host and only give it FILE permission, as follows:
> GRANT FILE ON *. * TO replicate@192.168.0.2 IDENTIFIED BY password
In order for the slave to connect to the host, run FLUSH PRIVILEGES on the host:
Mysql > FLUSH PRIVILEGES
But don't worry, because we will stop the server in the following steps.
2. Modify the options file
Now we need a snapshot of the host database and configure the host to allow binary update logs to be generated. Edit the my.cnf file first to allow binary updates to the log, so add a line under the [mysqld] section: log-bin. The next time the server starts, the host generates a binary update log (named:-bin.).
[mysqld]
Log-bin
To make the binary update log valid, close the MySQL service program, then put all the databases on the host into another directory, and then restart mysqld.
At this point, I believe you have a deeper understanding of "how to use MySQL built-in replication function". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
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.