学向勤中得,萤窗万卷书。这篇文章主要讲述mysql5.7.23主从安装部署,并开启GTID相关的知识,希望能为你提供帮助。
安装依赖
下载安装包
wget https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.23-linux-glibc2.12-x86_64.tar.gz
安装依赖
yum -y install -y perl-Digest-MD5 pcre pcre-devel perl perl-devel libaio libaio-devel perl-Time-HiRes perl-DBD-MySQL gcc gcc-c++ kernel-devel ncurses-devel bison cmakelrzsz lsof sysstat libaio numactl libtool iftop iotop sysstat glib2-devel mysql-devel zlib-devel pcre-devel openssl-devel
yum install epel-release -y解压mysql的tar包 tar -xvfmysql-5.7.23-linux-glibc2.12-x86_64.tar.gz-C /opt/mvmysql-5.7.23-linux-glibc2.12mysql
主库的my.cnf配置
[client]
port=3306
socket=/data/mysql/data/mysql.sock[mysqldump]
max_allowed_packet=1G
default_character_set=utf8mb4[mysql]
no-auto-rehash
default_character_set=utf8mb4
prompt=[\\\\u@\\\\h][\\\\d]>
\\\\_[mysqldump]
quick
max_allowed_packet=128M[mysqld]
port=3306
basedir=/opt/mysql
datadir=/data/mysql/data
socket=/data/mysql/data/mysql.sock
pid_file=/data/mysql/data/mysql.pid
log_bin=/data/mysql/binlog/mysql-bin-2-76
log_bin_index=/data/mysql/binlog/mysql-bin-10-102.index
tmpdir=/data/mysql/tmp
log_error=/data/mysql/data/error.log
slow_query_log_file=/data/mysql/slowlog/slow.log
relay_log=/data/mysql/data/mysql-relay
plugin_dir=/opt/mysql/lib/plugin
secure_file_priv=/data/mysql/tmp#global
server-id=100
report_host=172.18.2.76
report-port=3306
character_set_server=utf8mb4
autocommit=1
read_only=0(主库是0,从库是1)
user=mysql
skip-name-resolve
skip-external-locking
lower_case_table_names=1
sql_mode="STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION,NO_ZERO_DATE,NO_ZERO_IN_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,PIPES_AS_CONCAT,ANSI_QUOTES"
interactive_timeout=1800
wait_timeout=1800
max_connections=1500
max_connect_errors=10000000
transaction_isolation=READ-COMMITTED
explicit_defaults_for_timestamp=1
read_buffer_size=1M
read_rnd_buffer_size=4M
sort_buffer_size=4M
join_buffer_size=4M
tmp_table_size=4M
max_heap_table_size=4M
table_open_cache=2048
max_allowed_packet=1G
query_cache_type=0
query_cache_size=0
slow_query_log=1
long_query_time=1
log_queries_not_using_indexes=0
log_slow_admin_statements=1
log_slow_slave_statements=1
log_throttle_queries_not_using_indexes=10
character-set-client-handshake=0
expire_logs_days=15
back_log=50
log_timestamps=SYSTEM
show_compatibility_56=on
log_error_verbosity=3#innodb
innodb_flush_log_at_trx_commit=2
innodb_numa_interleave=on
innodb_data_file_path=ibdata1:512M;
ibdata2:512M:autoextend
innodb_buffer_pool_size=6G
innodb_buffer_pool_instances=6
innodb_buffer_pool_load_at_startup=1
innodb_buffer_pool_dump_at_shutdown=1
innodb_lru_scan_depth=2048
innodb_lock_wait_timeout=60
lock_wait_timeout=60
innodb_io_capacity=5000
innodb_io_capacity_max=65536
innodb_flush_method=O_DIRECT
innodb_undo_logs=128
innodb_undo_tablespaces=4
innodb_flush_neighbors=0
innodb_log_file_size=1G
innodb_log_files_in_group=4
innodb_log_buffer_size=16M
innodb_purge_threads=4
innodb_large_prefix=1
innodb_thread_concurrency=8
innodb_print_all_deadlocks=1
innodb_strict_mode=1
innodb_write_io_threads=8
innodb_read_io_threads=8
innodb_file_per_table=1
innodb_max_dirty_pages_pct=70
innodb_open_files=65535
innodb_rollback_on_timeout=off
innodb_stats_on_metadata=https://www.songbingjia.com/android/off
innodb_undo_log_truncate=1
innodb_max_undo_log_size = 2G
table_open_cache_instances=64
innodb_autoinc_lock_mode=2#replication
slave_pending_jobs_size_max=67108864
binlog_cache_size=4M
master_info_repository=TABLE
relay_log_info_repository=TABLE
sync_binlog=1
gtid_mode=on
enforce_gtid_consistency=1
log_slave_updates
binlog_format=ROW
binlog_rows_query_log_events=1
relay_log_recovery=1
binlog_gtid_simple_recovery=1
slave-parallel-type=LOGICAL_CLOCK
slave-parallel-workers=8
slave_preserve_commit_order=1
从库的my.cnf配置
[client]
port=3306
socket=/data/mysql/data/mysql.sock[mysqldump]
max_allowed_packet=1G
default_character_set=utf8mb4[mysql]
no-auto-rehash
default_character_set=utf8mb4
prompt=[\\\\u@\\\\h][\\\\d]>
\\\\_[mysqldump]
quick
max_allowed_packet=128M[mysqld]
port=3306
basedir=/opt/mysql
datadir=/data/mysql/data
socket=/data/mysql/data/mysql.sock
pid_file=/data/mysql/data/mysql.pid
log_bin=/data/mysql/binlog/mysql-bin-2-75
log_bin_index=/data/mysql/binlog/mysql-bin-2-75.index
tmpdir=/data/mysql/tmp
log_error=/data/mysql/data/error.log
slow_query_log_file=/data/mysql/slowlog/slow.log
relay_log=/data/mysql/data/mysql-relay
plugin_dir=/opt/mysql/lib/plugin
secure_file_priv=/data/mysql/tmp#global
server-id=200
report_host=172.18.2.75
report-port=3306
character_set_server=utf8mb4
autocommit=1
user=mysql
read_only=1
skip-name-resolve
skip-external-locking
lower_case_table_names=1
sql_mode="STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION,NO_ZERO_DATE,NO_ZERO_IN_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,PIPES_AS_CONCAT,ANSI_QUOTES"
interactive_timeout=1800
wait_timeout=1800
max_connections=1500
max_connect_errors=10000000
transaction_isolation=READ-COMMITTED
explicit_defaults_for_timestamp=1
read_buffer_size=1M
read_rnd_buffer_size=4M
sort_buffer_size=4M
join_buffer_size=4M
tmp_table_size=4M
max_heap_table_size=4M
table_open_cache=2048
max_allowed_packet=1G
query_cache_type=0
query_cache_size=0
slow_query_log=1
long_query_time=1
log_queries_not_using_indexes=0
log_slow_admin_statements=1
log_slow_slave_statements=1
log_throttle_queries_not_using_indexes=10
character-set-client-handshake=0
expire_logs_days=15
back_log=50
log_timestamps=SYSTEM
show_compatibility_56=on
log_error_verbosity=3#innodb
innodb_flush_log_at_trx_commit=2
innodb_numa_interleave=on
innodb_data_file_path=ibdata1:512M;
ibdata2:512M:autoextend
innodb_buffer_pool_size=6G
innodb_buffer_pool_instances=6
innodb_buffer_pool_load_at_startup=1
innodb_buffer_pool_dump_at_shutdown=1
innodb_lru_scan_depth=2048
innodb_lock_wait_timeout=60
lock_wait_timeout=60
innodb_io_capacity=5000
innodb_io_capacity_max=65536
innodb_flush_method=O_DIRECT
innodb_undo_logs=128
innodb_undo_tablespaces=4
innodb_flush_neighbors=0
innodb_log_file_size=1G
innodb_log_files_in_group=4
innodb_log_buffer_size=16M
innodb_purge_threads=4
innodb_large_prefix=1
innodb_thread_concurrency=8
innodb_print_all_deadlocks=1
innodb_strict_mode=1
innodb_write_io_threads=8
innodb_read_io_threads=8
innodb_file_per_table=1
innodb_max_dirty_pages_pct=70
innodb_open_files=65535
innodb_rollback_on_timeout=off
innodb_stats_on_metadata=https://www.songbingjia.com/android/off
innodb_undo_log_truncate=1
innodb_max_undo_log_size = 2G
table_open_cache_instances=64
innodb_autoinc_lock_mode=2#replication
slave_pending_jobs_size_max=67108864
binlog_cache_size=4M
master_info_repository=TABLE
relay_log_info_repository=TABLE
sync_binlog=1
gtid_mode=on
enforce_gtid_consistency=1
log_slave_updates
binlog_format=ROW
binlog_rows_query_log_events=1
relay_log_recovery=1
binlog_gtid_simple_recovery=1
slave-parallel-type=LOGICAL_CLOCK
slave-parallel-workers=8
slave_preserve_commit_order=1
建mysql用户及数据存储的文件夹
useradd mysql -s /sbin/nologin
mkdir -p /data/mysql/data
mkdir -p /data/mysql/binlog/
mkdir -p /data/mysql/tmp
mkdir -p /data/mysql/slowlog
mkdir -p /data/mysql/backup/binlog_bak/
mkdir -p /data/mysql/backup/backup-db/
chown -R mysql:mysql /data/mysql
环境授权
echo \'export PATH=/opt/mysql/bin:$PATH
export LD_LIBRARY_PATH=/opt/mysql/lib:$LD_LIBRARY_PATH
export MY_BASEDIR_VERSION=/opt/mysql\' > > ~/.bashrc
source ~/.bashrc
初始化
mysqld --defaults-file=/etc/my.cnf --initialize-insecure
启动
mysqld_safe --defaults-file=/etc/my.cnf &
更改密码
mysqladmin -uroot -p password --socket=/data/mysql/data/mysql.sock (直接敲回车,因为密码是空,会要求你输入新的密码)
添加服务
[root@dbos-bigdata-meta001 ~]# cd /opt/mysql/support-files/
[root@dbos-bigdata-meta001 support-files]# cp mysql.server /etc/init.d/mysql.server
[root@dbos-bigdata-meta001 ~]# cat /etc/init.d/mysql.server
#!/bin/sh
# Copyright Abandoned 1996 TCX DataKonsult AB &
Monty Program KB &
Detron HB
# This file is public domain and comes with NO WARRANTY of any kind# MySQL daemon start/stop script.# Usually this is put in /etc/init.d (at least on machines SYSV R4 based
# systems) and linked to /etc/rc3.d/S99mysql and /etc/rc0.d/K01mysql.
# When this is done the mysql server will be started when the machine is
# started and shut down when the systems goes down.# Comments to support chkconfig on RedHat Linux
# chkconfig: 2345 64 36
# description: A very fast and reliable SQL database engine.# Comments to support LSB init script conventions
### BEGIN INIT INFO
# Provides: mysql
# Required-Start: $local_fs $network $remote_fs
# Should-Start: ypbind nscd ldap ntpd xntpd
# Required-Stop: $local_fs $network $remote_fs
# Default-Start:2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: start and stop MySQL
# Description: MySQL is a very fast and reliable SQL database engine.
### END INIT INFO
# If you install MySQL on some other places than /usr/local/mysql, then you
# have to do one of the following things for this script to work:
#
# - Run this script from within the MySQL installation directory
# - Create a /etc/my.cnf file with the following information:
#[mysqld]
#basedir=<
path-to-mysql-installation-directory>
# - Add the above to any other configuration file (for example ~/.my.ini)
#and copy my_print_defaults to /usr/bin
# - Add the path to the mysql-installation-directory to the basedir variable
#below.
#
# If you want to affect other MySQL variables, you should make your changes
# in the /etc/my.cnf, ~/.my.cnf or other MySQL configuration files.# If you change base dir, you must also change datadir. These may get
# overwritten by settings in the MySQL configuration files.basedir=/usr/mysql#修改成与my.cnf路径一至
datadir=/data/mysql/data#修改成与my.cnf路径一至# Default value, in seconds, afterwhich the script should timeout waiting
# for server start.
# Value here is overriden by value in my.cnf.
# 0 means don\'t wait at all
# Negative numbers mean to wait indefinitely
service_startup_timeout=900# Lock directory for RedHat / SuSE.
lockdir=\'/var/lock/subsys\'
lock_file_path="$lockdir/mysql"# The following variables are only set for letting mysql.server find things.# Set some defaults
mysqld_pid_file_path=/data/mysql/data/mysql.pid#修改成与my.cnf路径一至
if test -z "$basedir"
then
basedir=/usr/mysql#修改成与my.cnf路径一至
bindir=/usr/mysql/bin#修改成与my.cnf路径一至
if test -z "$datadir"
then
datadir=/data/mysql/data#修改成与my.cnf路径一至
fi
sbindir=/usr/mysql/bin#修改成与my.cnf路径一至
libexecdir=/usr/mysql/bin#修改成与my.cnf路径一至
else
bindir="$basedir/bin"
if test -z "$datadir"
then
datadir="$basedir/data"
fi
sbindir="$basedir/sbin"
libexecdir="$basedir/libexec"
fi# datadir_set is used to determine if datadir was set (and so should be
# *not* set inside of the --basedir= handler.)
datadir_set=#
# Use LSB init script functions for printing messages, if possible
#
lsb_functions="/lib/lsb/init-functions"
if test -f $lsb_functions ;
then
. $lsb_functions
else
log_success_msg()
{
echo " SUCCESS! $@"
}
log_failure_msg()
{
echo " ERROR! $@"
}
fiPATH="/sbin:/usr/sbin:/bin:/usr/bin:$basedir/bin"
export PATHmode=$1# start or stop[ $# -ge 1 ] &
&
shiftother_args="$*"# uncommon, but needed when called from an RPM upgrade action
# Expected: "--skip-networking --skip-grant-tables"
# They are not checked here, intentionally, as it is the resposibility
# of the "spec" file author to give correct arguments only.case `echo "testing\\c"`,`echo -n testing` in
*c*,-n*) echo_n=echo_c=;
;
*c*,*)echo_n=-n echo_c=;
;
*)echo_n=echo_c=\'\\c\' ;
;
esacparse_server_arguments() {
for arg do
case "$arg" in
--basedir=*)basedir=`echo "$arg" | sed -e \'s/^[^=]*=//\'`
bindir="$basedir/bin"
if test -z "$datadir_set";
then
datadir="$basedir/data"
fi
sbindir="$basedir/sbin"
libexecdir="$basedir/libexec"
;
;
--datadir=*)datadir=`echo "$arg" | sed -e \'s/^[^=]*=//\'`
datadir_set=1
;
;
--pid-file=*) mysqld_pid_file_path=`echo "$arg" | sed -e \'s/^[^=]*=//\'` ;
;
--service-startup-timeout=*) service_startup_timeout=`echo "$arg" | sed -e \'s/^[^=]*=//\'` ;
;
esac
done
}wait_for_pid () {
verb="$1"# created | removed
pid="$2"# process ID of the program operating on the pid-file
pid_file_path="$3" # path to the PID file.i=0
avoid_race_condition="by checking again"while test $i -ne $service_startup_timeout ;
docase "$verb" in
\'created\')
# wait for a PID-file to pop into existence.
test -s "$pid_file_path" &
&
i=\'\' &
&
break
;
;
\'removed\')
# wait for this PID-file to disappear
test ! -s "$pid_file_path" &
&
i=\'\' &
&
break
;
;
*)
echo "wait_for_pid () usage: wait_for_pid created|removed pid pid_file_path"
exit 1
;
;
esac# if server isn\'t running, then pid-file will never be updated
if test -n "$pid";
then
if kill -0 "$pid" 2>
/dev/null;
then
:# the server still runs
else
# The server may have exited between the last pid-file check and now.
if test -n "$avoid_race_condition";
then
avoid_race_condition=""
continue# Check again.
fi# there\'s nothing that will affect the file.
log_failure_msg "The server quit without updating PID file ($pid_file_path)."
return 1# not waiting any more.
fi
fiecho $echo_n ".$echo_c"
i=`expr $i + 1`
sleep 1doneif test -z "$i" ;
then
log_success_msg
return 0
else
log_failure_msg
return 1
fi
}# Get arguments from the my.cnf file,
# the only group, which is read from now on is [mysqld]
if test -x "$bindir/my_print_defaults";
then
print_defaults="$bindir/my_print_defaults"
else
# Try to find basedir in /etc/my.cnf
conf=/etc/my.cnf
print_defaults=
if test -r $conf
then
subpat=\'^[^=]*basedir[^=]*=\\(.*\\)$\'
dirs=`sed -e "/$subpat/!d" -e \'s//\\1/\' $conf`
for d in $dirs
do
d=`echo $d | sed -e \'s/[]//g\'`
if test -x "$d/bin/my_print_defaults"
then
print_defaults="$d/bin/my_print_defaults"
break
fi
done
fi# Hope it\'s in the PATH ... but I doubt it
test -z "$print_defaults" &
&
print_defaults="my_print_defaults"
fi#
# Read defaults file from \'basedir\'.If there is no defaults file there
# check if it\'s in the old (depricated) place (datadir) and read it from there
#extra_args=""
if test -r "$basedir/my.cnf"
then
extra_args="-e $basedir/my.cnf"
fiparse_server_arguments `$print_defaults $extra_args mysqld server mysql_server mysql.server`#
# Set pid file if not given
#
if test -z "$mysqld_pid_file_path"
then
mysqld_pid_file_path=$datadir/`hostname`.pid
else
case "$mysqld_pid_file_path" in
/* ) ;
;
* )mysqld_pid_file_path="$datadir/$mysqld_pid_file_path" ;
;
esac
ficase "$mode" in
\'start\')
# Start daemon# Safeguard (relative paths, core dumps..)
cd $basedirecho $echo_n "Starting MySQL"
if test -x $bindir/mysqld_safe
then
# Give extra arguments to mysqld with the my.cnf file. This script
# may be overwritten at next upgrade.
$bindir/mysqld_safe --datadir="$datadir" --pid-file="$mysqld_pid_file_path" $other_args >
/dev/null &
wait_for_pid created "$!" "$mysqld_pid_file_path";
return_value=https://www.songbingjia.com/android/$?# Make lock for RedHat / SuSE
if test -w"$lockdir"
then
touch "$lock_file_path"
fiexit $return_value
else
log_failure_msg "Couldn\'t find MySQL server ($bindir/mysqld_safe)"
fi
;
;
\'stop\')
# Stop daemon. We use a signal here to avoid having to know the
# root password.if test -s "$mysqld_pid_file_path"
then
# signal mysqld_safe that it needs to stop
touch "$mysqld_pid_file_path.shutdown"mysqld_pid=`cat "$mysqld_pid_file_path"`if (kill -0 $mysqld_pid 2>
/dev/null)
then
echo $echo_n "Shutting down MySQL"
kill $mysqld_pid
# mysqld should remove the pid file when it exits, so wait for it.
wait_for_pid removed "$mysqld_pid" "$mysqld_pid_file_path";
return_value=https://www.songbingjia.com/android/$?
else
log_failure_msg"MySQL server process #$mysqld_pid is not running!"
rm "$mysqld_pid_file_path"
fi# Delete lock for RedHat / SuSE
if test -f "$lock_file_path"
then
rm -f "$lock_file_path"
fi
exit $return_value
else
log_failure_msg "MySQL server PID file could not be found!"
fi
;
;
\'restart\')
# Stop the service and regardless of whether it was
# running or not, start it again.
if $0 stop$other_args;
then
$0 start $other_args
else
log_failure_msg "Failed to stop running server, so refusing to try to start."
exit 1
fi
;
;
\'reload\'|\'force-reload\')
if test -s "$mysqld_pid_file_path" ;
then
read mysqld_pid <
"$mysqld_pid_file_path"
kill -HUP $mysqld_pid &
&
log_success_msg "Reloading service MySQL"
touch "$mysqld_pid_file_path"
else
log_failure_msg "MySQL PID file could not be found!"
exit 1
fi
;
;
\'status\')
# First, check to see if pid file exists
if test -s "$mysqld_pid_file_path" ;
then
read mysqld_pid <
"$mysqld_pid_file_path"
if kill -0 $mysqld_pid 2>
/dev/null ;
then
log_success_msg "MySQL running ($mysqld_pid)"
exit 0
else
log_failure_msg "MySQL is not running, but PID file exists"
exit 1
fi
else
# Try to find appropriate mysqld process
mysqld_pid=`pidof $libexecdir/mysqld`# test if multiple pids exist
pid_count=`echo $mysqld_pid | wc -w`
if test $pid_count -gt 1 ;
then
log_failure_msg "Multiple MySQL running but PID file could not be found ($mysqld_pid)"
exit 5
elif test -z $mysqld_pid ;
then
if test -f "$lock_file_path" ;
then
log_failure_msg "MySQL is not running, but lock file ($lock_file_path) exists"
exit 2
fi
log_failure_msg "MySQL is not running"
exit 3
else
log_failure_msg "MySQL is running but PID file could not be found"
exit 4
fi
fi
;
;
*)
# usage
basename=`basename "$0"`
echo "Usage: $basename{start|stop|restart|reload|force-reload|status}[ MySQL server options ]"
exit 1
;
;
esacexit 0
启动停止mysql服务
/etc/init.d/mysql.server start #启动服务
/etc/init.d/mysql.server stop#停止服务
配置主从库
主库:
create user \'repuser\'@\'%\' identified by \'repuser\';
grant replication slave on *.* to \'repuser\'@\'%\';
FLUSH PRIVILEGES;
从库:
reset master;
change master to master_host=\'172.18.2.76\', master_port = 3306, master_user=\'repuser\', master_password=\'repuser\', master_auto_position=1;
start slave;
如果么有开GTID:
change master to master_host=\'172.18.2.76\', master_user=\'repuser\', master_password=\'repuser\', master_log_file=\'db01-binlog.000002\', master_log_pos=154;
检测master的配置
show master status
文章图片
检查slave的配置
show slave status\\G
文章图片
主库做数据插入测试
文章图片
文章图片
关闭GTID
主库执行
SET GLOBAL GTID_MODE = \'ON_PERMISSIVE\';
SET GLOBAL GTID_MODE = \'OFF_PERMISSIVE\';
SET GLOBAL GTID_MODE = \'OFF\';
SET @@GLOBAL.ENFORCE_GTID_CONSISTENCY = off;
从库执行
stop slave;
SET GLOBAL GTID_MODE = \'ON_PERMISSIVE\';
SET GLOBAL GTID_MODE = \'OFF_PERMISSIVE\';
SET GLOBAL GTID_MODE = \'OFF\';
SET @@GLOBAL.ENFORCE_GTID_CONSISTENCY = off;
从库执行完后执行完后继续
CHANGE MASTER TO MASTER_AUTO_POSITION=0;
start slave;
show status status \\G
【mysql5.7.23主从安装部署,并开启GTID】
[root@localhost][(none)]> show slave status\\G
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 172.18.2.76
Master_User: repuser
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mysql-bin-2-76.000007
Read_Master_Log_Pos: 194
Relay_Log_File: mysql-relay.000002
Relay_Log_Pos: 325
Relay_Master_Log_File: mysql-bin-2-76.000007
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: 194
Relay_Log_Space: 568
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: 100
Master_UUID: dba8c18f-059b-11ec-8b34-00163e16948a
Master_Info_File: mysql.slave_master_info
SQL_Delay: 0
SQL_Remaining_Delay: NULL
Slave_SQL_Running_State: Slave has read all relay log; waiting for more updates
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: dba8c18f-059b-11ec-8b34-00163e16948a:1-43979
Auto_Position: 0
Replicate_Rewrite_DB:
Channel_Name:
Master_TLS_Version:
1 row in set (0.00 sec)
-- 开启GTID
show databases;
show slave status\\G;
stop slave;
SET @@GLOBAL.ENFORCE_GTID_CONSISTENCY = WARN;
SET @@GLOBAL.ENFORCE_GTID_CONSISTENCY = ON;
SET @@GLOBAL.GTID_MODE = OFF_PERMISSIVE;
SET @@GLOBAL.GTID_MODE = ON_PERMISSIVE;
SHOW STATUS LIKE \'ONGOING_ANONYMOUS_TRANSACTION_COUNT\';
SET @@GLOBAL.GTID_MODE = ON;
CHANGE MASTER TO MASTER_AUTO_POSITION = 1;
start slave;
show slave status\\G;
show global variables like \'%gtid%\';
show slave status\\G;
推荐阅读
- Java入门(百度Java开发工资)
- oeasy教您玩转vim - 29 - # 垂直翻页
- 基于Linux CentOS搭建FTP服务
- SpringBoot技术专题「Async&Future」异步编程机制以及功能分析讲解
- Linux目录同步到阿里云OSS工具ossutil
- VMWARE ESX SERVER虚拟化数据恢复过程总结
- 技术分析| 实时音视频通讯中的流媒体是怎样传输的
- gitlab对接office365邮件登录
- AIX6.1通过rsync同步到Centos7.6