reset master说明
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 (seemysql.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:
RESET MASTER TO 1234;
SHOW BINARY LOGS;
+-------------------+-----------+-----------+
| Log_name | File_size | Encrypted |
+-------------------+-----------+-----------+
| master-bin.001234 | 154 | No |
+-------------------+-----------+-----------+
The effects of RESET MASTER
without the TO
clause differ from those of PURGE BINARY LOGS
in 2 key ways:
-
RESET MASTER
removes 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 MASTER
is not intended to be used while any replication slaves are running. The behavior ofRESET MASTER
when used while slaves are running is undefined (and thus unsupported), whereasPURGE BINARY LOGS
may 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 SLAVE
followed byRESET SLAVE
on the slave, then verify that no unwanted data from the test queries exists on the slave. -
Issue
RESET MASTER
on 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.
原文地址:https://www.cnblogs.com/muzisanshi/p/11898259.html
- 基于MVC理解React+Redux
- JavaScript的IIFE(即时执行方法)
- 从机器学习学python(三) ——数组冒号取值与extend
- 从机器学习学python(四) ——numpy矩阵基础
- 从map函数引发的讨论
- AngularJs中,如何在render完成之后,执行Js脚本
- PHP取得上周一、上周日,下周一
- 代码诊所
- 《编程之美》读书笔记(一)——中国象棋将帅有效位置
- 有趣的Code Poster
- div 自适应高度 自动填充剩余高度
- PHP开发人员常犯的10个MysqL错误
- android AutoCompleteTextView 自定义BaseAdapter
- Scala中的偏函数
- JavaScript 教程
- JavaScript 编辑工具
- JavaScript 与HTML
- JavaScript 与Java
- JavaScript 数据结构
- JavaScript 基本数据类型
- JavaScript 特殊数据类型
- JavaScript 运算符
- JavaScript typeof 运算符
- JavaScript 表达式
- JavaScript 类型转换
- JavaScript 基本语法
- JavaScript 注释
- Javascript 基本处理流程
- Javascript 选择结构
- Javascript if 语句
- Javascript if 语句的嵌套
- Javascript switch 语句
- Javascript 循环结构
- Javascript 循环结构实例
- Javascript 跳转语句
- Javascript 控制语句总结
- Javascript 函数介绍
- Javascript 函数的定义
- Javascript 函数调用
- Javascript 几种特殊的函数
- JavaScript 内置函数简介
- Javascript eval() 函数
- Javascript isFinite() 函数
- Javascript isNaN() 函数
- parseInt() 与 parseFloat()
- escape() 与 unescape()
- Javascript 字符串介绍
- Javascript length属性
- javascript 字符串函数
- Javascript 日期对象简介
- Javascript 日期对象用途
- Date 对象属性和方法
- Javascript 数组是什么
- Javascript 创建数组
- Javascript 数组赋值与取值
- Javascript 数组属性和方法
- Android 定时器实现图片的变换
- Android 软键盘状态并隐藏输入法的实例
- Linux磁盘管理之LVM的使用
- Android编程之菜单Menu的创建方法示例
- Ubuntu下Docker CE的安装
- 基于Android自定义控件实现雷达效果
- Android 中 onSaveInstanceState()使用方法详解
- Linux修改主机名的简单方法
- Android RecycleView使用(CheckBox全选、反选、单选)
- Android自定义滑动解锁控件使用详解
- linux nc命令小结
- Android如何自定义EditText光标与下划线颜色详解
- 基于Centos7 部署Varnish缓存代理服务器
- Android getActivity()为空的问题解决办法
- Android Notification使用方法总结