MySQL 5.6主从复制第二部分[恢复某一台从服务器]
MySQL 5.6主从复制第二部分[恢复某一台从服务器],本来第二部分是想测试主服务器挂掉,提升从服务器的情况,可是出了点点意外,改
本来第二部分是想测试主服务器挂掉,提升从服务器的情况,可是出了点点意外,改为测试某一台从服务器挂掉的时候,如何恢复。
主服务器挂掉的情况放到第三部分吧。
继续用mysql::sandbox来测试。
主服务器(别名black)(server-id:1)安装在 /home/modify/sandboxes/msb_5_6_10/ 使用5610端口。
从服务器(别名blue)(server-id:2)安装在 /home/modify/sandboxes/msb_5_6_10_a/ 使用5611端口。
从服务器(别名green)(server-id:3)安装在 /home/modify/sandboxes/msb_5_6_10_b/ 使用5612端口。
按照前一篇文章介绍的方法设置好一主二从的复制。
相关阅读:
MySQL 5.6主从复制第一部分[简介及配置]
MySQL 5.6主从复制第二部分[恢复某一台从服务器]
MySQL 5.6主从复制第三部分[把从服务器提升为主服务器]
MySQL 5.6主从复制第四部分[一些被忽视的操作细节]
MySQL 主从复制事件校验 MySQL Replication Event Checksum
使用pt-table-checksum检查主从复制是否正常
----------------------------------------分割线----------------------------------------
假设从服务器blue由于dba误操作,直接更改了数据库里面的数据,,
blue:
mysql testt; Query OKaffected (0.01 sec) mysql test) > mysql testslave STATUS \G Slave_IO_State: Waiting FOR master TO send event Master_Host: 127.0.0.1 Master_User: repl_user Master_Port: 5610 Connect_Retry: 60 Master_Log_File: black-bin.000002 Read_Master_Log_Pos: 2048 Relay_Log_File: mysql_sandbox5611-relay-bin.000004 Relay_Log_Pos: 2218 Relay_Master_Log_File: black-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: 2048 Relay_Log_Space: 2481 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: 05b47d41-7b10-11e2-9fff-00241db92e69 Master_Info_File: mysql.slave_master_info SQL_Delay: 0 SQL_Remaining_Delay: NULL Slave_SQL_Running_State: Slave has it Master_Retry_Count: 86400 Master_Bind: Last_IO_Error_Timestamp: Last_SQL_Error_Timestamp: Master_SSL_Crl: Master_SSL_Crlpath: Retrieved_Gtid_Set: 05b47d41Executed_Gtid_Set: 05b47d414f65e570-7b32-11e2-a0de-00241db92e69:1 Auto_Position: sec) ##可以停止复制了。 mysql test) > stop slave; Query OKaffected (1.36 sec)
Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Big data structure processing skills: Chunking: Break down the data set and process it in chunks to reduce memory consumption. Generator: Generate data items one by one without loading the entire data set, suitable for unlimited data sets. Streaming: Read files or query results line by line, suitable for large files or remote data. External storage: For very large data sets, store the data in a database or NoSQL.

Backing up and restoring a MySQL database in PHP can be achieved by following these steps: Back up the database: Use the mysqldump command to dump the database into a SQL file. Restore database: Use the mysql command to restore the database from SQL files.

MySQL query performance can be optimized by building indexes that reduce lookup time from linear complexity to logarithmic complexity. Use PreparedStatements to prevent SQL injection and improve query performance. Limit query results and reduce the amount of data processed by the server. Optimize join queries, including using appropriate join types, creating indexes, and considering using subqueries. Analyze queries to identify bottlenecks; use caching to reduce database load; optimize PHP code to minimize overhead.

How to insert data into MySQL table? Connect to the database: Use mysqli to establish a connection to the database. Prepare the SQL query: Write an INSERT statement to specify the columns and values to be inserted. Execute query: Use the query() method to execute the insertion query. If successful, a confirmation message will be output.

Creating a MySQL table using PHP requires the following steps: Connect to the database. Create the database if it does not exist. Select a database. Create table. Execute the query. Close the connection.

To use MySQL stored procedures in PHP: Use PDO or the MySQLi extension to connect to a MySQL database. Prepare the statement to call the stored procedure. Execute the stored procedure. Process the result set (if the stored procedure returns results). Close the database connection.

One of the major changes introduced in MySQL 8.4 (the latest LTS release as of 2024) is that the "MySQL Native Password" plugin is no longer enabled by default. Further, MySQL 9.0 removes this plugin completely. This change affects PHP and other app

Oracle database and MySQL are both databases based on the relational model, but Oracle is superior in terms of compatibility, scalability, data types and security; while MySQL focuses on speed and flexibility and is more suitable for small to medium-sized data sets. . ① Oracle provides a wide range of data types, ② provides advanced security features, ③ is suitable for enterprise-level applications; ① MySQL supports NoSQL data types, ② has fewer security measures, and ③ is suitable for small to medium-sized applications.
