In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-09 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
Master Server:
ip:192.168.5.112
sudo vi /etc/mysql/my.cnf
[mysqld]server-id=1log-bin=mysql-bin#Be sure to log off the following sentence, otherwise you cannot log in remotely to the server #bind-address = 127.0.0.1 #Here you can set which libraries need to be backed up and which do not, I did not set #binlog_do_db here = include_database_name #binlog_ignore_db = include_database_name
After the modification is complete, run mysql -uroot -proot
New Query User:
mysql> CREATE USER 'repl'@'#' IDENTIFIED BY '12345678';mysql> GRANT REPLICATION SLAVE ON *.* TO 'repl'@'#';
After that, restart the server, restart, log in to mysql again
mysql> show master status;
+------------------+----------+--------------+------------------+-------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |
+------------------+----------+--------------+------------------+-------------------+
| mysql-bin.000001 | 411 | | | |
+------------------+----------+--------------+------------------+-------------------+
1 row in set (0.00 sec)
This appears, indicating that master has been set up, and then set slave
slave from server:
ip:192.168.5.113
sudo vi /etc/mysql/my.cnf
[mysqld] server-id=2
Log in to mysql
mysql> CHANGE MASTER TO -> MASTER_HOST='192.168.5.112', -> MASTER_USER='repl', -> MASTER_PASSWORD='12345678', -> MASTER_LOG_FILE='mysql-bin.000001', -> MASTER_LOG_POS=411;
and restart the server.
After that, log in to MySQL.
mysql > show slave status;
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 192.168.5.112
Master_User: repl
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mysql-bin.000002
Read_Master_Log_Pos: 1196
Relay_Log_File: mysqld-relay-bin.000004
Relay_Log_Pos: 1359
Relay_Master_Log_File: mysql-bin.000002
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
Replicate_Do_DB:
Replicate_Ignore_DB:
Replicate_Do_Table:
Replicate_Ignore_Table:
Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
Last_Errno: 0
Last_Error:
Skip_Counter: 0
Exec_Master_Log_Pos: 1196
Relay_Log_Space: 1696
Until_Condition: None
Until_Log_File:
Until_Log_Pos: 0
Master_SSL_Allowed: No
Master_SSL_CA_File:
Master_SSL_CA_Path:
Master_SSL_Cert:
Master_SSL_Cipher:
Master_SSL_Key:
Seconds_Behind_Master: 0
Master_SSL_Verify_Server_Cert: No
Last_IO_Errno: 0
Last_IO_Error:
Last_SQL_Errno: 0
Last_SQL_Error:
Replicate_Ignore_Server_Ids:
Master_Server_Id: 1
Master_UUID: f4c24d5d-5622-11e7-89df-000c295755b8
Master_Info_File: /var/lib/mysql/master.info
SQL_Delay: 0
SQL_Remaining_Delay: NULL
Slave_SQL_Running_State: Slave has read all relay log; waiting for the slave I/O thread to update it
Master_Retry_Count: 86400
Master_Bind:
Last_IO_Error_Timestamp:
Last_SQL_Error_Timestamp:
Master_SSL_Crl:
Master_SSL_Crlpath:
Retrieved_Gtid_Set:
Executed_Gtid_Set:
Auto_Position: 0
1 row in set (0.00 sec)
ERROR:
No query specified
When the red box shows yes, it means that the master-slave configuration has been successfully configured. Then create new data in mysql on the master server and query mysql on the slave server to see if it succeeds.
Remarks:
If the master server already exists, export the corresponding database as sql file.
After that, create a new database for the master server on the slave, and then import the sql file on the master server into the corresponding database to synchronize the previous data.
After that, the master-slave replication process begins.
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.