server-id
CHANGE MASTER TO
MyISAM
MyISAM
InnoDB
SUPER
log_bin
--log-bin
--server-id
server_id
InnoDB
innodb_flush_log_at_trx_commit=1
sync_binlog=1
skip-networking
[mysqld]
[mysqld]server-id=2
server-id
A -> B -> C
A
B
B
A
C
--log-slave-updates
--log-slave-updates
--skip-log-bin
--skip-log-slave-updates
MASTER_USER
REPLICATION
SLAVE
mysql.slave_master_info
CREATE
USER
GRANT
REPLICATION SLAVE
example.com
MySQL的> CREATE USER 'repl'@'%.example.com' IDENTIFIED BY '
password
';MySQL的> GRANT REPLICATION SLAVE ON *.* TO 'repl'@'%.example.com';
caching_sha2_password
caching_sha2_password
MASTER_USER
FLUSH TABLES WITH
READ LOCK
COMMIT
InnoDB
FLUSH
TABLES WITH READ LOCK
MySQL的> FLUSH TABLES WITH READ LOCK;
FLUSH TABLES
SHOW MASTER STATUS
MySQL SHOW MASTER STATUS;
------------------ ---------- -------------- ------------------ |文件|位置| binlog_do_db | binlog_ignore_db | ------------------ ---------- -------------- ------------------ | mysql-bin.000003 | 73 |测试|手册,MySQL | ------------------ ---------- -------------- ------------------
File
mysql-bin.000003
SHOW MASTER
STATUS
''
dbdump.db
--master-data
CHANGE MASTER
TO
内核> mysqldump --all-databases --master-data > dbdump.db
--master-data
--all-databases
--ignore-table
--databases
InnoDB
ft_stopword_file
ft_min_word_len
ft_max_word_len
InnoDB
MyISAM
InnoDB
innodb_file_per_table
mysql
master.info
InnoDB
InnoDB
shell> mysqladmin shutdown
shell>tar cf
shell>/tmp/db.tar
./data
zip -r
shell>/tmp/db.zip
./data
rsync --recursive
./data
/tmp/dbdata
InnoDB
shell>tar cf
shell>/tmp/db.tar
./data
zip -r
shell>/tmp/db.zip
./data
rsync --recursive
./data
/tmp/dbdata
mysql> UNLOCK TABLES;
mysql> UNLOCK TABLES;
CHANGE MASTER TO
shell> mysql -h master < fulldb.dump
--skip-slave-start
shell> mysql < fulldb.dump
shell> tar xvf dbdump.tar
--skip-slave-start
CHANGE MASTER TO
mysql> START SLAVE;
slave_master_info
mysql
--master-info-repository=FILE
--relay-log-info-repository=FILE
relay-log.info
CHANGE MASTER
TO
my.cnf
mysql>CHANGE MASTER TO
->MASTER_HOST='
->master_host_name
',MASTER_USER='
->replication_user_name
',MASTER_PASSWORD='
->replication_password
',MASTER_LOG_FILE='
->recorded_log_file_name
',MASTER_LOG_POS=
recorded_log_position
;
CHANGE MASTER TO
MASTER_USER
MASTER_PUBLIC_KEY_PATH
CHANGE MASTER TO
server-id
shell> mysqladmin shutdown
WinZip
071118 16:44:10 [Warning] Neither --relay-log nor --relay-log-index were used; so replication may break when this MySQL server acts as a slave and has his hostname changed!! Please use '--relay-log=new_slave_hostname
-relay-bin' to avoid this problem. 071118 16:44:10 [ERROR] Failed to open the relay log './old_slave_hostname
-relay-bin.003525' (relay_log_pos 22940879) 071118 16:44:10 [ERROR] Could not find target log during relay log initialization 071118 16:44:10 [ERROR] Failed to initialize the master info structure
--relay-log
--relay-log-index
--relay-log
existing_slave_hostname
--relay-log-index
existing_slave_hostname
STOP SLAVE
STOP SLAVE
server-id
mysql.gtid_executed
:
GTID =source_id
: transaction_id
source_id
server_uuid
transaction_id
transaction_id
transaction_id
0
3E11FA47-71CA-11E1-9E33-C80AA9429562:23
SHOW SLAVE STATUS
--base64-output=DECODE-ROWS
SHOW BINLOG
EVENTS
SHOW MASTER STATUS
3E11FA47-71CA-11E1-9E33-C80AA9429562:1-5
server_uuid
START SLAVE
SQL_AFTER_GTIDS
gtid_set
:uuid_set
[,uuid_set
] ... | ''uuid_set
:uuid
:interval
[:interval
]...uuid
:hhhhhhhh
-hhhh
-hhhh
-hhhh
-hhhhhhhhhhhh
h
: [0-9|A-F]interval
:n
[-n
] (n
>= 1)
gtid_executed
gtid_purged
GTID_SUBSET()
GTID_SUBTRACT()
gtid_executed
mysql.gtid_executed
CREATE TABLE
创建表gtid_executed(source_uuid char(36)不为空,interval_start bigint(20)不为空,interval_end bigint(20)不为空,主键(source_uuid,interval_start))
mysql.gtid_executed
mysql.gtid_executed
gtid_mode
ON_PERMISSIVE
log_bin
log_slave_updates
log_bin
mysql.gtid_executed
mysql.gtid_executed
gtid_executed
mysql.gtid_executed
gtid_executed
mysql.gtid_executed
RESET MASTER
mysql.gtid_executed
MySQL的> SELECT * FROM mysql.gtid_executed;
-------------------------------------- ---------------- -------------- | source_uuid | interval_start | interval_end | | -------------------------------------- ---------------- -------------- | | 3e11fa47-71ca-11e1-9e33-c80aa9429562 | 37 | 37 | | 3e11fa47-71ca-11e1-9e33-c80aa9429562 | 38 | 38 | | 3e11fa47-71ca-11e1-9e33-c80aa9429562 | 39 | 39 | | 3e11fa47-71ca-11e1-9e33-c80aa9429562 | 40 | 40 | | 3e11fa47-71ca-11e1-9e33-c80aa9429562 | 41 | 41 | | 3e11fa47-71ca-11e1-9e33-c80aa9429562 | 42 | 42 | | 3e11fa47-71ca-11e1-9e33-c80aa9429562 | 43 | 43 |…
+--------------------------------------+----------------+--------------+ | source_uuid | interval_start | interval_end | |--------------------------------------+----------------+--------------| | 3E11FA47-71CA-11E1-9E33-C80AA9429562 | 37 | 43 | ...
mysql.gtid_executed
gtid_executed_compression_period
gtid_executed_compression_period
gtid_executed_compression_period
mysql.gtid_executed
mysql.gtid_executed
SHOW
PROCESSLIST
threads
MySQL的> SELECT * FROM performance_schema.threads WHERE NAME LIKE '%gtid%'\G
*************************** 1。行*************************** thread_id:26名称:螺纹/ SQL / compress_gtid_table类型:前景processlist_id:1 processlist_user:空processlist_host:空processlist_db:nullprocesslist_command:守护processlist_time:1509 processlist_state:悬浮processlist_info:空parent_thread_id:1作用:空仪表:是的历史:是的connection_type:空thread_os_id:18677
thread/sql/compress_gtid_table
gtid_executed_compression_period
gtid_executed_compression_period
Gtid_log_event
gtid_executed
gtid_executed
gtid_next
gtid_next
gtid_owned
gtid_next
gtid_next
Gtid_log_event
mysql.gtid_executed
gtid_executed
mysql.gtid_executed
gtid_executed
gtid_executed
Gtid_log_event
mysql.gtid_executed
gtid_executed
slave_parallel_workers > 0
slave_preserve_commit_order=1
gtid_executed
STOP SLAVE
KILL
@@session.gtid_next
gtid_purged
SET @@global.gtid_purged
gtid_purged
Previous_gtids_log_event
Previous_gtids_log_event
gtid_purged
MASTER_LOG_FILE
CHANGE MASTER TO
MASTER_AUTO_POSITION
MASTER_LOG_FILE
GTID_MODE=ON
OFF_PERMISSIVE
GTID_MODE=ON
gtid_executed
replication_connection_status
gtid_purged
MASTER_AUTO_POSITION
binlog_expire_logs_seconds
server_uuid
server_id
root
SUPER
shutdown
SHUTDOWN
read_only
mysql> SET @@global.read_only = ON;
username
内核> mysqladmin -u
username
-p shutdown
gtid_mode
enforce_gtid_consistency
gtid_mode=ONenforce-gtid-consistency=true
--skip-slave-start
--skip-log-bin
--skip-log-slave-updates
CHANGE MASTER TO
mysql>CHANGE MASTER TO
>MASTER_HOST =
>host
,MASTER_PORT =
>port
,MASTER_USER =
>user
,MASTER_PASSWORD =
>password
,MASTER_AUTO_POSITION = 1;
MASTER_LOG_FILE
MASTER_AUTO_POSITION
CHANGE MASTER
TO
FLUSH
LOGS
mysql> START SLAVE;
mysql> SET @@global.read_only = OFF;
--master-data
CHANGE MASTER TO
--set-gtid-purged
ON
InnoDB
gtid_mode=ON
@@global.gtid_purged
--read-from-remote-server
--read-from-remote-master
--read-from-remote-server
--raw
>
file
--raw
shell> mysqlbinlog copied-binlog.000001 copied-binlog.000002 | mysql -u root -p
gtid_executed
gtid_executed
SET GTID_NEXT='aaa-bbb-ccc-ddd:N';BEGIN;COMMIT;SET GTID_NEXT='AUTOMATIC';
N
刷新日志;清除“master-bin.00000二进制日志 N
';
FLUSH
LOGS
PURGE BINARY LOGS
gtid_purged
gtid_executed
PURGE BINARY LOGS
gtid_purged
gtid_executed
COMMIT
/*!*/;
MySQL的> DELIMITER ;
mysql>SET GTID_NEXT=automatic;
mysql>RESET SLAVE;
mysql>START SLAVE;
MyISAM
InnoDB
CREATE
TABLE ... SELECT
ALTER TABLE ... ADD
ER_BINLOG_UNSAFE_SYSTEM_FUNCTION
gtid_mode=OFF
enforce_gtid_consistency=WARN
gtid_mode=OFF
enforce_gtid_consistency=ON
ER_GTID_UNSAFE_ALTER_ADD_COL_WITH_DEFAULT_EXPRESSION
gtid_mode=ON_PERMISSIVE
gtid_next=AUTOMATIC
ER_GTID_UNSAFE_ALTER_ADD_COL_WITH_DEFAULT_EXPRESSION
gtid_mode=ON
ER_GTID_UNSAFE_ALTER_ADD_COL_WITH_DEFAULT_EXPRESSION
gtid_next=
UUID
:NUMBER
ER_GTID_UNSAFE_ALTER_ADD_COL_WITH_DEFAULT_EXPRESSION
CREATE TEMPORARY
TABLE
DROP TEMPORARY
TABLE
--enforce-gtid-consistency
autocommit=1
--enforce-gtid-consistency
--enforce-gtid-consistency
sql_slave_skip_counter
gtid_executed
CHANGE
MASTER TO
SHOW_SLAVE_STATUS
gtid_mode=ON
--write-binlog
TABLE
--master-info-repository
FILE
STOP SLAVE;
SET GLOBAL master_info_repository = 'TABLE';
SET GLOBAL relay_log_info_repository = 'TABLE';
gtid_mode=ON
CHANGE MASTER TO
channel
master1
3451
master-1
CHANGE MASTER TO MASTER_HOST='master1', MASTER_USER='rpl', MASTER_PORT=3451, MASTER_PASSWORD='', \
MASTER_AUTO_POSITION = 1 FOR CHANNEL 'master-1';
TABLE
MASTER_LOG_POSITION
CHANGE MASTER TO
channel
master1
3451
master-1
CHANGE MASTER TO MASTER_HOST='master1', MASTER_USER='rpl', MASTER_PORT=3451, MASTER_PASSWORD='' \
MASTER_LOG_FILE='master1-bin.000006', MASTER_LOG_POS=628 FOR CHANNEL 'master-1';
START SLAVE
thread_types
START SLAVE thread_types
;
FOR CHANNEL
channel
START SLAVE thread_types
FOR CHANNEL channel
;
thread_types
STOP SLAVE
FOR CHANNEL
channel
STOP SLAVE thread_types
;
FOR CHANNEL
channel
STOP SLAVE thread_types
FOR CHANNEL channel
;
thread_types
RESET SLAVE
FOR CHANNEL
channel
RESET SLAVE;
FOR CHANNEL
channel
RESET SLAVE FOR CHANNEL channel
;
Channel_Name
SHOW SLAVE STATUS FOR CHANNEL
channel
channel
FOR CHANNEL
channel
SHOW VARIABLES
SHOW VARIABLES
mysql> SELECT * FROM replication_connection_status\G;
*************************** 1. row ***************************
CHANNEL_NAME: master1
GROUP_NAME:
SOURCE_UUID: 046e41f8-a223-11e4-a975-0811960cc264
THREAD_ID: 24
SERVICE_STATE: ON
COUNT_RECEIVED_HEARTBEATS: 0
LAST_HEARTBEAT_TIMESTAMP: 0000-00-00 00:00:00
RECEIVED_TRANSACTION_SET: 046e41f8-a223-11e4-a975-0811960cc264:4-37
LAST_ERROR_NUMBER: 0
LAST_ERROR_MESSAGE:
LAST_ERROR_TIMESTAMP: 0000-00-00 00:00:00
*************************** 2. row ***************************
CHANNEL_NAME: master2
GROUP_NAME:
SOURCE_UUID: 7475e474-a223-11e4-a978-0811960cc264
THREAD_ID: 26
SERVICE_STATE: ON
COUNT_RECEIVED_HEARTBEATS: 0
LAST_HEARTBEAT_TIMESTAMP: 0000-00-00 00:00:00
RECEIVED_TRANSACTION_SET: 7475e474-a223-11e4-a978-0811960cc264:4-6
LAST_ERROR_NUMBER: 0
LAST_ERROR_MESSAGE:
LAST_ERROR_TIMESTAMP: 0000-00-00 00:00:00
2 rows in set (0.00 sec)
CHANNEL_NAME
master2
CHANNEL_NAME
WHERE CHANNEL_NAME=
channel
MySQL的> SELECT * FROM replication_connection_status WHERE CHANNEL_NAME='master1'\G
*************************** 1。行*************************** channel_name:master1group_name:source_uuid:046e41f8-a223-11e4-a975-0811960cc264thread_id:24service_state:oncount_received_heartbeats:0last_heartbeat_timestamp:0000-00-00 00:00:00received_transaction_set:046e41f8-a223-11e4-a975-0811960cc264:4-37last_error_number:0last_error_message:last_error_timestamp:0000-00-00 00:00:001行集(0秒)
WHERE
CHANNEL_NAME=
channel
UUID:NUMBER
Anonymous_gtid_log_event
WAIT_FOR_EXECUTED_GTID_SET()
session_track_gtids
sql_slave_skip_counter
Anonymous_gtid_log_event
gtid_mode
enforce_gtid_consistency
SYSTEM_VARIABLES_ADMIN
SUPER
gtid_mode
OFF
gtid_mode=ON
gtid_mode=OFF
gtid_mode=OFF_PERMISSIVE
gtid_mode=ON_PERMISSIVE
gtid_mode=ON
gtid_mode=ON_PERMISSIVE
gtid_mode
OFF
OFF_PERMISSIVE
ON_PERMISSIVE
ON
gtid_mode
gtid_mode
OFF
ON
gtid_mode=ON
gtid_mode=OFF
gtid_executed
gtid_mode
gtid_mode
gtid_executed
gtid_purged
replication_connection_status
SHOW SLAVE STATUS
replication_applier_status_by_worker
gtid_mode=ON
CHANGE MASTER TO MASTER_AUTO_POSITION = 1;
gtid_mode
gtid_mode
gtid_mode
|
|
|
| |
---|---|---|---|---|
| ||||
| ||||
| ||||
|
gtid_mode
gtid_next
gtid_mode
gtid_next
ANONYMOUS
Error
UUID:NUMBER
New GTID
gtid_next
gtid_mode
SET @@GLOBAL.ENFORCE_GTID_CONSISTENCY = WARN;
SET @@GLOBAL.ENFORCE_GTID_CONSISTENCY = ON;
SET @@GLOBAL.GTID_MODE = OFF_PERMISSIVE;
SET @@GLOBAL.GTID_MODE = ON_PERMISSIVE;
ONGOING_ANONYMOUS_TRANSACTION_COUNT
显示状态“ongoing_anonymous_transaction_count”;
FLUSH LOGS
SET @@GLOBAL.GTID_MODE = ON;
gtid-mode=ON
FOR CHANNEL
channel
STOP SLAVE [FOR CHANNEL 'channel'];CHANGE MASTER TO MASTER_AUTO_POSITION = 1 [FOR CHANNEL 'channel'];START SLAVE [FOR CHANNEL 'channel'];
gtid_mode
FOR CHANNEL
STOP SLAVE [FOR CHANNEL 'channel'];CHANGE MASTER TO MASTER_AUTO_POSITION = 0, MASTER_LOG_FILE = file, \MASTER_LOG_POS = position [FOR CHANNEL 'channel'];START SLAVE [FOR CHANNEL 'channel'];
SET @@GLOBAL.GTID_MODE = ON_PERMISSIVE;
SET @@GLOBAL.GTID_MODE = OFF_PERMISSIVE;
SELECT @@GLOBAL.GTID_OWNED;
FLUSH LOGS
SET @@GLOBAL.GTID_MODE = OFF;
gtid-mode=OFF
enforce_gtid_consistency=OFF
enforce_gtid_consistency=OFF
SHOW MASTER STATUS;
File
SELECT MASTER_POS_WAIT(file, position);
For example, suppose you have three servers A, B, and C, replicating in a circle so that A -> B -> C -> A. The procedure is then:
--server-id
--server-id=# | |
server_id | |
1 | |
0 | |
0 | |
4294967295 |
server_id
--server-id
server_id
server_uuid
server_uuid
--server-id
server_uuid | |
auto.cnf
my.ini
[auto]
server_uuid
[auto]server_uuid=8a94f357-aab4-11df-86ab-c80aa9429562
auto.cnf
SHOW SLAVE HOSTS
START SLAVE
SHOW SLAVE STATUS
STOP SLAVE
RESET SLAVE
server_uuid
--replicate-same-server-id
server_uuid
server_uuid
CHANGE MASTER
TO
abort-slave-event-count
binlog_gtid_simple_recovery
Com_change_master
Com_show_master_status
Com_show_new_master
Com_show_slave_hosts
Com_show_slave_status
Com_show_slave_status_nonblocking
Com_slave_start
Com_slave_stop
disconnect-slave-event-count
enforce-gtid-consistency
enforce_gtid_consistency
executed-gtids-compression-period
executed_gtids_compression_period
gtid-executed-compression-period
gtid-mode
gtid_executed
gtid_executed_compression_period
gtid_mode
gtid_next
gtid_owned
gtid_purged
init_slave
log-slave-updates
log_slave_updates
log_statements_unsafe_for_binlog
master-info-file
master-info-repository
master-retry-count
master_info_repository
max_relay_log_size
original_commit_timestamp
relay-log
relay-log-index
relay-log-info-file
relay-log-info-repository
relay-log-recovery
relay_log_basename
relay_log_index
relay_log_info_file
relay_log_info_repository
relay_log_purge
relay_log_recovery
relay_log_space_limit
replicate-do-db
replicate-do-table
replicate-ignore-db
replicate-ignore-table
replicate-rewrite-db
replicate-same-server-id
replicate-wild-do-table
replicate-wild-ignore-table
report-host
report-password
report-port
report-user
Rpl_semi_sync_master_clients
rpl_semi_sync_master_enabled
Rpl_semi_sync_master_net_avg_wait_time
Rpl_semi_sync_master_net_wait_time
Rpl_semi_sync_master_net_waits
Rpl_semi_sync_master_no_times
Rpl_semi_sync_master_no_tx
Rpl_semi_sync_master_status
Rpl_semi_sync_master_timefunc_failures
rpl_semi_sync_master_timeout
rpl_semi_sync_master_trace_level
Rpl_semi_sync_master_tx_avg_wait_time
Rpl_semi_sync_master_tx_wait_time
Rpl_semi_sync_master_tx_waits
rpl_semi_sync_master_wait_for_slave_count
rpl_semi_sync_master_wait_no_slave
rpl_semi_sync_master_wait_point
Rpl_semi_sync_master_wait_pos_backtraverse
Rpl_semi_sync_master_wait_sessions
Rpl_semi_sync_master_yes_tx
rpl_semi_sync_slave_enabled
Rpl_semi_sync_slave_status
rpl_semi_sync_slave_trace_level
rpl_read_size
rpl_stop_slave_timeout
server_uuid
show-slave-auth-info
simplified_binlog_gtid_recovery
skip-slave-start
slave-checkpoint-group
slave-checkpoint-period
slave-load-tmpdir
slave-max-allowed-packet
slave_net_timeout
slave-parallel-type
slave-parallel-workers
slave-pending-jobs-size-max
slave-rows-search-algorithms
slave-skip-errors
slave_checkpoint_group
slave_checkpoint_period
slave_compressed_protocol
slave_exec_mode
Slave_heartbeat_period
slave_max_allowed_packet
Slave_open_temp_tables
slave_parallel_type
slave_parallel_workers
slave_pending_jobs_size_max
slave_preserve_commit_order
Slave_retried_transactions
slave_rows_search_algorithms
Slave_rows_last_search_algorithm_used
Slave_running
slave_transaction_retries
slave_type_conversions
sql_slave_skip_counter
sync_binlog
sync_master_info
sync_relay_log
sync_relay_log_info
binlog-checksum
binlog-do-db
binlog_expire_logs_seconds
binlog_format
binlog-ignore-db
binlog-row-event-max-size
binlog-rows-query-log-events
Binlog_cache_disk_use
binlog_cache_size
Binlog_cache_use
binlog_checksum
binlog_direct_non_transactional_updates
binlog_error_action
binlog_group_commit_sync_delay
binlog_group_commit_sync_no_delay_count
binlog_max_flush_queue_time
binlog_order_commits
binlog_row_image
binlog_row_metadata
binlog_row_value_options
binlog_rows_query_log_events
Binlog_stmt_cache_disk_use
binlog_stmt_cache_size
Binlog_stmt_cache_use
binlog_transaction_dependency_tracking
binlog_transaction_dependency_history_size
Com_show_binlog_events
Com_show_binlogs
expire_logs_days
log_bin_basename
log-bin-trust-function-creators
log-bin-use-v1-row-events
log_bin_use_v1_row_events
log_builtin_as_identified_by_password
master-verify-checksum
master_verify_checksum
max-binlog-dump-events
max_binlog_cache_size
max_binlog_size
max_binlog_stmt_cache_size
slave-sql-verify-checksum
slave_sql_verify_checksum
sporadic-binlog-dump-fail
sql_log_bin
transaction_write_set_extraction
SET
server-id
server-id=3
--show-slave-auth-info | |
FALSE |
SHOW SLAVE HOSTS
--report-user
--report-password
auto_increment_increment | |
1 | |
1 | |
65535 |
auto_increment_increment
auto_increment_offset
auto_increment_increment
auto_increment_offset
auto_increment_increment
AUTO_INCREMENT
auto_increment_increment
MySQL的> SHOW VARIABLES LIKE 'auto_inc%';
-------------------------- ------- | variable_name |价值| -------------------------- ------- | auto_increment_increment | 1 | | auto_increment_offset | 1 | -------------------------- ------- 2行集(0秒)MySQL > CREATE TABLE autoinc1
-> (col INT NOT NULL AUTO_INCREMENT PRIMARY KEY);
查询行,0行受影响(0.04秒)MySQL > SET @@auto_increment_increment=10;
查询好,为受影响的行(0.001秒)MySQL > SHOW VARIABLES LIKE 'auto_inc%';
-------------------------- ------- | variable_name |价值| -------------------------- ------- | auto_increment_increment | 10 | | auto_increment_offset | 1 | -------------------------- ------- 2行集(0.01秒)MySQL > INSERT INTO autoinc1 VALUES (NULL), (NULL), (NULL), (NULL);
查询行,4行受影响(0秒)记录:4份:0警告:0mysql > SELECT col FROM autoinc1;
----- | Col | ----- | 1 | | 11 | | 21 | | 31 | ----- 4行集(0秒)
auto_increment_offset
auto_increment_increment
MySQL的> SET @@auto_increment_offset=5;
查询好,为受影响的行(0.001秒)MySQL > SHOW VARIABLES LIKE 'auto_inc%';
-------------------------- ------- | variable_name |价值| -------------------------- ------- | auto_increment_increment | 10 | | auto_increment_offset | 5 | -------------------------- ------- 2行集(0秒)MySQL > CREATE TABLE autoinc2
-> (col INT NOT NULL AUTO_INCREMENT PRIMARY KEY);
查询行,0行受影响(0.06秒)MySQL > INSERT INTO autoinc2 VALUES (NULL), (NULL), (NULL), (NULL);
查询行,4行受影响(0秒)记录:4份:0警告:0mysql > SELECT col FROM autoinc2;
----- | Col | ----- | 5 | | 15 | | 25 | | 35 | ----- 4行集(0.02秒)
auto_increment_offset
auto_increment_increment
auto_increment_offset
AUTO_INCREMENT
AUTO_INCREMENT
auto_increment_offset
N
N
MySQL的> SHOW VARIABLES LIKE 'auto_inc%';
-------------------------- ------- | variable_name |价值| -------------------------- ------- | auto_increment_increment | 10 | | auto_increment_offset | 5 | -------------------------- ------- 2行集(0秒)MySQL > SELECT col FROM autoinc1;
----- | Col | ----- | 1 | | 11 | | 21 | | 31 | -----四行集(0.001秒)MySQL > INSERT INTO autoinc1 VALUES (NULL), (NULL), (NULL), (NULL);
查询行,4行受影响(0秒)记录:4份:0警告:0mysql > SELECT col FROM autoinc1;
----- | Col | ----- | 1 | | 11 | | 21 | | 31 | | 35 | | 45 | | 55 | | 65 | ----- 8行集(0秒)
auto_increment_increment
auto_increment_offset
N
INSERT
col
SELECT
AUTO_INCREMENT
AUTO_INCREMENT
auto_increment_increment
auto_increment_offset | |
1 | |
1 | |
65535 |
auto_increment_increment
auto_increment_offset
rpl_semi_sync_master_enabled | |
OFF |
ON
OFF
rpl_semi_sync_master_timeout | |
10000 |
rpl_semi_sync_master_trace_level
rpl_semi_sync_master_trace_level | |
32 |
1 = general level (for example, time function failures)
16 = detail level (more verbose information)
32 = net wait level (more information about network waits)
64 = function level (information about function entry and exit)
rpl_semi_sync_master_wait_for_slave_count
rpl_semi_sync_master_wait_for_slave_count | |
1 | |
1 | |
65535 |
rpl_semi_sync_master_wait_for_slave_count
rpl_semi_sync_master_wait_for_slave_count
rpl_semi_sync_master_timeout
rpl_semi_sync_master_wait_no_slave
rpl_semi_sync_master_wait_no_slave | |
ON |
rpl_semi_sync_master_timeout
rpl_semi_sync_master_wait_for_slave_count
rpl_semi_sync_master_wait_no_slave
rpl_semi_sync_master_wait_for_slave_count
rpl_semi_sync_master_wait_no_slave
rpl_semi_sync_master_wait_for_slave_count
rpl_semi_sync_master_timeout
rpl_semi_sync_master_wait_point
rpl_semi_sync_master_wait_point | |
AFTER_SYNC | |
|
AFTER_SYNC
AFTER_COMMIT
AFTER_SYNC
AFTER_COMMIT
rpl_semi_sync_master_wait_point
CHANGE MASTER TO
SET
server-id
my.cnf
[mysqld]server-id=3
CHANGE MASTER TO
--log-slave-updates | |
log_slave_updates | |
ON | |
OFF |
--log-bin
--log-slave-updates
--skip-log-bin
--skip-log-slave-updates
--log-slave-updates
A -> B -> C
A
B
B
--log-slave-updates
B
--master-info-file=file_name | |
master.info |
--master-info-repository=FILE
--master-info-repository=FILE
--master-retry-count=# | |
86400 | |
0 | |
18446744073709551615 | |
4294967295 |
MASTER_CONNECT_RETRY
CHANGE MASTER
TO
--slave-net-timeout
MASTER_RETRY_COUNT
CHANGE MASTER TO
--max-relay-log-size=# | |
max_relay_log_size | |
0 | |
0 | |
1073741824 |
max_binlog_size
host_name
-relay-binhost_name
channel
channel
--relay-log
--log-bin
--log-bin-index
--relay-log
--relay-log-index
--relay-log
--relay-log
max_relay_log_size
relay_log_basename
--relay-log-index=file_name | |
relay_log_index | |
--relay-log-index
--relay-log
host_name
-relay-bin.indexhost_name
channel
channel
--relay-log
--log-bin
--log-bin-index
--relay-log-index
--relay-log-info-file=
file_name
--relay-log-info-file=file_name | |
relay-log.info |
--relay-log-info-repository
--relay-log-info-repository=FILE
--relay-log-purge | |
relay_log_purge | |
TRUE |
SET GLOBAL relay_log_purge =
N
--relay-log-recovery
--relay-log-recovery | |
FALSE |
--relay-log-info-repository
relay-log-purge
--relay-log-recovery
relay-log-purge
slave_parallel_workers
--relay-log-recovery
START
SLAVE UNTIL SQL_AFTER_MTS_GAPS
RESET SLAVE
--relay-log-space-limit=# | |
relay_log_space_limit | |
0 | |
0 | |
18446744073709551615 | |
4294967295 |
--relay-log-space-limit
--max-relay-log-size
--max-binlog-size
--max-relay-log-size
--relay-log-space-limit
--relay-log-space-limit
--replicate-do-db=name | |
CHANGE
REPLICATION FILTER REPLICATE_DO_DB
channel_1
channel_1
db_name
group_replication_applier
USE
db_name
UPDATE
some_db.some_table
SET
foo='bar'
--replicate-do-db=sales
UPDATE
USE prices; UPDATE sales.january SET amount=amount+1000;
DELETE
UPDATE
db_name
db_name
--replicate-do-db=sales
USE prices;UPDATE sales.february SET amount=amount+100;
february
UPDATE
USE
--replicate-do-db=sales
USE prices;UPDATE prices.march SET amount=amount-25;
USE prices
UPDATE
--replicate-do-db
--replicate-do-db=db1
USE db1;UPDATE db1.table1 SET col1 = 10, db2.table2 SET col2 = 20;
table1
table2
UPDATE
USE db4
USE db4;UPDATE db1.table1 SET col1 = 10, db2.table2 SET col2 = 20;
UPDATE
UPDATE
table2
--replicate-do-db
--replicate-wild-do-table=
db_name
.%
--binlog-do-db
--replicate-do-db
--binlog-do-db
--replicate-ignore-db=name | |
CHANGE
REPLICATION FILTER REPLICATE_IGNORE_DB
channel_1
channel_1
db_name
group_replication_applier
--replicate-do-db
USE
db_name
db_name
--replicate-ignore-db=sales
USE prices;UPDATE sales.january SET amount=amount+1000;
UPDATE
--replicate-ignore-db
USE
UPDATE
sales.january
--replicate-ignore-db=sales
sales
--replicate-wild-ignore-table=
db_name
.%
--binlog-ignore-db
--replicate-ignore-db
--binlog-ignore-db
--replicate-do-table=
db_name.tbl_name
--replicate-do-table=name | |
--replicate-do-db
CHANGE
REPLICATION FILTER REPLICATE_DO_TABLE
channel_1
channel_1
db_name.tbl_name
group_replication_applier
--replicate-*-db
--replicate-ignore-table=
db_name.tbl_name
--replicate-ignore-table=name | |
--replicate-ignore-db
CHANGE
REPLICATION FILTER REPLICATE_IGNORE_TABLE
channel_1
channel_1
db_name.tbl_name
group_replication_applier
--replicate-*-db
--replicate-rewrite-db=
from_name
->to_name
--replicate-rewrite-db=old_name->new_name | |
USE
to_name
from_name
CREATE DATABASE
DROP DATABASE
ALTER DATABASE
from_name
from_name
--replicate-*
CHANGE
REPLICATION FILTER REPLICATE_REWRITE_DB
>
内核> mysqld --replicate-rewrite-db="
olddb
->newdb
"
channel_1
内核> mysqld --replicate-rewrite-db=
channel_1
:db_name1
->db_name2
group_replication_applier
--replicate-do-table
b
--replicate-rewrite-db='a->b'
DELETE FROM
a.t
--replicate-do-table=a.t
b
--replicate-do-table=b.t
--replicate-do-table=*.t
--replicate-do-table=a.t
--replication-rewrite-db
--replicate-same-server-id | |
FALSE |
--log-slave-updates
--replicate-same-server-id
--replicate-wild-do-table=
db_name.tbl_name
--replicate-wild-do-table=name | |
%
LIKE
CHANGE
REPLICATION FILTER REPLICATE_WILD_DO_TABLE
channel_1
channel_1
db_name.tbl_name
group_replication_applier
--replicate-*-db
--replicate-wild-do-table=foo%.bar%
bar
%
CREATE
DATABASE
DROP
DATABASE
ALTER
DATABASE
--replicate-wild-do-table=foo%.%
my_own%db
_
--replicate-wild-do-table=my\_own\%db
--replicate-wild-do-table=my\\_own\\%db
--replicate-wild-ignore-table=
db_name.tbl_name
--replicate-wild-ignore-table=name | |
CHANGE
REPLICATION FILTER REPLICATE_WILD_IGNORE_TABLE
channel_1
channel_1
db_name.tbl_name
group_replication_applier
--replicate-wild-ignore-table=foo%.bar%
bar
--replicate-wild-do-table
--replicate-wild-ignore-table
--report-host=host_name | |
report_host | |
SHOW SLAVE
HOSTS
--report-password=name | |
report_password | |
SHOW SLAVE HOSTS
--show-slave-auth-info
--report-password
--report-port=# | |
report_port | |
[slave_port] | |
0 | |
65535 |
SHOW SLAVE
HOSTS
--report-user=name | |
report_user | |
SHOW SLAVE HOSTS
--show-slave-auth-info
--report-user
--slave-checkpoint-group=# | |
512 | |
32 | |
524280 | |
8 |
SHOW SLAVE STATUS
--slave-checkpoint-period
-DWITH_DEBUG
--slave-checkpoint-period=# | |
300 | |
1 | |
4G |
SHOW SLAVE STATUS
--slave-checkpoint-group
-DWITH_DEBUG
--slave-parallel-workers=# | |
0 | |
0 | |
1024 |
slave_preserve_commit_order=1
--slave-parallel-type
--slave-parallel-type
slave_preserve_commit_order
--slave-pending-jobs-size-max=
#
--slave-pending-jobs-size-max=# | |
128M | |
16M | |
1024 | |
16EiB | |
1024 |
--skip-slave-start | |
FALSE |
START SLAVE
--slave_compressed_protocol={0|1}
--slave-compressed-protocol | |
slave_compressed_protocol | |
OFF |
--slave-load-tmpdir=dir_name | |
slave_load_tmpdir | |
/tmp |
tmpdir
LOAD DATA
INFILE
--relay-log
LOAD DATA
INFILE
slave-max-allowed-packet=
bytes
--slave-max-allowed-packet=# | |
1073741824 | |
1024 | |
1073741824 |
max_allowed_packet
slave_max_allowed_packet
max_allowed_packet
slave_max_allowed_packet
--slave-max-allowed-packet=10000
--slave-net-timeout=# | |
slave_net_timeout | |
60 | |
1 |
MASTER_CONNECT_RETRY
CHANGE MASTER
TO
--master-retry-count
--slave-parallel-type=type | |
DATABASE | |
|
slave_parallel_workers
LOGICAL_CLOCK
binlog_transaction_dependency_tracking
DATABASE
slave_preserve_commit_order=1
LOGICAL_CLOCK
binlog_transaction_dependency_tracking
slave-rows-search-algorithms=
list
--slave-rows-search-algorithms=list | |
INDEX_SCAN,HASH_SCAN | |
TABLE_SCAN,INDEX_SCAN | |
|
slave_rows_search_algorithms
INDEX_SCAN
HASH_SCAN
INDEX_SCAN,HASH_SCAN
| INDEX_SCAN,TABLE_SCAN | TABLE_SCAN,HASH_SCAN | |
---|---|---|---|
SELECT
SHOW VARIABLES
INDEX_SCAN,HASH_SCAN
INDEX_SCAN,HASH_SCAN
TABLE_SCAN,HASH_SCAN
TABLE_SCAN,INDEX_SCAN
INDEX_SCAN
INDEX_SCAN
--binlog-row-event-max-size
DELETE
slave_rows_search_algorithms
HASH_SCAN
DELETE
slave_rows_search_algorithms
HASH_SCAN
--slave-skip-errors=[
err_code1
,err_code2
,...|all|ddl_exist_errors]
--slave-skip-errors=name | |
slave_skip_errors | |
OFF | |
|
SHOW SLAVE STATUS
ddl_exist_errors
all
--slave-skip-errors=1062,1053 --slave-skip-errors=all --slave-skip-errors=ddl_exist_errors
--slave-sql-verify-checksum={0|1}
--slave-sql-verify-checksum=value | |
1 | |
|
--abort-slave-event-count=# | |
0 | |
0 |
value
value
SHOW SLAVE STATUS
Slave_IO_Running
--disconnect-slave-event-count
--disconnect-slave-event-count=# | |
0 |
mysql
--master-info-repository={TABLE|FILE}
--master-info-repository=FILE|TABLE | |
TABLE | |
FILE | |
|
mysql
TABLE
TABLE
FILE
--master-info-file
sync_master_info
--relay-log-info-repository={TABLE|FILE}
--relay-log-info-repository=FILE|TABLE | |
TABLE | |
FILE | |
|
mysql
TABLE
TABLE
--relay-log-recovery
FILE
--relay-log-info-file
sync_relay_log_info
SET
--init-slave=name | |
init_slave | |
init_connect
init_connect
START SLAVE
init_slave
init_slave
START SLAVE
log_slow_slave_statements | |
OFF |
long_query_time
START SLAVE
log_slow_slave_statements
--master-info-repository=FILE|TABLE | |
master_info_repository | |
TABLE | |
FILE | |
|
mysql
TABLE
TABLE
FILE
--master-info-file
sync_master_info
--max-relay-log-size=# | |
max_relay_log_size | |
0 | |
0 | |
1073741824 |
max_relay_log_size
max_binlog_size
max_relay_log_size
max_relay_log_size
host_name
-relay-binhost_name
channel
channel
relay_log_basename | |
datadir + '/' + hostname + '-relay-bin' |
--relay-log-index | |
relay_log_index | |
*host_name*-relay-bin.index |
host_name
-relay-bin.index
--relay-log-info-file=file_name | |
relay_log_info_file | |
relay-log.info |
relay_log_info_repository=FILE
relay_log_info_repository=FILE
relay_log_info_repository | |
TABLE | |
FILE | |
|
mysql
TABLE
TABLE
--relay-log-recovery
FILE
--relay-log-info-file
sync_relay_log_info
--relay-log-purge | |
relay_log_purge | |
TRUE |
ON
--relay-log-recovery | |
relay_log_recovery | |
FALSE |
--relay-log-recovery
relay-log-purge
--relay-log-recovery
relay-log-purge
relay_log_recovery
START SLAVE
UNTIL SQL_AFTER_MTS_GAPS
--relay-log-space-limit=# | |
relay_log_space_limit | |
0 | |
0 | |
18446744073709551615 | |
4294967295 |
--report-host=host_name | |
report_host | |
--report-host
--report-password=name | |
report_password | |
--report-password
--report-port=# | |
report_port | |
[slave_port] | |
0 | |
65535 |
--report-port
--report-user=name | |
report_user | |
--report-user
--rpl-read-size=# | |
rpl_read_size | |
8192 | |
8192 | |
4294967295 |
rpl_read_size
rpl_read_size
rpl_semi_sync_slave_enabled | |
OFF |
ON
OFF
rpl_semi_sync_slave_trace_level
rpl_semi_sync_slave_trace_level | |
32 |
rpl_semi_sync_master_trace_level
--rpl-stop-slave-timeout=seconds | |
rpl_stop_slave_timeout | |
31536000 | |
2 | |
31536000 |
STOP SLAVE
rpl_stop_slave_timeout
STOP SLAVE
STOP SLAVE
STOP
SLAVE
--slave-allow-batching | |
slave_allow_batching | |
off |
NDB
--slave-checkpoint-group=# | |
slave_checkpoint_group=# | |
512 | |
32 | |
524280 | |
8 |
SHOW SLAVE STATUS
START SLAVE
slave_checkpoint_period
-DWITH_DEBUG
--slave-checkpoint-period=# | |
slave_checkpoint_period=# | |
300 | |
1 | |
4G |
SHOW SLAVE STATUS
slave_checkpoint_group
-DWITH_DEBUG
--slave-compressed-protocol | |
slave_compressed_protocol | |
OFF |
START SLAVE
--slave-exec-mode=mode | |
slave_exec_mode | |
| |
|
IDEMPOTENT
IDEMPOTENT
--slave-load-tmpdir=dir_name | |
slave_load_tmpdir | |
/tmp |
LOAD DATA
INFILE
slave_max_allowed_packet | |
1073741824 | |
1024 | |
1073741824 |
max_allowed_packet
slave_max_allowed_packet
max_allowed_packet
slave_max_allowed_packet
slave_max_allowed_packet
--slave-max-allowed-packet
--slave-net-timeout=# | |
slave_net_timeout | |
60 | |
1 |
START SLAVE
--slave-parallel-type=type | |
DATABASE | |
|
slave_parallel_workers
LOGICAL_CLOCK
binlog_transaction_dependency_tracking
DATABASE
slave_preserve_commit_order=1
LOGICAL_CLOCK
binlog_transaction_dependency_tracking
--slave-parallel-workers=# | |
slave_parallel_workers | |
0 | |
0 | |
1024 |
slave_preserve_commit_order=1
--slave-parallel-type
--slave-parallel-type
slave_preserve_commit_order
slave_parallel_workers
START SLAVE
--slave-pending-jobs-size-max=# | |
slave_pending_jobs_size_max | |
128M | |
16M | |
1024 | |
16EiB | |
1024 |
START SLAVE
--slave-preserve-commit-order=value | |
slave_preserve_commit_order | |
0 | |
|
slave_preserve_commit_order=1
--log-bin
--log-slave-updates
slave_preserve_commit_order
slave_preserve_commit_order=0
slave_preserve_commit_order=1
slave_rows_search_algorithms=list | |
INDEX_SCAN,HASH_SCAN | |
TABLE_SCAN,INDEX_SCAN | |
|
--slave-rows-search-algorithms
INDEX_SCAN
HASH_SCAN
INDEX_SCAN,HASH_SCAN
| INDEX_SCAN,TABLE_SCAN | TABLE_SCAN,HASH_SCAN | |
---|---|---|---|
SELECT
SHOW VARIABLES
INDEX_SCAN,HASH_SCAN
INDEX_SCAN,HASH_SCAN
TABLE_SCAN,HASH_SCAN
TABLE_SCAN,INDEX_SCAN
INDEX_SCAN
INDEX_SCAN
--binlog-row-event-max-size
DELETE
slave_rows_search_algorithms
HASH_SCAN
DELETE
slave_rows_search_algorithms
HASH_SCAN
--slave-skip-errors=name | |
slave_skip_errors | |
OFF | |
|
slave_sql_verify_checksum | |
1 | |
|
--slave-transaction-retries=# | |
slave_transaction_retries | |
10 | |
0 | |
18446744073709551615 | |
4294967295 |
InnoDB
InnoDB
innodb_lock_wait_timeout
slave_transaction_retries
replication_applier_status
--slave-type-conversions=set | |
slave_type_conversions | |
| |
|
ALL_LOSSY
ALL_SIGNED
sql_slave_skip_counter | |
START
SLAVE
START SLAVE
START SLAVE
channel
--gtid-mode=ON
gtid_executed
--sync-master-info=# | |
sync_master_info | |
10000 | |
0 | |
18446744073709551615 | |
4294967295 |
master_info_repository
TABLE
master_info_repository = FILE.sync_master_info
fdatasync()
master.info
master_info_repository = TABLE.sync_master_info
sync_master_info
--sync-relay-log=# | |
sync_relay_log | |
10000 | |
0 | |
18446744073709551615 | |
4294967295 |
fdatasync()
sync_relay_log
--sync-relay-log-info=# | |
sync_relay_log_info | |
10000 | |
0 | |
18446744073709551615 | |
4294967295 |
sync_relay_log_info
relay_log_info_repository
TABLE
InnoDB
MyISAM
sync_relay_log_info = 0
relay_log_info_repository
relay-log.info
relay_log_info_repository
sync_relay_log_info
relay_log_info_repository
sync_relay_log_info =
N
> 0
relay_log_info_repository
relay-log.info
N
relay_log_info_repository
sync_relay_log_info
relay_log_info_repository
N
--binlog-row-event-max-size=# | |
8192 | |
256 | |
18446744073709551615 | |
4294967295 |
--binlog-rows-query-log-events
--binlog-rows-query-log-events | |
FALSE |
binlog_rows_query_log_events
--log-bin
--log-bin
--log-bin
host_name
--log-bin
log_bin_basename
log_bin
--initialize
--log-bin
--skip-log-bin
--disable-log-bin
--log-slave-updates
--slave-preserve-commit-order
--skip-log-slave-updates
--skip-slave-preserve-commit-order
--skip-log-bin
--disable-log-bin
--log-slave-updates
--slave-preserve-commit-order
--skip-log-bin
--disable-log-bin
server_id
--server-id
--log-bin-index=file_name | |
--log-bin
--log-bin
--log-bin
host_name
--log-bin-trust-function-creators[={0|1}]
--log-bin-trust-function-creators | |
log_bin_trust_function_creators | |
FALSE |
log_bin_trust_function_creators
log_bin_trust_function_creators
--log-bin-use-v1-row-events[={0|1}]
--log-bin-use-v1-row-events[={0|1}] | |
log_bin_use_v1_row_events | |
0 |
--log-bin-use-v1-row-events
log_bin_use_v1_row_events
--binlog-do-db=name | |
--replicate-do-db
--replicate-do-db
binlog_format
CREATE
TABLE
ALTER
TABLE
USE
db_name
UPDATE
some_db.some_table
SET
foo='bar'
--binlog-do-db=sales
UPDATE
USE prices; UPDATE sales.january SET amount=amount+1000;
DELETE
UPDATE
--binlog-do-db=sales
UPDATE
--binlog-do-db
USE sales;UPDATE prices.discounts SET percentage = percentage + 10;
sales
UPDATE
UPDATE
db_name
db_name
--binlog-do-db=sales
USE prices;UPDATE sales.february SET amount=amount+100;
february
UPDATE
USE
--binlog-do-db=sales
UPDATE
USE prices;UPDATE prices.march SET amount=amount-25;
USE prices
UPDATE
--binlog-do-db
--binlog-do-db=db1
USE db1;UPDATE db1.table1 SET col1 = 10, db2.table2 SET col2 = 20;
table1
UPDATE
USE db4
USE db4;UPDATE db1.table1 SET col1 = 10, db2.table2 SET col2 = 20;
UPDATE
table2
--binlog-do-db
--binlog-ignore-db=name | |
--replicate-ignore-db
--replicate-ignore-db
binlog_format
CREATE
TABLE
ALTER
TABLE
USE
db_name
--binlog-ignore-db
db_name
--binlog-ignore-db=sales
USE prices;UPDATE sales.january SET amount=amount+1000;
UPDATE
--binlog-ignore-db
USE
UPDATE
sales.january
--binlog-ignore-db=sales
sales
--binlog-checksum={NONE|CRC32}
--binlog-checksum=type | |
CRC32 | |
|
NONE
--master-verify-checksum={0|1}
--master-verify-checksum=name | |
OFF |
--slave-sql-verify-checksum
--max-binlog-dump-events=# | |
0 |
--sporadic-binlog-dump-fail | |
FALSE |
SET
--binlog-cache-size=# | |
binlog_cache_size | |
32768 | |
4096 | |
18446744073709551615 | |
4294967295 |
log_bin
Binlog_cache_use
Binlog_cache_disk_use
binlog_cache_size
binlog_stmt_cache_size
binlog_checksum | |
CRC32 | |
|
binlog_checksum
CRC32
binlog_checksum
binlog_checksum
binlog_checksum
NONE
binlog_direct_non_transactional_updates
--binlog-direct-non-transactional-updates[=value] | |
binlog_direct_non_transactional_updates | |
OFF |
binlog_direct_non_transactional_updates
binlog_direct_non_transactional_updates
binlog_direct_non_transactional_updates
binlog_format
binlog_format
ROW
binlog_format
INSERT INTO myisam_table
SELECT * FROM innodb_table
ROW
--binlog-error-action[=value] | |
binlog_error_action | |
ABORT_SERVER | |
|
ABORT_SERVER
binlog_error_action
log_bin
--binlog-expire-logs-seconds=# | |
binlog_expire_logs_seconds | |
2592000 | |
0 | |
0 | |
4294967295 |
binlog_expire_logs_seconds
expire_logs_days
binlog_expire_logs_seconds
expire_logs_days
binlog_expire_logs_seconds
expire_logs_days
binlog_expire_logs_seconds
expire_logs_days
expire_logs_days
binlog_expire_logs_seconds
binlog_expire_logs_seconds
PURGE BINARY LOGS
--binlog-format=format | |
binlog_format | |
ROW | |
|
STATEMENT
MIXED
binlog_format
--binlog-format
binlog_format
binlog_format
ROW
SYSTEM_VARIABLES_ADMIN
SUPER
binlog_format
MIXED
UUID()
binlog_group_commit_sync_delay
--binlog-group-commit-sync-delay=# | |
binlog_group_commit_sync_delay | |
0 | |
0 | |
1000000 |
binlog_group_commit_sync_delay
binlog_group_commit_sync_delay
sync_binlog=0
sync_binlog=1
binlog_group_commit_sync_delay
sync_binlog=0
sync_binlog
binlog_group_commit_sync_delay
slave_parallel_type=LOGICAL_CLOCK
binlog_transaction_dependency_tracking=COMMIT_ORDER
binlog_group_commit_sync_delay
binlog_group_commit_sync_delay
binlog_group_commit_sync_delay
binlog_group_commit_sync_no_delay_count
--binlog-group-commit-sync-no-delay-count=# | |
binlog_group_commit_sync_no_delay_count | |
0 | |
0 | |
1000000 |
binlog_group_commit_sync_delay
binlog_group_commit_sync_delay
binlog_max_flush_queue_time | |
0 | |
0 | |
100000 |
binlog_max_flush_queue_time
binlog_order_commits | |
ON |
--binlog-row-image=image_type | |
binlog_row_image=image_type | |
full | |
|
SYSTEM_VARIABLES_ADMIN
SUPER
NOT NULL
binlog_row_image
full
minimal
STATEMENT
binlog_format
binlog_row_image
binlog_row_image
--binlog-row-metadata=metadata_type | |
binlog_row_metadata=metadata_type | |
MINIMAL | |
|
MINIMAL
FULL
ENUM
PRIMARY
KEY
--binlog-row-value-options=# | |
binlog_row_value_options | |
'' | |
PARTIAL_JSON |
PARTIAL_JSON
UPDATE
JSON_SET()
JSON_REPLACE()
JSON_REMOVE()
SYSTEM_VARIABLES_ADMIN
SUPER
binlog_row_value_options
binlog_row_value_options=PARTIAL_JSON
binlog_format
MIXED
binlog_row_value_options
binlog_row_image=NOBLOB
binlog_row_image=MINIMAL
binlog_row_image=FULL
binlog_row_value_options=PARTIAL_JSON
log_bin_use_v1_row_events
binlog_row_value_options=PARTIAL_JSON
BINLOG
--verbose
binlog_row_value_options
--binlog-rows-query-log-events | |
binlog_rows_query_log_events | |
FALSE |
binlog_rows_query_log_events
SYSTEM_VARIABLES_ADMIN
SUPER
--verbose
--verbose
--verbose
--binlog-stmt-cache-size=# | |
binlog_stmt_cache_size | |
32768 | |
4096 | |
18446744073709551615 | |
4294967295 |
log_bin
Binlog_stmt_cache_use
Binlog_stmt_cache_disk_use
binlog_cache_size
binlog_transaction_dependency_tracking
--binlog-transaction-dependency-tracking=value | |
binlog_transaction_dependency_tracking | |
COMMIT_ORDER | |
|
COMMIT_ORDER
WRITESET_SESSION
WRITESET
WRITESET_SESSION
WRITESET
COMMIT_ORDER
COMMIT_ORDER
transaction_write_set_extraction
transaction_write_set_extraction
WRITESET
binlog_transaction_dependency_history_size
binlog_transaction_dependency_history_size
--binlog-transaction-dependency-history-size=# | |
binlog_transaction_dependency_history_size | |
25000 | |
1 | |
1000000 |
--expire-logs-days=# | |
expire_logs_days | |
0 | |
30 | |
0 | |
0 | |
99 |
expire_logs_days
binlog_expire_logs_seconds
expire_logs_days
binlog_expire_logs_seconds
binlog_expire_logs_seconds
expire_logs_days
binlog_expire_logs_seconds
binlog_expire_logs_seconds
expire_logs_days
expire_logs_days
binlog_expire_logs_seconds
binlog_expire_logs_seconds
PURGE BINARY LOGS
ON
log_bin
--log-bin
--skip-log-bin
--disable-log-bin
log_bin_basename | |
--log-bin
binlog
host_name
-bin
log_bin_index | |
--log-bin-index
log_bin_trust_function_creators
--log-bin-trust-function-creators | |
log_bin_trust_function_creators | |
FALSE |
SUPER
CREATE
ROUTINE
ALTER
ROUTINE
READS SQL DATA
--log-bin-use-v1-row-events[={0|1}] | |
log_bin_use_v1_row_events | |
0 |
--log-bin-use-v1-row-events
log_builtin_as_identified_by_password
--log-builtin-as-identified-by-password[={OFF|ON}] | |
log_builtin_as_identified_by_password | |
OFF |
--log-slave-updates | |
log_slave_updates | |
TRUE | |
FALSE |
--skip-log-slave-updates
log_slave_updates=OFF
log_statements_unsafe_for_binlog
log_statements_unsafe_for_binlog | |
ON |
master_verify_checksum | |
OFF |
master_verify_checksum
--max-binlog-cache-size=# | |
max_binlog_cache_size | |
18446744073709551615 | |
4096 | |
18446744073709551615 |
max_binlog_cache_size
max_binlog_stmt_cache_size
max_binlog_cache_size
binlog_cache_size
--max-binlog-size=# | |
max_binlog_size | |
1073741824 | |
4096 | |
1073741824 |
max_binlog_size
max_relay_log_size
max_binlog_size
--max-binlog-stmt-cache-size=# | |
max_binlog_stmt_cache_size | |
18446744073709547520 | |
4096 | |
18446744073709547520 |
max_binlog_stmt_cache_size
max_binlog_cache_size
original_commit_timestamp | |
sql_log_bin | |
SYSTEM_VARIABLES_ADMIN
SUPER
@@session.sql_log_bin
--sync-binlog=# | |
sync_binlog | |
1 | |
0 | |
4294967295 |
sync_binlog=0
sync_binlog=1
sync_binlog=
N
N
InnoDB
InnoDB
transaction_write_set_extraction
--transaction-write-set-extraction=[value] | |
transaction_write_set_extraction | |
XXHASH64 | |
OFF | |
|
XXHASH64
binlog_transaction_dependency_tracking
WRITESET_SESSION
--enforce-gtid-consistency[=value] | |
enforce_gtid_consistency | |
OFF | |
|
ON
--enforce-gtid-consistency
OFF
ON
WARN
--enforce-gtid-consistency
--enforce-gtid-consistency=ON
enforce_gtid_consistency
enforce-gtid-consistency
--enforce-gtid-consistency
--executed-gtids-compression-period
--executed-gtids-compression-period=# | |
1000 | |
0 | |
4294967295 |
--gtid-mode=MODE | |
gtid_mode | |
OFF | |
|
--gtid-mode=ON
enforce-gtid-consistency
gtid_mode
--gtid-executed-compression-period
--gtid-executed-compression-period=# | |
1000 | |
0 | |
4294967295 |
mysql.gtid_executed
log_bin
--binlog-gtid-simple-recovery | |
binlog_gtid_simple_recovery | |
TRUE |
binlog_gtid_simple_recovery=FALSE
gtid_executed
Previous_gtids_log_event
gtids_in_binlog
gtid_executed
gtid_mode=OFF
gtid_purged
Gtid_log_event
gtids_in_binlog
gtid_purged
gtid_executed
binlog_gtid_simple_recovery=TRUE
gtid_purged
gtid_executed
Gtid_log_event
gtid_executed
gtid_purged
gtid_mode
OFF
SET GTID_PURGED
SET gtid_purged
SHOW MASTER STATUS
binlog_gtid_simple_recovery=FALSE
gtid_purged
gtid_executed
--enforce-gtid-consistency[=value] | |
enforce_gtid_consistency | |
OFF | |
|
ON
enforce_gtid_consistency
OFF
ON
WARN
enforce_gtid_consistency
--enforce-gtid-consistency
enforce_gtid_consistency
OFF
--enforce-gtid-consistency
0=OFF=FALSE
1=ON=TRUE
2=WARN
SHOW
VARIABLES LIKE 'ENFORCE_GTID_CONSISTENCY'
SELECT * FROM INFORMATION_SCHEMA.VARIABLES WHERE 'VARIABLE_NAME' = 'ENFORCE_GTID_CONSISTENCY'
@@ENFORCE_GTID_CONSISTENCY
executed_gtids_compression_period
executed_gtids_compression_period | |
1000 | |
0 | |
4294967295 |
gtid_executed_compression_period
gtid_executed | |
gtid_executed | |
SET
gtid_purged
SHOW MASTER STATUS
SHOW SLAVE STATUS
@@global.gtid_executed
binlog_gtid_simple_recovery
gtid_executed
SET
gtid_purged
GTID_SUBTRACT(@@global.gtid_executed,
@@global.gtid_purged)
RESET MASTER
gtid_executed_compression_period
gtid_executed_compression_period | |
1000 | |
0 | |
4294967295 |
mysql.gtid_executed
SYSTEM_VARIABLES_ADMIN
SUPER
enforce_gtid_consistency
gtid_mode=ON
OFF
OFF_PERMISSIVE
ON_PERMISSIVE
ON
gtid_mode
OFF
ON
gtid_purged
gtid_executed
gtid_mode
gtid_mode
gtid_next
AUTOMATIC
ANONYMOUS
UUID
NUMBER
gtid_mode
gtid_mode
UUID
NUMBER
DROP TABLE
DROP TEMPORARY
TABLE
gtid_owned | |
gtid_purged | |
gtid_executed
gtid_purged
binlog_gtid_simple_recovery
gtid_purged
RESET MASTER
gtid_purged
gtid_purged
SET @@GLOBAL.GTID_PURGED = 'gtid_set'
GTID_PURGED
GTID_EXECUTED
GTID_EXECUTED
gtid_set
SET @@GLOBAL.GTID_PURGED = '+gtid_set'
gtid_set
gtid_purged
gtid_purged
binlog_gtid_simple_recovery=TRUE
binlog_gtid_simple_recovery
simplified_binlog_gtid_recovery
--simplified-binlog-gtid-recovery | |
simplified_binlog_gtid_recovery | |
FALSE |
binlog_gtid_simple_recovery
SHOW SLAVE STATUS
SHOW STATUS
SHOW
STATUS
MASTER_HEARTBEAT_PERIOD
CHANGE MASTER
TO
slave_net_timeout
replication_connection_status
SHOW SLAVE
STATUS
MySQL的> SHOW SLAVE STATUS\G
*************************** 1。行*************************** slave_io_state:等待主人送事件master_host:Master1 master_user:根master_port:3306 connect_retry:60 master_log_file:mysql-bin.000004 read_master_log_pos:931 relay_log_file:slave1-relay-bin.000056 relay_log_pos:950 relay_master_log_file:mysql-bin.000004 slave_io_running:是的slave_sql_running:是的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:931:1365:没有relay_log_space until_condition until_log_file:until_log_pos:0 master_ssl_allowed:没有master_ssl_ca_file:master_ssl_ca_path:master_ssl_cert:master_ssl_cipher:master_ssl_key:seconds_behind_master:0master_ssl_verify_server_cert:没有last_io_errno:0 last_io_error:last_sql_errno:0 last_sql_error:replicate_ignore_server_ids:0
Slave_IO_State
Slave_IO_Running
STOP SLAVE
Slave_SQL_Running
Last_IO_Error
Seconds_Behind_Master
Seconds_Behind_Master
slave_net_timeout
Seconds_Behind_Master
Seconds_Behind_Master
SHOW SLAVE STATUS
Master_Log_file
Relay_Master_Log_File
Relay_Log_File
SHOW PROCESSLIST
Command
MySQL的> SHOW PROCESSLIST \G;
***************************四。行***************************编号:10用户:根主持人:slave1:58371分贝:nullcommand:binlog转储时间:777状态:已发送的所有binlog奴隶;等待binlog要更新信息:空
--report-host
SHOW SLAVE
HOSTS
--report-host
MySQL的> SHOW SLAVE HOSTS;
----------- -------- ------ ------------------- ----------- | server_id |主机|港口| rpl_recovery_rank | master_id | ----------- -------- ------ ------------------- ----------- | 10 | slave1 | 3306 | 0 | 1 | ----------- -------- ------ ------------------- ----------- 1行集(0秒)
STOP SLAVE
START SLAVE
STOP SLAVE
MySQL的> STOP SLAVE;
mysql>STOP SLAVE IO_THREAD;
mysql>STOP SLAVE SQL_THREAD;
START
SLAVE
MySQL的> START SLAVE;
mysql>START SLAVE IO_THREAD;
mysql>START SLAVE SQL_THREAD;
SELECT
MIXED
binlog_format
SYSTEM_VARIABLES_ADMIN
SUPER
binlog_format
INSERT
DELETE
UPDATE
REPLACE
DELETE
UPDATE
ORDER BY
SELECT ... FOR
UPDATE
SELECT ... FOR
SHARE
SKIP LOCKED
NOW()
[Warning] Statement is not safe to log in statement format.
SHOW WARNINGS
INSERT ...
SELECT
UPDATE
NOW()
mysql
GRANT
REVOKE
CREATE TABLE
... SELECT
INSERT
UPDATE
DELETE
binlog_row_image=minimal
BLOB
BLOB
--base64-output=DECODE-ROWS
--verbose
binlog_rows_query_log_events
-vv
MyISAM
INSERT
MyISAM
CREATE TEMPORARY TABLE
DROP TEMPORARY TABLE IF EXISTS
DROP TEMPORARY TABLE IF EXISTS
binlog_format=ROW
BINLOG
--base64-output=DECODE-ROWS
--verbose
slave_exec_mode
slave_exec_mode
slave_exec_mode
slave_exec_mode=IDEMPOTENT
slave_exec_mode
IGNORE_SERVER_IDS
CHANGE MASTER TO
GTID_MODE=ON
@@server_id <>
id_value
UPDATE
DELETE
WHERE @@server_id <> 1
server_id
--replicate-do-db
--replicate-ignore-db
--replicate-rewrite-db
--replicate-do-table
--replicate-ignore-table
InnoDB
STOP SLAVE
STOP SLAVE
SQL_THREAD
binlog_format
ER_BINLOG_UNSAFE_STATEMENT
N
S
FOUND_ROWS()
GET_LOCK()
IS_FREE_LOCK()
IS_USED_LOCK()
LOAD_FILE()
MASTER_POS_WAIT()
RAND()
RELEASE_LOCK()
ROW_COUNT()
SESSION_USER()
SLEEP()
SYSDATE()
SYSTEM_USER()
USER()
UUID()
UUID_SHORT()
CONNECTION_ID()
CURDATE()
CURRENT_DATE()
CURRENT_TIME()
CURRENT_TIMESTAMP()
CURTIME()
LAST_INSERT_ID()
LOCALTIME()
LOCALTIMESTAMP()
NOW()
UNIX_TIMESTAMP()
UTC_DATE()
UTC_TIME()
UTC_TIMESTAMP()
INSERT
INSERT
... ON DUPLICATE KEY UPDATE
LOAD DATA
INFILE
binlog_format=mixed
binlog_format=statement
LOAD DATA
INFILE
binlog_format=STATEMENT
binlog_format=MIXED
binlog_format=ROW
SHOW
PROCESSLIST
START SLAVE
Binlog Dump
Slave_IO_running
SHOW SLAVE STATUS
Slave_running
SHOW STATUS
SHOW PROCESSLIST
SHOW PROCESSLIST
SHOW
PROCESSLIST
MySQL的> SHOW PROCESSLIST\G
*************************** 1。行***************************编号:2用户:根主持人:本地:32931分贝:nullcommand:binlog转储时间:94状态:已发送的所有binlog奴隶;等待binlog要更新信息:空
Binlog Dump
Binlog Dump
SHOW
PROCESSLIST
MySQL的> SHOW PROCESSLIST\G
*************************** 1。行***************************编号:10用户:系统用户主机:数据库:nullcommand:连接时间:11状态:等待主人发送事件信息:空*************************** 2。行***************************编号:11用户:系统用户主机:数据库:nullcommand:连接时间:11状态:已阅读所有中继日志;等待Slave I/O线程更新信息:空
State
SHOW PROCESSLIST
Time
Binlog
Dump
net_retry_count
SHOW SLAVE STATUS
""
FOR CHANNEL
channel
channel
group_replication_recovery
FOR
CHANNEL
channel
START SLAVE
STOP SLAVE
SHOW SLAVE STATUS
FLUSH RELAY LOGS
RESET
SLAVE
RESET SLAVE
FOR CHANNEL
channel
TABLE
ER_SLAVE_NEW_CHANNEL_WRONG_REPOSITORY
TABLE
--master-info-repository
TABLE
ER_SLAVE_NEW_CHANNEL_WRONG_REPOSITORY
TABLE
--max-relay-log-size=
size
--relay-log-space-limit=
size
N
relay_log_space_limit *
N
--slave-parallel-workers=
value
--slave-checkpoint-group
--relay-log-index=filename
--relay-log=filename
--slave_net-timeout=N
N
--slave-skip-counter=N
N
group_replication_applier
group_replication_recovery
relay_log_basename
-channel
.xxxxxxrelay_log_basename
--relay-log
channel
--relay-log
mysql.slave_master_info
mysql.slave_relay_log_info
slave_master_info
slave_master_info
mysql.slave_master_info
InnoDB
--relay-log-recovery
host_name
-relay-bin.nnnnnn
host_name
nnnnnn
host_name
-relay-bin-channel
channel
host_name
-relay-bin.indexhost_name
channel
--relay-log
--relay-log-index
--relay-log
--relay-log-index
shell>cat
shell>new_relay_log_name
.index >>old_relay_log_name
.indexmv
old_relay_log_name
.indexnew_relay_log_name
.index
FLUSH LOGS
max_relay_log_size
max_relay_log_size
max_binlog_size
FLUSH LOGS
InnoDB
slave_master_info
SHOW SLAVE
STATUS
--master-info-repository=TABLE
--relay-log-info-repository=TABLE
relay-log.info
--master-info-file
--relay-log-info-file
mysql.slave_master_info
InnoDB
--relay-log-recovery
mysql.slave_worker_info
replication_applier_status_by_worker
mysql.slave_master_info
SHOW SLAVE STATUS
slave_master_info | SHOW SLAVE STATUS | master.info | |
---|---|---|---|
Number_of_lines | |||
Master_log_name | Master_Log_File | ||
Master_log_pos | Read_Master_Log_Pos | ||
Host | Master_Host | ||
User_name | Master_User | ||
User_password | SHOW SLAVE STATUS | ||
Port | Master_Port | ||
Connect_retry | Connect_Retry | ||
Enabled_ssl | Master_SSL_Allowed | ||
Ssl_ca | Master_SSL_CA_File | ||
Ssl_capath | Master_SSL_CA_Path | ||
Ssl_cert | Master_SSL_Cert | ||
Ssl_cipher | Master_SSL_Cipher | ||
Ssl_key | Master_SSL_Key | ||
Ssl_verify_server_cert | Master_SSL_Verify_Server_Cert | ||
Heartbeat | |||
Bind | Master_Bind | ||
Ignored_server_ids | Replicate_Ignore_Server_Ids | Ignored_server_ids | |
Uuid | Master_UUID | ||
Retry_count | Master_Retry_Count | ||
Ssl_crl | |||
Ssl_crl_path | |||
Enabled_auto_position | Auto_position | ||
Channel_name | Channel_name | ||
Tls_Version | Master_TLS_Version | ||
Master_public_key_path | Master_public_key_path | ||
Get_master_public_key | Get_master_public_key |
mysql.slave_relay_log_info
SHOW SLAVE
STATUS
slave_relay_log_info | SHOW SLAVE STATUS | relay-log.info | |
---|---|---|---|
Number_of_lines | |||
Relay_log_name | Relay_Log_File | ||
Relay_log_pos | Relay_Log_Pos | ||
Master_log_name | Relay_Master_Log_File | ||
Master_log_pos | Exec_Master_Log_Pos | ||
Sql_delay | SQL_Delay | ||
Number_of_workers | |||
Id | |||
Channel_name |
mysql.slave_master_info
CHANGE MASTER TO
MASTER_LOG_POS
--binlog-do-db
--binlog-ignore-db
--replicate-*
CHANGE REPLICATION FILTER
CHANGE REPLICATION
FILTER
--replicate-*
--replicate-do-db
--replicate-ignore-db
CREATE DATABASE
DROP DATABASE
ALTER DATABASE
--replicate-wild-do-table
--replicate-wild-do-table
--replicate-rewrite-db
lower_case_table_names
--replicate-do-db
--replicate-ignore-db
--binlog-do-db
--binlog-ignore-db
USE
binlog_format=ROW
USE
--replicate-do-db
--replicate-ignore-db
--binlog-do-db
--binlog-ignore-db
USE
--binlog-do-db
--binlog-ignore-db
CREATE
DATABASE
ALTER
DATABASE
DROP
DATABASE
--binlog-do-db
--binlog-do-db=sales
sales
UPDATE mytable SET mycol =
1
--replicate-do-table
--replicate-wild-do-table
--replicate-ignore-table
--replicate-wild-ignore-table
--replicate-do-table
--replicate-ignore-table
--replicate-wild-do-table
--replicate-wild-ignore-table
--replicate-do-table
--replicate-wild-do-table
--replicate-do-table
--replicate-wild-do-table
--replicate-ignore-table
--replicate-wild-ignore-table
binlog_format=ROW
--replicate-* | |
--replicate-*-db | |
--replicate-*-table | |
mytbl1
mytbl2
replicate-ignore-db = db1 replicate-do-table = db2.tbl2
USE db1; INSERT INTO db2.tbl2 VALUES (1);
USE
--replicate-ignore-db
INSERT
USE
--replicate-ignore-db
INSERT
--replicate-do-table
group_replication_applier
do_db
CHANGE REPLICATION FILTER
--replicate-*
filter_type
=channel_name
filter_details
channel_2
--replicate-do-db=db1
--replicate-do-db=channel_1:db2
--replicate-do-db=db3
--replicate-ignore-db=db4
--replicate-ignore-db=channel_2:db5
replication_applier_global_filters
replication_applier_filters
channel
--replicate-do-db=
channel
:database_id
--replicate-ignore-db=
channel
:database_id
--replicate-do-table=
channel
:table_id
--replicate-ignore-table=
channel
:table_id
--replicate-rewrite-db=
channel
:db1-db2
--replicate-wild-do-table=
channel
:table
regexid
--replicate-wild-ignore-table=
channel
:table
regexid
channel
--replicate-do-db=:
database_id
channel
--replicate-do-db=
database_id
--replicate-do-db
rewrite-db=
from_name
->to_name
from_name
--replicate-*
CHANGE REPLICATION FILTER
channel
CHANGE REPLICATION FILTER REPLICATE_DO_DB=(db1) FOR CHANNEL channel_1;
FOR CHANNEL
do_ignore_table
FOR
CHANNEL
REPLICATE_REWRITE_DB
CHANGE REPLICATION FILTER REPLICATE_REWRITE_DB=() FOR CHANNEL channel_1;
REPLICATE_REWRITE_DB
CHANGE REPLICATION FILTER
RESET SLAVE
ALL
shell> mysqladmin stop-slave
shell> mysql -e 'STOP SLAVE SQL_THREAD;'
shell> mysqldump --all-databases > fulldb.dump
shell> mysqladmin start-slave
InnoDB
shell> mysqladmin shutdown
shell> tar cf /tmp/dbbackup.tar ./data
shell> mysqld_safe &
C:\> "C:\Program Files\MySQL\MySQL Server 8.0\bin\mysqld"
relay-log.info
CHANGE MASTER
TO
MASTER_LOG_POS
LOAD DATA
INFILE
LOAD DATA
INFILE
--slave-load-tmpdir
tmpdir
read_only
read_only
mysql>FLUSH TABLES WITH READ LOCK;
mysql>SET GLOBAL read_only = ON;
mysql>SET GLOBAL read_only = OFF;
mysql>UNLOCK TABLES;
mysql>FLUSH TABLES WITH READ LOCK;
mysql>SET GLOBAL read_only = ON;
mysql>SET GLOBAL read_only = OFF;
mysql>UNLOCK TABLES;
InnoDB
relay_log_info_repository
master_info_repository
mysql.slave_master_info
FILE
mysql.slave_relay_log_info
mysql.slave_relay_log_info
relay_log_recovery
MASTER_AUTO_POSITION
relay_log_recovery=1
relay_log_info_repository
sync_binlog=1
relay_log_recovery=1
relay_log_info_repository=TABLE
| |||||||
---|---|---|---|---|---|---|---|
MASTER_AUTO_POSITION
relay_log_recovery=1
relay_log_info_repository
relay_log_recovery=1
sync_relay_log=1
relay_log_info_repository=TABLE
sync_relay_log=1
sync_relay_log=1
relay_log_recovery=0
relay_log_recovery=1
events_stages_current
mysql>UPDATE performance_schema.setup_instruments SET ENABLED = 'YES'
->WHERE NAME LIKE 'stage/sql/Applying batch of row changes%';
events_stages_current
mysql>SELECT WORK_COMPLETED, WORK_ESTIMATED FROM performance_schema.events_stages_current
->WHERE EVENT_NAME LIKE 'stage/sql/Applying batch of row changes (update)'
binlog_rows_query_log_events
mysql>SELECT db, processlist_state, processlist_info FROM performance_schema.threads
->WHERE processlist_state LIKE 'stage/sql/Applying batch of row changes%' AND thread_id = N;
default_storage_engine
InnoDB
Archive
--skip-federated
MyISAM
NO_ENGINE_SUBSTITUTION
ALTER
TABLE
mysql> STOP SLAVE;
ALTER TABLE ...
ENGINE='
engine_type
'
mysql> START SLAVE;
default_storage_engine
CREATE
TABLE
ALTER TABLE
MySQL的> ALTER TABLE csvtable Engine='MyISAM';
MyISAM
default_storage_engine
MySQL的> CREATE TABLE tablea (columna int) Engine=MyISAM;
mysql>SET default_storage_engine=MyISAM;
mysql>CREATE TABLE tablea (columna int);
default_storage_engine
CREATE
TABLE
safe_writer_connect()
safe_reader_connect()
safe_reader_statement()
safe_writer_statement()
safe_
--replicate-wild-do-table
--replicate-do-db
--replicate-do-db
START SLAVE
--replicate-wild-do-table=databaseA.%
--replicate-wild-do-table=databaseB.%
--replicate-wild-do-table=databaseC.%
--replicate-wild-do-table
InnoDB
innodb_file_per_table
--log-slave-updates
--relay-log
rpl_read_size
MyISAM
--log-slave-updates
CHANGE MASTER TO
--log-bin
--skip-log-slave-updates
MySQL Master
Web Client
Slave 1
Slave 3
--skip-log-slave-updates
--skip-log-slave-updates
Slave 1
Slave 1
Slave 3
--skip-log-slave-updates
--log-slave-updates
Slave 2
Slave 1
Master
STOP SLAVE
IO_THREAD
SHOW PROCESSLIST
Slave 1
STOP SLAVE
RESET MASTER
Slave 2
STOP SLAVE
CHANGE MASTER TO MASTER_HOST='Slave1'
'Slave1'
CHANGE MASTER
TO
Slave 2
user
password
port
Slave 1
START SLAVE
Slave 3
Web Client
Web Client
Slave
1
Master
Master
Master
CHANGE
MASTER TO
Slave 3
S1ave
1
Master
Master
RESET MASTER
Slave
1
Slave
3
Web
Client
bind
[mysqld]
[mysqld] ssl-ca=cacert.pem ssl-cert=server-cert.pem ssl-key=server-key.pem
--ssl-ca
--ssl-cert
--ssl-key
CHANGE MASTER TO
my.cnf
CHANGE MASTER
TO
CHANGE MASTER TO
[client]
[client] ssl-ca=cacert.pem ssl-cert=client-cert.pem ssl-key=client-key.pem
--skip-slave-start
CHANGE MASTER TO
mysql>CHANGE MASTER TO
->MASTER_HOST='master_hostname',
->MASTER_USER='repl',
->MASTER_PASSWORD='
->password
',MASTER_SSL=1;
MASTER_SSL=1
xxx
--ssl-mode=REQUIRED
MASTER_SSL=1
--ssl-mode=PREFERRED
MASTER_SSL=0
--ssl-mode=DISABLED
CHANGE MASTER TO
MASTER_SSL_
xxx
-> MASTER_SSL_CA = 'ca_file_name',
-> MASTER_SSL_CAPATH = 'ca_directory_name',
-> MASTER_SSL_CERT = 'cert_file_name',
-> MASTER_SSL_KEY = 'key_file_name',
--ssl-
xxx
MASTER_SSL=1
MASTER_SSL_CAPATH
--ssl-mode=VERIFY_CA
MASTER_SSL_VERIFY_SERVER_CERT
-> MASTER_SSL_VERIFY_SERVER_CERT=1,
--ssl-verify-server-cert
MASTER_SSL_VERIFY_SERVER_CERT=1
--ssl-mode=VERIFY_IDENTITY
MASTER_SSL=1
MASTER_SSL_CRL
->MASTER_SSL_CRL = 'crl_file_name',
->MASTER_SSL_CRLPATH = 'crl_directory_name',
--ssl-
xxx
MASTER_SSL_CIPHER
->MASTER_SSL_CIPHER = 'cipher_list',
->MASTER_TLS_VERSION = 'protocol_list',
MASTER_TLS_VERSION
tls_version
mysql> START SLAVE;
SHOW SLAVE
STATUS
REQUIRE SSL
REPLICATION SLAVE
MySQL的> CREATE USER 'repl'@'%.example.com' IDENTIFIED BY '
password
'-> REQUIRE SSL;
MySQL的> GRANT REPLICATION SLAVE ON *.*
-> TO 'repl'@'%.example.com';
REQUIRE SSL
MySQL的> ALTER USER 'repl'@'%.example.com' REQUIRE SSL;
rpl_semi_sync_master_wait_for_slave_count
START
TRANSACTION
SET autocommit =
0
rpl_semi_sync_master_wait_for_slave_count
rpl_semi_sync_master_wait_point
AFTER_SYNC
AFTER_COMMIT
AFTER_SYNC
AFTER_COMMIT
rpl_semi_sync_master_enabled
rpl_semi_sync_
xxx
Rpl_semi_sync_
xxx
INSTALL PLUGIN
have_dynamic_loading
INSTALL PLUGIN
SET
GLOBAL
STOP SLAVE
START SLAVE
REPLICATION_SLAVE_ADMIN
SUPER
plugin_dir
plugin_dir
semisync_master
.so
INSTALL
PLUGIN
INSTALL PLUGIN rpl_semi_sync_master SONAME 'semisync_master.so';
INSTALL PLUGIN rpl_semi_sync_slave SONAME 'semisync_slave.so';
libimf
MySQL的> INSTALL PLUGIN rpl_semi_sync_master SONAME 'semisync_master.so';
错误1126(hy000):不能打开共享库的/usr/local MySQL / lib /插件/ semisync_master。所以(errno:22 libimf.so:不能打开共享对象文件:没有这样的文件或目录)
libimf
SHOW PLUGINS
INFORMATION_SCHEMA.PLUGINS
INFORMATION_SCHEMA.PLUGINS
SHOW PLUGINS
mysql>SELECT PLUGIN_NAME, PLUGIN_STATUS
FROM INFORMATION_SCHEMA.PLUGINS
WHERE PLUGIN_NAME LIKE '%semi%';
+----------------------+---------------+ | PLUGIN_NAME | PLUGIN_STATUS | +----------------------+---------------+ | rpl_semi_sync_master | ACTIVE | +----------------------+---------------+
SET
GLOBAL
SET GLOBAL rpl_semi_sync_master_enabled = {0|1};
SET GLOBAL rpl_semi_sync_master_timeout = N
;
SET GLOBAL rpl_semi_sync_slave_enabled = {0|1};
rpl_semi_sync_master_enabled
rpl_semi_sync_slave_enabled
rpl_semi_sync_master_timeout
N
STOP SLAVE IO_THREAD; START SLAVE IO_THREAD;
my.cnf
[mysqld] rpl_semi_sync_master_enabled=1 rpl_semi_sync_master_timeout=1000 # 1 second
[mysqld] rpl_semi_sync_slave_enabled=1
SHOW
VARIABLES
MySQL的> SHOW VARIABLES LIKE 'rpl_semi_sync%';
SHOW STATUS
MySQL的> SHOW STATUS LIKE 'Rpl_semi_sync%';
Rpl_semi_sync_master_status
rpl_semi_sync_master_enabled
Rpl_semi_sync_master_status
Rpl_semi_sync_master_clients
Rpl_semi_sync_master_yes_tx
Rpl_semi_sync_master_no_tx
Rpl_semi_sync_slave_status
immediate_commit_timestamp
CHANGE MASTER TO MASTER_DELAY=N
N
N
anonymous_gtid_log_event
START SLAVE
STOP SLAVE
RESET
SLAVE
replication_applier_configuration
MASTER_DELAY
replication_applier_status
original_commit_timestamp
immediate_commit_timestamp
TIMESTAMP
#170404 10:48:05 server id 1 end_log_pos 233 CRC32 0x016ce647 GTID last_committed=0 \ sequence_number=1 original_committed_timestamp=1491299285661130 immediate_commit_timestamp=1491299285843771# original_commit_timestamp=1491299285661130 (2017-04-04 10:48:05.661130 WEST)# immediate_commit_timestamp=1491299285843771 (2017-04-04 10:48:05.843771 WEST) /*!80001 SET @@session.original_commit_timestamp=1491299285661130*//*!*/; SET @@SESSION.GTID_NEXT= 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa:1'/*!*/;# at 233
original_commit_timestamp
immediate_commit_timestamp
immediate_commit_timestamp
original_commit_timestamp
immediate_commit_timestamp
original_commit_timestamp
Seconds_Behind_Master
immediate_commit_timestamp
replication_connection_status
replication_applier_status_by_coordinator
replication_applier_status_by_worker
original_commit_timestamp
SHOW SLAVE STATUS
SQL_Delay
CHANGE MASTER TO MASTER_DELAY=N
SQL_Remaining_Delay
Waiting until MASTER_DELAY seconds after master
executed event
Slave_SQL_Running_State
State
SHOW
PROCESSLIST
SHOW
PROCESSLIST
Waiting until MASTER_DELAY seconds after
master executed event
InnoDB
AUTO_INCREMENT
LAST_INSERT_ID()
TIMESTAMP
AUTO_INCREMENT
INSERT
InnoDB
AUTO_INCREMENT
ALTER TABLE
AUTO_INCREMENT
col1
t2
AUTO_INCREMENT
创建表T2像T1 T2;修改表添加ID int auto_increment主键;插入T2 SELECT * FROM T1的col1,col2;
ORDER BY
t1
CREATE
TABLE ... LIKE
INDEX DIRECTORY
CREATE
TABLE
AUTO_INCREMENT
AUTO_INCREMENT
降T1;表重命名T1 T2;
BLACKHOLE
BLACKHOLE
binlog_format
ROW
character_set_server
CREATE
TABLE
CREATE TABLE
CREATE SERVER
ALTER SERVER
DROP SERVER
CREATE ... IF
NOT EXISTS
CREATE
DATABASE IF NOT EXISTS
CREATE TABLE
IF NOT EXISTS
SELECT
CREATE
TABLE IF NOT EXISTS ... LIKE
CREATE
TABLE IF NOT EXISTS ... SELECT
CREATE EVENT
IF NOT EXISTS
CREATE
TABLE ... SELECT
IF NOT
EXISTS
STATEMENT
ROW
CREATE TABLE
CREATE
TABLE ... SELECT
IF NOT
EXISTS
CREATE
TABLE ... SELECT
CREATE TABLE
CREATE
TABLE ... SELECT
CURRENT_USER()
CURRENT_USER()
CURRENT_USER
ALTER
TABLE
t
CREATE TABLE
创建表(C1 C2 C3 int,int,int);
ALTER
TABLE
修改表添加列在C3 cnew1 int;
ALTER TABLE
c2
t
ALTER
TABLE
修改表添加列在C2 cnew2 int;
ALTER TABLE
t
DEFAULT
master>CREATE TABLE t1 (c1 INT, c2 INT, c3 INT);
slave>CREATE TABLE t1 (c1 INT, c2 INT);
master>CREATE TABLE t1 (c1 INT, c2 INT, c3 INT);
slave>CREATE TABLE t1 (c2 INT, c1 INT);
master>CREATE TABLE t1 (c3 INT, c1 INT, c2 INT);
slave>CREATE TABLE t1 (c1 INT, c2 INT);
master>CREATE TABLE t1 (c1 INT, c2 INT);
slave>CREATE TABLE t1 (c1 INT, c2 INT, c3 INT);
master>CREATE TABLE t1 (c1 INT, c2 INT);
slave>CREATE TABLE t1 (c2 INT, c1 INT, c3 INT);
master>CREATE TABLE t1 (c1 INT, c2 INT);
slave>CREATE TABLE t1 (c3 INT, c1 INT, c2 INT);
c2
硕士 CREATE TABLE t1 (c1 INT, c2 BIGINT);
奴隶 CREATE TABLE t1 (c1 INT, c2 INT, c3 INT);
CHAR(10)
CHAR(10)
TINYINT
TINYINT
TINYINT
slave_type_conversions
INT
TINYINT
ALL_LOSSY
ALL_LOSSY
TINYINT
VARCHAR(20)
slave_type_conversions
ALL_SIGNED
ALL_SIGNED
ALL_SIGNED
ALL_LOSSY
slave_type_conversions
TINYINT
SMALLINT
MEDIUMINT
INT
BIGINT
TINYINT
UNSIGNED
TINYINT
DECIMAL
FLOAT
DOUBLE
NUMERIC
FLOAT
DOUBLE
DECIMAL(
M
,D
)M'
D'
D'
>=D
M'
D'
) >= (M
D
M'
<M
D'
<D
CHAR
VARCHAR
TEXT
CHAR
TEXT
VARCHAR
N
N
BINARY
VARBINARY
BLOB
BINARY
BLOB
VARBINARY
N
N
BIT
BIT(
M
)M'
M'
M
M'
M
M
M'
BIT(
M
)M'
M'
<M
M'
DATA DIRECTORY
CREATE TABLE
NO_DIR_IN_CREATE
INDEX
DIRECTORY
CREATE TABLE
DROP DATABASE
IF EXISTS
DROP TABLE IF
EXISTS
DROP VIEW IF
EXISTS
DROP ... IF EXISTS
FLUSH
FLUSH LOGS
FLUSH TABLES WITH READ LOCK
FLUSH TABLES
ANALYZE TABLE
OPTIMIZE TABLE
REPAIR TABLE
mysql
GRANT
FLUSH PRIVILEGES
FLUSH TABLES
MERGE
FLUSH TABLES
LOCAL
USER()
CURRENT_USER()
CURRENT_USER
UUID()
VERSION()
LOAD_FILE()
USER()
CURRENT_USER()
STATEMENT
VERSION()
RAND()
NOW()
mytable
INSERT
MySQL的> CREATE TABLE mytable (mycol TEXT);
查询行,0行受影响(0.06秒)MySQL > INSERT INTO mytable VALUES ( NOW() );
查询行,1行的影响(0秒)MySQL > SELECT * FROM mytable;
| mycol |,意图,意图| 2009年09月01 | 12:00:00,意图在1行集(0秒)
SELECT NOW()
mytable
CREATE TABLE
INSERT
2009-09-01 18:00:00
mysql> SELECT * FROM mytable;
+---------------------+
| mycol |
+---------------------+
| 2009-09-01 12:00:00 |
+---------------------+
1 row in set (0.00 sec)
NOW()
SYSDATE()
--sysdate-is-now
SYSDATE()
NOW()
--sysdate-is-now
SYSDATE()
STATEMENT
GET_LOCK()
RELEASE_LOCK()
IS_FREE_LOCK()
IS_USED_LOCK()
MIXED
INSERT
UUID()
插入T值(uuid());
SET @my_uuid = UUID(); INSERT INTO t VALUES(@my_uuid);
@my_uuid
INSERT
INSERT
SET @my_uuid1 = UUID(); @my_uuid2 = UUID(); INSERT INTO t VALUES(@my_uuid1),(@my_uuid2);
INSERT INTO t2 SELECT UUID(), * FROM t1;
RAND()
FOUND_ROWS()
ROW_COUNT()
INSERT
SELECT SQL_CALC_FOUND_ROWS FROM mytable LIMIT 1; INSERT INTO mytable VALUES( FOUND_ROWS() );
mytable
SELECT
... INTO
从表1 sql_calc_found_rows选择限制为“found_rows;插入表值(@ found_rows);
MIXED
TIME
DATETIME
TIMESTAMP
CREATE TABLE
fsp
fsp
CREATE EVENT
ALTER EVENT
SLAVESIDE_DISABLED
DROP EVENT
ORIGINATOR
INFORMATION_SCHEMA.EVENTS
mysql.event
INFORMATION_SCHEMA.EVENTS
SELECT EVENT_SCHEMA, EVENT_NAME FROM INFORMATION_SCHEMA.EVENTS WHERE STATUS = 'SLAVESIDE_DISABLED';
SHOW
EVENTS
SHOW EVENTS WHERE STATUS = 'SLAVESIDE_DISABLED';
ALTER EVENT
event_name
ENABLEevent_name
master_id
EVENTS
SELECT EVENT_SCHEMA, EVENT_NAME, ORIGINATOR
FROM INFORMATION_SCHEMA.EVENTS
WHERE STATUS = 'SLAVESIDE_DISABLED'
AND ORIGINATOR = 'master_id
'
ORIGINATOR
SHOW EVENTS
SHOW EVENTS WHERE STATUS = 'SLAVESIDE_DISABLED' AND ORIGINATOR = 'master_id
'
SET GLOBAL event_scheduler =
OFF;
ALTER
EVENT
SET GLOBAL event_scheduler = ON;
ALTER EVENT
SELECT
ALTER EVENT
EVENTS
SELECT CONCAT(EVENT_SCHEMA, '.', EVENT_NAME) AS 'Db.Event' FROM INFORMATION_SCHEMA.EVENTS WHERE INSTR(EVENT_NAME, 'replicated_') = 1;
binlog_row_value_options=PARTIAL_JSON
binlog_row_value_options
LIMIT
DELETE
UPDATE
INSERT ...
SELECT
STATEMENT
STATEMENT
ORDER BY
MIXED
LOAD DATA
INFILE
binlog_format=MIXED
binlog_format=STATEMENT
LOAD DATA
INFILE
LOAD DATA
INFILE
LOAD DATA
INFILE
max_allowed_packet
TEXT
BLOB
max_allowed_packet
max_allowed_packet
max_allowed_packet
slave_parallel_workers > 0
slave_pending_jobs_size_max
max_allowed_packet
slave_pending_jobs_size_max
max_allowed_packet
max_allowed_packet
max_allowed_packet
max_allowed_packet
slave_max_allowed_packet
slave_pending_jobs_size_max
slave_pending_jobs_size_max
slave_pending_jobs_size_max
slave_pending_jobs_size_max
MEMORY
MEMORY
DELETE
MEMORY
Can't find record in
'
memory_table
'
INSERT INTO
... SELECT FROM
memory_table
MEMORY
MEMORY
binlog_format=ROW
slave_exec_mode=IDEMPOTENT
MEMORY
MEMORY
MEMORY
slave_exec_mode=IDEMPOTENT
MEMORY
MEMORY
max_heap_table_size
max_heap_table_size
ALTER TABLE
... ENGINE = MEMORY
TRUNCATE
TABLE
MEMORY
max_heap_table_size
MEMORY
mysql
binlog_format
GRANT
REVOKE
DELETE
UPDATE
ORDER BY
ALTER
TABLE ... DROP PARTITION
REPAIR TABLE
REPAIR TABLE
REPAIR TABLE
rank
--replicate-do-db
--replicate-do-table
--replicate-ignore-db
--replicate-ignore-table
ALTER TABLE
`
mysql
HELP
fill_help_tables.sql
share/mysql
root
fill_help_tables.sql
mysql mysql < fill_help_tables.sql
url
help_topic
TEXT
SELECT TABLE_NAME, COLUMN_NAME, COLUMN_TYPEFROM INFORMATION_SCHEMA.COLUMNSWHERE TABLE_SCHEMA = 'mysql'AND COLUMN_NAME = 'url';
+---------------+-------------+-------------+ | TABLE_NAME | COLUMN_NAME | COLUMN_TYPE | +---------------+-------------+-------------+ | help_category | url | char(128) | | help_topic | url | char(128) | +---------------+-------------+-------------+
+---------------+-------------+-------------+ | TABLE_NAME | COLUMN_NAME | COLUMN_TYPE | +---------------+-------------+-------------+ | help_category | url | text | | help_topic | url | text | +---------------+-------------+-------------+
mysql mysql < fill_help_tables.sql
--init-command
SET sql_log_bin=0; ALTER TABLE mysql.help_category ALTER COLUMN url TEXT; ALTER TABLE mysql.help_topic ALTER COLUMN url TEXT;
mysql mysql < fill_help_tables.sql
CHANGE MASTER TO
slave_net_timeout
slave_net_timeout
sync_binlog=1
InnoDB
innodb_flush_log_at_trx_commit=1
relay-log.info
relay-log.info
sync_relay_log_info=1
sync_relay_log_info
SHOW SLAVE STATUS
START
SLAVE
--slave-skip-errors
MyISAM
MyISAM
INSERT
UPDATE
MyISAM
INSERT
binlog_format
MIXED
binlog_format
STOP SLAVE SQL_THREAD
SHOW STATUS
Slave_open_temp_tables
START SLAVE SQL_THREAD
--replicate-do-db
--replicate-do-table
--replicate-wild-do-table
--replicate-ignore-table
--replicate-wild-ignore-table
--replicate-wild-ignore-table
norepmytable
--replicate-wild-ignore-table=norep%
slave_transaction_retries
InnoDB
innodb_lock_wait_timeout
NDB
TransactionInactiveTimeout
slave_transaction_retries
SHOW STATUS
NOW()
FROM_UNIXTIME()
--timezone=
timezone_name
TZ
slave_preserve_commit_order=1
slave_parallel_type=LOGICAL_CLOCK
log_bin
--log-slave-updates
Exec_master_log_pos
N
N.
slave_preserve_commit_order
KILL
STOP SLAVE
STOP
SLAVE
STOP SLAVE
KILL
STOP SLAVE
STOP SLAVE
STOP SLAVE
STOP SLAVE
STOP SLAVE
rpl_stop_slave_timeout
STOP
SLAVE
Exec_master_log_pos
SHOW SLAVE STATUS
CHANGE MASTER TO
CHANGE
MASTER TO
--relay-log-recovery
--dump-slave
CHANGE MASTER TO
Exec_master_log_pos
--dump-slave
mysql.slave_worker_info
START SLAVE
[SQL_THREAD]
slave_parallel_workers
START
SLAVE
START
SLAVE
START SLAVE UNTIL
SQL_AFTER_MTS_GAPS
START SLAVE
RESET SLAVE
RESET SLAVE
slave-preserve-commit-order
Exec_master_log_pos
slave-preserve-commit-order
binlog_direct_non_transactional_updates
ON
binlog_direct_non_transactional_updates
binlog_direct_non_transactional_updates
ROLLBACK
InnoDB
BEGIN
COMMIT
BEGIN
MyISAM
InnoDB
AUTOCOMMIT=1
binlog_format
binlog_checksum
autocommit
BEGIN
COMMIT
ROLLBACK
MyISAM
AUTO_INCREMENT
INSERT
UPDATE
DELETE
AFTER
.TRG
.TRG
NEW
OUT
TRUNCATE TABLE
MIXED
MIXED
InnoDB
READ UNCOMMITTED
TRUNCATE TABLE
InnoDB
STATEMENT
MIXED
sql_mode
NO_DIR_IN_CREATE
NO_DIR_IN_CREATE
SET @@sql_mode =
mode
mode
NO_DIR_IN_CREATE
default_storage_engine
read_only
SET PASSWORD
max_heap_table_size
INSERT
MEMORY
SET max_join_size=1000; INSERT INTO mytable VALUES(@@max_join_size);
SET time_zone=...; INSERT INTO mytable VALUES(CONVERT_TZ(..., ..., @@time_zone));
lower_case_table_names
lower_case_table_names
STRICT_TRANS_TABLES
STRICT_ALL_TABLES
binlog_format=STATEMENT
binlog_format=ROW
utf8mb4
my.cnf
[mysqld]character_set_server=latin1collation_server=latin1_swedish_ci
--skip-slave-start
ALTER TABLE
SET sql_log_bin =
0
--skip-log-bin
--skip-networking
sql_log_bin
SET sql_log_bin = 1
--skip-log-bin
--skip-networking
--skip-slave-start
gtid_mode=ON
gtid_mode=ON
SHOW MASTER STATUS
--skip-log-bin
--server-id
SHOW SLAVE STATUS
Slave_SQL_Running
--skip-slave-start
START SLAVE
SHOW
PROCESSLIST
Connecting to master
3306
skip-networking
ping
tracert
START
SLAVE
mysql>SET GLOBAL sql_slave_skip_counter =
mysql>N
;START SLAVE;
N
LAST_INSERT_ID()
LAST_INSERT_ID()
log_bin
--log-slave-updates
SHOW MASTER
STATUS
SHOW SLAVE
STATUS
log_file
log_pos
Read_Master_Log_Pos
SHOW SLAVE STATUS
内核> mysqlbinlog --start-position=
log_pos
log_file
| head