In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly introduces what are the problems with the master-slave configuration of MySQL database. It is very detailed and has certain reference value. Friends who are interested must finish reading it.
MySQL database is a kind of relational database management system whose function is not very powerful. although the function is not perfect, MySQL database has won the favor of the majority of users with the advantages of high speed, good adaptability and high reliability. depending on the performance of MySQL database, we should start from the configuration of MySQL database.
I.
Server-id can be set on its own, but try not to set it to 1 and cannot repeat it with the slave server.
Two hosts are required to act as the master server and the slave server.
Master server IP:192.168.1.1
IP:192.168.1.2 from the server
First, configure the mysql service on the two services.
On the primary server:
# vim/etc/my.cnf
Modify or add the following entries
Log-bin=master-bin
Log-bin-index=master-bin.index
Server-id=11
Note: server-id can be set by itself, but try not to set it to 1 and cannot repeat it with the slave server.
Restart the service
# servicemysqldrestart
Add REPLICATION (copy) account: repl
# mysql
> GRANTREPLICATIONSLAVE
> REPLICATIONCLIENTON*.*
> TOrepl@'192.168.1.%'
> IDENTIFIEDBY'redhat'
Note: *. * indicates any table in any database. '192.168.1%' means that only the master height of the 192.168.1.0 network segment is allowed to access the database
> FLUSHPRIVILEGES
>\ Q
II.
On the slave side:
# vim/etc/my.cnf
Modify or add the following entries:
Relay-log=relay-log-bin
Relay-log-index=slave-relay-bin.index
Server-id=22
Note: the server-id cannot be the same as the primary server
Restart the mysql service
# servicemysqldrestart
# mysql
> CHANGEMASTERTO
IP of the MASTER_HOST='192.168.1.1',## master server
> MASTER_PORT=3306,##3306 cannot be in quotation marks. This trip is optional.
> MASTER_USER='repl'
> MASTER_PASSWORD='redaht'
>
> STARTSLAVE
At this point, the master-slave mysql server configuration is complete!
Test:
Make changes to the database on the primary server, such as:
# mysql
> CREATDATABASEmydb
Before viewing from the server side:
# mysql
> SHOWDATABASES
There will also be an identical database called mydb!
These are all the contents of this article entitled "what are the problems with the master-slave configuration of MySQL database?" Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to 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.