• mysql8 MGR集群部署


    服务器环境

    系统主机名IP
    CentOS 7.9mgr-node01192.168.200.31
    CentOS 7.9mgr-node02192.168.200.32
    CentOS 7.9mgr-node03192.168.200.33

    mysql8安装

    tar zxvf mysql-8.0.19-1.el7.x86_64.rpm-bundle.tar.gz
    
    rpm -e --nodeps mariadb-libs-5.5.68-1.el7.x86_64
    
    rpm -ivh mysql-community-common-8.0.19-1.el7.x86_64.rpm --nodeps --force
    rpm -ivh mysql-community-libs-8.0.19-1.el7.x86_64.rpm --nodeps --force
    rpm -ivh mysql-community-client-8.0.19-1.el7.x86_64.rpm --nodeps --force
    rpm -ivh mysql-community-server-8.0.19-1.el7.x86_64.rpm --nodeps --force
    
    
    mkdir -p /data/mysql/data /data/mysql/mysql-files /data/mysql/mysql-keyring
    chown -R mysql:mysql /data/mysql
    rm -rf /var/lib/mysql
    rm -rf /var/lib/mysql-files
    rm -rf /var/lib/mysql-keyring
    ln -s /data/mysql/data /var/lib/mysql
    ln -s /data/mysql/mysql-files /var/lib/mysql-files
    ln -s /data/mysql/mysql-keyring /var/lib/mysql-keyring
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18

    修改配置文件my.cnf

    192.168.200.31

    cat > /etc/my.cnf << EOF
    [mysqld]
    port=3308
    default-time-zone='+08:00' 
    server-id=31
    log-bin=mysql-bin
    binlog_format=row
    default-authentication-plugin=mysql_native_password
    
    skip-name-resolve # 禁用DNS解析,加快IP方式的连接
    
    auto-increment-increment=1
    auto-increment-offset=1
    
    plugin_dir=/usr/lib64/mysql/plugin/
    
    gtid-mode=on # 开启gtid模式
    enforce-gtid-consistency=1 #开启gtid安全限制
    report_host=192.168.200.31
    
    #MGR使用乐观锁,所以官网建议隔离级别是RC,减少锁粒度
    transaction_isolation = READ-COMMITTED
    #因为集群会在故障恢复时互相检查binlog的数据,
    
    #所以需要记录下集群内其他服务器发过来已经执行过的binlog,按GTID来区分是否执行过.
    log-slave-updates = 1
    
    #binlog校验规则,5.6之后的高版本是CRC32,低版本都是NONE,但是MGR要求使用NONE
    binlog_checksum = NONE
    
    #基于安全的考虑,MGR集群要求复制模式要改成slave记录记录到表中,不然就报错
    master_info_repository = TABLE
    
    #同上配套
    relay_log_info_repository = TABLE
    
    #组复制设置#记录事务的算法,官网建议设置该参数使用 XXHASH64 算法
    transaction_write_set_extraction = XXHASH64
    
    #primary节点到secondary节点的请求是否为基于RSA密钥对的密码交换
    loose-group_replication_recovery_get_public_key=on
    
    # 组恢复时应用ssl
    loose-group_replication_recovery_use_ssl=on
    
    #相当于此GROUP的名字,是UUID值,不能和集群内其他GTID值的UUID混用,可用uuidgen来生成一个新的,
    #主要是用来区分整个内网里边的各个不同的GROUP,而且也是这个group内的GTID值的UUID
    loose-group_replication_group_name = '2d837649-b362-4ed3-9aa8-9f3292b2812f'
    
    #IP地址白名单,默认只添加127.0.0.1,不会允许来自外部主机的连接,按需安全设置
    loose-group_replication_ip_whitelist = '127.0.0.1/8,192.168.200.0/24'
    
    #是否随服务器启动而自动启动组复制,不建议直接启动,怕故障恢复时有扰乱数据准确性的特殊情况
    loose-group_replication_start_on_boot = OFF
    
    #本地MGR的IP地址和端口,host:port,是MGR的端口,不是数据库的端口
    loose-group_replication_local_address = '192.168.200.31:24901'
    
    #需要接受本MGR实例控制的服务器IP地址和端口,是MGR的端口,不是数据库的端口
    loose-group_replication_group_seeds = '192.168.200.31:24901,192.168.200.32:24901,192.168.200.33:24901'
    
    #开启引导模式,添加组成员,用于第一次搭建MGR或重建MGR的时候使用,只需要在集群内的其中一台开启,
    loose-group_replication_bootstrap_group = OFF
    
    #是否启动单主模式,如果启动,则本实例是主库,提供读写,其他实例仅提供读,如果为off就是多主模式了
    loose-group_replication_single_primary_mode = ON
    
    #多主模式下,强制检查每一个实例是否允许该操作,如果不是多主,可以关闭
    loose-group_replication_enforce_update_everywhere_checks = off
    
    
    datadir=/var/lib/mysql
    socket=/var/lib/mysql/mysql.sock
    pid-file=/var/run/mysqld/mysqld.pid
    
    log-error=/var/lib/mysql/mysqld.log
    slow_query_log = 0
    long_query_time = 2
    slow_query_log_file = /var/lib/mysql/mysql-slow.log
    
    
    character-set-client-handshake = FALSE
    character-set-server = utf8mb4
    collation-server = utf8mb4_general_ci
    init_connect='SET NAMES utf8mb4'
    
    max_connections = 1024
    max_connect_errors = 6000
    
    open_files_limit = 10000
    table_open_cache = 128
    
    max_allowed_packet = 200M
    binlog_cache_size = 1M
    max_heap_table_size = 8M
    tmp_table_size = 16M
    read_buffer_size = 2M
    read_rnd_buffer_size = 8M
    sort_buffer_size = 8M
    join_buffer_size = 8M
    thread_cache_size = 64
    key_buffer_size = 4M
    ft_min_word_len = 4
    
    performance_schema = 0
    explicit_defaults_for_timestamp=true
    lower_case_table_names=1
    skip-external-locking 
    default-storage-engine = InnoDB 
    innodb_file_per_table = 1
    
    innodb_open_files = 500
    
    innodb_buffer_pool_size = 6G
    innodb_buffer_pool_chunk_size = 128M
    innodb_buffer_pool_instances = 16
    
    innodb_write_io_threads = 4
    innodb_read_io_threads = 4
    innodb_thread_concurrency = 0
    innodb_purge_threads = 1
    innodb_flush_log_at_trx_commit = 2
    innodb_log_buffer_size = 2M
    innodb_log_file_size = 32M
    innodb_log_files_in_group = 3
    innodb_max_dirty_pages_pct = 90
    innodb_lock_wait_timeout = 120 
    bulk_insert_buffer_size = 8M
    myisam_sort_buffer_size = 8M
    myisam_max_sort_file_size = 10G
    myisam_repair_threads = 1
    interactive_timeout = 7200
    wait_timeout = 86400
    
    [client]
    default-character-set = utf8mb4
    [mysql]
    socket=/var/lib/mysql/mysql.sock
    default-character-set = utf8mb4
    
    EOF
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56
    • 57
    • 58
    • 59
    • 60
    • 61
    • 62
    • 63
    • 64
    • 65
    • 66
    • 67
    • 68
    • 69
    • 70
    • 71
    • 72
    • 73
    • 74
    • 75
    • 76
    • 77
    • 78
    • 79
    • 80
    • 81
    • 82
    • 83
    • 84
    • 85
    • 86
    • 87
    • 88
    • 89
    • 90
    • 91
    • 92
    • 93
    • 94
    • 95
    • 96
    • 97
    • 98
    • 99
    • 100
    • 101
    • 102
    • 103
    • 104
    • 105
    • 106
    • 107
    • 108
    • 109
    • 110
    • 111
    • 112
    • 113
    • 114
    • 115
    • 116
    • 117
    • 118
    • 119
    • 120
    • 121
    • 122
    • 123
    • 124
    • 125
    • 126
    • 127
    • 128
    • 129
    • 130
    • 131
    • 132
    • 133
    • 134
    • 135
    • 136
    • 137
    • 138
    • 139
    • 140
    • 141

    192.168.200.32

    cat > /etc/my.cnf << EOF
    [mysqld]
    port=3308
    default-time-zone='+08:00' 
    server-id=32
    log-bin=mysql-bin
    binlog_format=row
    default-authentication-plugin=mysql_native_password
    
    skip-name-resolve # 禁用DNS解析,加快IP方式的连接
    
    auto-increment-increment=1
    auto-increment-offset=1
    
    plugin_dir=/usr/lib64/mysql/plugin/
    
    gtid-mode=on # 开启gtid模式
    enforce-gtid-consistency=1 #开启gtid安全限制
    report_host=192.168.200.32
    
    #MGR使用乐观锁,所以官网建议隔离级别是RC,减少锁粒度
    transaction_isolation = READ-COMMITTED
    #因为集群会在故障恢复时互相检查binlog的数据,
    
    #所以需要记录下集群内其他服务器发过来已经执行过的binlog,按GTID来区分是否执行过.
    log-slave-updates = 1
    
    #binlog校验规则,5.6之后的高版本是CRC32,低版本都是NONE,但是MGR要求使用NONE
    binlog_checksum = NONE
    
    #基于安全的考虑,MGR集群要求复制模式要改成slave记录记录到表中,不然就报错
    master_info_repository = TABLE
    
    #同上配套
    relay_log_info_repository = TABLE
    
    #组复制设置#记录事务的算法,官网建议设置该参数使用 XXHASH64 算法
    transaction_write_set_extraction = XXHASH64
    
    #primary节点到secondary节点的请求是否为基于RSA密钥对的密码交换
    loose-group_replication_recovery_get_public_key=on
    
    # 组恢复时应用ssl
    loose-group_replication_recovery_use_ssl=on
    
    #相当于此GROUP的名字,是UUID值,不能和集群内其他GTID值的UUID混用,可用uuidgen来生成一个新的,
    #主要是用来区分整个内网里边的各个不同的GROUP,而且也是这个group内的GTID值的UUID
    loose-group_replication_group_name = '2d837649-b362-4ed3-9aa8-9f3292b2812f'
    
    #IP地址白名单,默认只添加127.0.0.1,不会允许来自外部主机的连接,按需安全设置
    loose-group_replication_ip_whitelist = '127.0.0.1/8,192.168.200.0/24'
    
    #是否随服务器启动而自动启动组复制,不建议直接启动,怕故障恢复时有扰乱数据准确性的特殊情况
    loose-group_replication_start_on_boot = OFF
    
    #本地MGR的IP地址和端口,host:port,是MGR的端口,不是数据库的端口
    loose-group_replication_local_address = '192.168.200.32:24901'
    
    #需要接受本MGR实例控制的服务器IP地址和端口,是MGR的端口,不是数据库的端口
    loose-group_replication_group_seeds = '192.168.200.31:24901,192.168.200.32:24901,192.168.200.33:24901'
    
    #开启引导模式,添加组成员,用于第一次搭建MGR或重建MGR的时候使用,只需要在集群内的其中一台开启,
    loose-group_replication_bootstrap_group = OFF
    
    #是否启动单主模式,如果启动,则本实例是主库,提供读写,其他实例仅提供读,如果为off就是多主模式了
    loose-group_replication_single_primary_mode = ON
    
    #多主模式下,强制检查每一个实例是否允许该操作,如果不是多主,可以关闭
    loose-group_replication_enforce_update_everywhere_checks = off
    
    
    datadir=/var/lib/mysql
    socket=/var/lib/mysql/mysql.sock
    pid-file=/var/run/mysqld/mysqld.pid
    
    log-error=/var/lib/mysql/mysqld.log
    slow_query_log = 0
    long_query_time = 2
    slow_query_log_file = /var/lib/mysql/mysql-slow.log
    
    
    character-set-client-handshake = FALSE
    character-set-server = utf8mb4
    collation-server = utf8mb4_general_ci
    init_connect='SET NAMES utf8mb4'
    
    max_connections = 1024
    max_connect_errors = 6000
    
    open_files_limit = 10000
    table_open_cache = 128
    
    max_allowed_packet = 200M
    binlog_cache_size = 1M
    max_heap_table_size = 8M
    tmp_table_size = 16M
    read_buffer_size = 2M
    read_rnd_buffer_size = 8M
    sort_buffer_size = 8M
    join_buffer_size = 8M
    thread_cache_size = 64
    key_buffer_size = 4M
    ft_min_word_len = 4
    
    performance_schema = 0
    explicit_defaults_for_timestamp=true
    lower_case_table_names=1
    skip-external-locking 
    default-storage-engine = InnoDB 
    innodb_file_per_table = 1
    
    innodb_open_files = 500
    
    innodb_buffer_pool_size = 6G
    innodb_buffer_pool_chunk_size = 128M
    innodb_buffer_pool_instances = 16
    
    innodb_write_io_threads = 4
    innodb_read_io_threads = 4
    innodb_thread_concurrency = 0
    innodb_purge_threads = 1
    innodb_flush_log_at_trx_commit = 2
    innodb_log_buffer_size = 2M
    innodb_log_file_size = 32M
    innodb_log_files_in_group = 3
    innodb_max_dirty_pages_pct = 90
    innodb_lock_wait_timeout = 120 
    bulk_insert_buffer_size = 8M
    myisam_sort_buffer_size = 8M
    myisam_max_sort_file_size = 10G
    myisam_repair_threads = 1
    interactive_timeout = 7200
    wait_timeout = 86400
    
    [client]
    default-character-set = utf8mb4
    [mysql]
    socket=/var/lib/mysql/mysql.sock
    default-character-set = utf8mb4
    
    EOF
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56
    • 57
    • 58
    • 59
    • 60
    • 61
    • 62
    • 63
    • 64
    • 65
    • 66
    • 67
    • 68
    • 69
    • 70
    • 71
    • 72
    • 73
    • 74
    • 75
    • 76
    • 77
    • 78
    • 79
    • 80
    • 81
    • 82
    • 83
    • 84
    • 85
    • 86
    • 87
    • 88
    • 89
    • 90
    • 91
    • 92
    • 93
    • 94
    • 95
    • 96
    • 97
    • 98
    • 99
    • 100
    • 101
    • 102
    • 103
    • 104
    • 105
    • 106
    • 107
    • 108
    • 109
    • 110
    • 111
    • 112
    • 113
    • 114
    • 115
    • 116
    • 117
    • 118
    • 119
    • 120
    • 121
    • 122
    • 123
    • 124
    • 125
    • 126
    • 127
    • 128
    • 129
    • 130
    • 131
    • 132
    • 133
    • 134
    • 135
    • 136
    • 137
    • 138
    • 139
    • 140
    • 141

    192.168.200.33

    cat > /etc/my.cnf << EOF
    [mysqld]
    port=3308
    default-time-zone='+08:00' 
    server-id=33
    log-bin=mysql-bin
    binlog_format=row
    default-authentication-plugin=mysql_native_password
    
    skip-name-resolve # 禁用DNS解析,加快IP方式的连接
    
    auto-increment-increment=1
    auto-increment-offset=1
    
    plugin_dir=/usr/lib64/mysql/plugin/
    
    gtid-mode=on # 开启gtid模式
    enforce-gtid-consistency=1 #开启gtid安全限制
    report_host=192.168.200.33
    
    #MGR使用乐观锁,所以官网建议隔离级别是RC,减少锁粒度
    transaction_isolation = READ-COMMITTED
    #因为集群会在故障恢复时互相检查binlog的数据,
    
    #所以需要记录下集群内其他服务器发过来已经执行过的binlog,按GTID来区分是否执行过.
    log-slave-updates = 1
    
    #binlog校验规则,5.6之后的高版本是CRC32,低版本都是NONE,但是MGR要求使用NONE
    binlog_checksum = NONE
    
    #基于安全的考虑,MGR集群要求复制模式要改成slave记录记录到表中,不然就报错
    master_info_repository = TABLE
    
    #同上配套
    relay_log_info_repository = TABLE
    
    #组复制设置#记录事务的算法,官网建议设置该参数使用 XXHASH64 算法
    transaction_write_set_extraction = XXHASH64
    
    #primary节点到secondary节点的请求是否为基于RSA密钥对的密码交换
    loose-group_replication_recovery_get_public_key=on
    
    # 组恢复时应用ssl
    loose-group_replication_recovery_use_ssl=on
    
    #相当于此GROUP的名字,是UUID值,不能和集群内其他GTID值的UUID混用,可用uuidgen来生成一个新的,
    #主要是用来区分整个内网里边的各个不同的GROUP,而且也是这个group内的GTID值的UUID
    loose-group_replication_group_name = '2d837649-b362-4ed3-9aa8-9f3292b2812f'
    
    #IP地址白名单,默认只添加127.0.0.1,不会允许来自外部主机的连接,按需安全设置
    loose-group_replication_ip_whitelist = '127.0.0.1/8,192.168.200.0/24'
    
    #是否随服务器启动而自动启动组复制,不建议直接启动,怕故障恢复时有扰乱数据准确性的特殊情况
    loose-group_replication_start_on_boot = OFF
    
    #本地MGR的IP地址和端口,host:port,是MGR的端口,不是数据库的端口
    loose-group_replication_local_address = '192.168.200.33:24901'
    
    #需要接受本MGR实例控制的服务器IP地址和端口,是MGR的端口,不是数据库的端口
    loose-group_replication_group_seeds = '192.168.200.31:24901,192.168.200.32:24901,192.168.200.33:24901'
    
    #开启引导模式,添加组成员,用于第一次搭建MGR或重建MGR的时候使用,只需要在集群内的其中一台开启,
    loose-group_replication_bootstrap_group = OFF
    
    #是否启动单主模式,如果启动,则本实例是主库,提供读写,其他实例仅提供读,如果为off就是多主模式了
    loose-group_replication_single_primary_mode = ON
    
    #多主模式下,强制检查每一个实例是否允许该操作,如果不是多主,可以关闭
    loose-group_replication_enforce_update_everywhere_checks = off
    
    
    datadir=/var/lib/mysql
    socket=/var/lib/mysql/mysql.sock
    pid-file=/var/run/mysqld/mysqld.pid
    
    log-error=/var/lib/mysql/mysqld.log
    slow_query_log = 0
    long_query_time = 2
    slow_query_log_file = /var/lib/mysql/mysql-slow.log
    
    
    character-set-client-handshake = FALSE
    character-set-server = utf8mb4
    collation-server = utf8mb4_general_ci
    init_connect='SET NAMES utf8mb4'
    
    max_connections = 1024
    max_connect_errors = 6000
    
    open_files_limit = 10000
    table_open_cache = 128
    
    max_allowed_packet = 200M
    binlog_cache_size = 1M
    max_heap_table_size = 8M
    tmp_table_size = 16M
    read_buffer_size = 2M
    read_rnd_buffer_size = 8M
    sort_buffer_size = 8M
    join_buffer_size = 8M
    thread_cache_size = 64
    key_buffer_size = 4M
    ft_min_word_len = 4
    
    performance_schema = 0
    explicit_defaults_for_timestamp=true
    lower_case_table_names=1
    skip-external-locking 
    default-storage-engine = InnoDB 
    innodb_file_per_table = 1
    
    innodb_open_files = 500
    
    innodb_buffer_pool_size = 6G
    innodb_buffer_pool_chunk_size = 128M
    innodb_buffer_pool_instances = 16
    
    innodb_write_io_threads = 4
    innodb_read_io_threads = 4
    innodb_thread_concurrency = 0
    innodb_purge_threads = 1
    innodb_flush_log_at_trx_commit = 2
    innodb_log_buffer_size = 2M
    innodb_log_file_size = 32M
    innodb_log_files_in_group = 3
    innodb_max_dirty_pages_pct = 90
    innodb_lock_wait_timeout = 120 
    bulk_insert_buffer_size = 8M
    myisam_sort_buffer_size = 8M
    myisam_max_sort_file_size = 10G
    myisam_repair_threads = 1
    interactive_timeout = 7200
    wait_timeout = 86400
    
    [client]
    default-character-set = utf8mb4
    [mysql]
    socket=/var/lib/mysql/mysql.sock
    default-character-set = utf8mb4
    
    EOF
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56
    • 57
    • 58
    • 59
    • 60
    • 61
    • 62
    • 63
    • 64
    • 65
    • 66
    • 67
    • 68
    • 69
    • 70
    • 71
    • 72
    • 73
    • 74
    • 75
    • 76
    • 77
    • 78
    • 79
    • 80
    • 81
    • 82
    • 83
    • 84
    • 85
    • 86
    • 87
    • 88
    • 89
    • 90
    • 91
    • 92
    • 93
    • 94
    • 95
    • 96
    • 97
    • 98
    • 99
    • 100
    • 101
    • 102
    • 103
    • 104
    • 105
    • 106
    • 107
    • 108
    • 109
    • 110
    • 111
    • 112
    • 113
    • 114
    • 115
    • 116
    • 117
    • 118
    • 119
    • 120
    • 121
    • 122
    • 123
    • 124
    • 125
    • 126
    • 127
    • 128
    • 129
    • 130
    • 131
    • 132
    • 133
    • 134
    • 135
    • 136
    • 137
    • 138
    • 139
    • 140
    • 141
    启动mysql服务
    systemctl start mysqld
    systemctl enable mysqld
    
    • 1
    • 2

    防火墙放行(所有节点操作)

    firewall-cmd --zone=public --add-port={3308,24901}/tcp --permanent&&firewall-cmd --reload
    
    • 1

    修改mysql初始账号权限(所有节点操作)

    alter user 'root'@'localhost' identified with mysql_native_password by "D4vh3s1#Hmb70ppcI2Q8";
    flush privileges;
    
    • 1
    • 2

    创建主从同步账号(所有节点操作)

    create user 'repl'@'192.168.200.%' identified with mysql_native_password by 'DS6aWh2l9NcS!E#@sJEn';
    
    GRANT REPLICATION SLAVE ON *.* TO 'repl'@'192.168.200.%';
    
    reset master;
    
    • 1
    • 2
    • 3
    • 4
    • 5

    安装插件(所有节点操作)

    # mysql客户端操作
    install PLUGIN group_replication SONAME 'group_replication.so';
    
    
    #查看插件是否安装成功
    show plugins;
    select * from information_schema.plugins where plugin_name = 'group_replication'\G;
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7

    MGR单主模式

    在主节点启动引导
    SET GLOBAL group_replication_bootstrap_group = ON;
    START GROUP_REPLICATION;
    SET GLOBAL group_replication_bootstrap_group = OFF;
    
    # 查看组复制状态
    SELECT * FROM performance_schema.replication_group_members;
    
    
    在从节点执行
    CHANGE MASTER TO MASTER_USER='repl', MASTER_PASSWORD='DS6aWh2l9NcS!E#@sJEn' FOR CHANNEL 'group_replication_recovery';
    
    START GROUP_REPLICATION;
    
    #查看组复制状态
    SELECT * FROM performance_schema.replication_group_members;
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16

    主挂了如何恢复

    # 第一次需要如此操作
    STOP GROUP_REPLICATION;
    
    CHANGE MASTER TO MASTER_USER='repl', MASTER_PASSWORD='DS6aWh2l9NcS!E#@sJEn' FOR CHANNEL 'group_replication_recovery';
    
    START GROUP_REPLICATION;
    
    # 后续恢复执行
    
    START GROUP_REPLICATION;
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
  • 相关阅读:
    LockSupport-park和unpark编码实战
    16、window11+visual studio 2022+cuda+ffmpeg进行拉流和解码(RTX3050)
    Qt5开发从入门到精通——第九篇四节( Qt5 文件及磁盘处理—— 文件系统浏览)
    企业级自定义表单引擎解决方案(十二)--体验代码目录结构
    React UseMemo源码分析
    【LeetCode75】第七十二题 无重叠区间
    什么是VPN服务器
    基于NPOI封装导出Excel方法
    rviz建图拉点导航
    Linux - 驱动开发 - watchdog - SMP机制下多核确活
  • 原文地址:https://blog.csdn.net/lx_1314/article/details/136482349