In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
0. Prepare for
a. Install database: master and slave mysql databases (mysql server) are all installed:
On version, mysql allows lower version master with higher version slave
Https://dev.mysql.com/doc/refman/5.7/en/replication-compatibility.html
Of course, the same version is the best.
b. Table synchronization and data synchronization: in the slave database (slave), data synchronization and structural synchronization are performed on the tables of the master database (master) (if only specific tables are replicated from master and slave, only specific tables are synchronized, which will be configured later)
Data synchronization and structural synchronization can be easily done with a tool such as navicat.
1. Configure master-slave mode:
You can refer to the article of this great god:
BLOG of itwork
Original works are allowed to be reproduced. When reprinting, please be sure to indicate the original origin of the article, the author's information and this statement in the form of hyperlinks. Otherwise, legal liability will be investigated. Http://369369.blog.51cto.com/319630/790921
two。 A few small details:
How to find the configuration file:
Windows: take 5.7as an example, the configuration file location is: ProgramData\ MySQL\ MySQL Server 5.7\ my.ini
Ubuntu: vi / etc/mysql/my.cnf
How to restart mysql:
Ubuntu: / etc/init.d/mysql restart
Windows: you can find mysql from the Task Manager service, or use cmd: "net stop mysql57"net start mysql57"
If you synchronize only a few table:
In the slave database configuration, using the replicate-do-table configuration, there are several table writes:
Replicate-do-table=db_name.table_name
Replicate-do-table=db_name.table_name
Remember to restart mysql after modification
Please note: db_name and table_name are both db and table names local to the slave database, do not use the name master!
I haven't found a mistake for a long time. The two sides have been connected, but the modification monitoring of the table has been dropped by filter. )
If the name of the master database is different from that of slave:
For example, master is called db123 and slave is called db456.
In the slave database configuration, use the replicate-rewrite-db configuration:
Replicate-rewrite-db=db123- > db456
Just do a simple name rewriting.
Remember to restart mysql after modification.
If you are a VMWare virtual machine as a slave:
Edit another configuration file for slave
Vi / etc/mysql/mysql.conf.d/mysqld.cnf
Comment out the line "bind-address = 127.0.0.1"
How to debug:
a. Check more server Logs (if you are using mysql workbench, click management and find server Logs under the "instance" column), it will prompt a lot of warning and errors, and search for answers based on errors.
B. Mysql official teaching, step by step, some commonly used instructions can find the problem:
Https://dev.mysql.com/doc/refman/5.7/en/replication-problems.html
3. Reference:
This is the configuration item manual for the mysql configuration file:
Https://dev.mysql.com/doc/refman/5.7/en/replication-options-slave.html
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.