Rechercher dans le manuel MySQL
13.4.1.2 RESET MASTER Syntax
Use this statement with caution to ensure you do not lose any wanted binary log file data and GTID execution history.
RESET MASTER requires the
RELOAD privilege.
For a server where binary logging is enabled
(log_bin is
ON), RESET MASTER deletes
all existing binary log files and resets the binary log index
file, resetting the server to its state before binary logging
was started. A new empty binary log file is created so that
binary logging can be restarted.
For a server where GTIDs are in use
(gtid_mode is
ON), issuing RESET MASTER
resets the GTID execution history. The value of the
gtid_purged system variable is
set to an empty string (''), the global value
(but not the session value) of the
gtid_executed system variable
is set to an empty string, and the
mysql.gtid_executed table is cleared (see
mysql.gtid_executed Table). If the
GTID-enabled server has binary logging enabled,
RESET MASTER also resets the
binary log as described above. Note that
RESET MASTER is the method to
reset the GTID execution history even if the GTID-enabled server
is a replication slave where binary logging is disabled;
RESET SLAVE has no effect on the
GTID execution history. For more information on resetting the
GTID execution history, see
Resetting the GTID Execution History.
Issuing RESET MASTER without the optional
TO clause deletes all binary log files listed
in the index file, resets the binary log index file to be empty,
and creates a new binary log file starting at
1. Use the optional TO
clause to start the binary log file index from a number other
than 1 after the reset.
Using RESET MASTER with the
TO clause to specify a binary log file index
number to start from simplifies failover by providing a single
statement alternative to the FLUSH BINARY
LOGS and
PURGE BINARY
LOGS TO statements. Check that you are using a
reasonable value for the index number. If you enter an incorrect
value, you can correct this by issuing another
RESET MASTER statement with or
without the TO clause. If you do not correct
a value that is out of range, the server cannot be restarted.
The following example demonstrates TO clause
usage:
- +-------------------+-----------+-----------+
- | Log_name | File_size | Encrypted |
- +-------------------+-----------+-----------+
- +-------------------+-----------+-----------+
The effects of RESET MASTER
without the TO clause differ from those of
PURGE BINARY LOGS in 2 key
ways:
RESET MASTERremoves all binary log files that are listed in the index file, leaving only a single, empty binary log file with a numeric suffix of.000001, whereas the numbering is not reset byPURGE BINARY LOGS.RESET MASTERis not intended to be used while any replication slaves are running. The behavior ofRESET MASTERwhen used while slaves are running is undefined (and thus unsupported), whereasPURGE BINARY LOGSmay be safely used while replication slaves are running.
RESET MASTER without the
TO clause can prove useful when you first set
up a master and slave, so that you can verify the setup as
follows:
Start the master and slave, and start replication (see Section 17.1.2, “Setting Up Binary Log File Position Based Replication”).
Execute a few test queries on the master.
Check that the queries were replicated to the slave.
When replication is running correctly, issue
STOP SLAVEfollowed byRESET SLAVEon the slave, then verify that no unwanted data from the test queries exists on the slave.Issue
RESET MASTERon the master to clean up the test queries.
After verifying the setup, resetting the master and slave and ensuring that no unwanted data or binary log files generated by testing remain on the master or slave, you can start the slave and begin replicating.
Nederlandse vertaling
U hebt gevraagd om deze site in het Nederlands te bezoeken. Voor nu wordt alleen de interface vertaald, maar nog niet alle inhoud.Als je me wilt helpen met vertalingen, is je bijdrage welkom. Het enige dat u hoeft te doen, is u op de site registreren en mij een bericht sturen waarin u wordt gevraagd om u toe te voegen aan de groep vertalers, zodat u de gewenste pagina's kunt vertalen. Een link onderaan elke vertaalde pagina geeft aan dat u de vertaler bent en heeft een link naar uw profiel.
Bij voorbaat dank.
Document heeft de 26/06/2006 gemaakt, de laatste keer de 26/10/2018 gewijzigd
Bron van het afgedrukte document:https://www.gaudry.be/nl/mysql-rf-reset-master.html
De infobrol is een persoonlijke site waarvan de inhoud uitsluitend mijn verantwoordelijkheid is. De tekst is beschikbaar onder CreativeCommons-licentie (BY-NC-SA). Meer info op de gebruiksvoorwaarden en de auteur.
Referenties
Deze verwijzingen en links verwijzen naar documenten die geraadpleegd zijn tijdens het schrijven van deze pagina, of die aanvullende informatie kunnen geven, maar de auteurs van deze bronnen kunnen niet verantwoordelijk worden gehouden voor de inhoud van deze pagina.
De auteur van deze site is als enige verantwoordelijk voor de manier waarop de verschillende concepten, en de vrijheden die met de referentiewerken worden genomen, hier worden gepresenteerd. Vergeet niet dat u meerdere broninformatie moet doorgeven om het risico op fouten te verkleinen.