MySQLクラスタチャット(MGR/主従)

4548 ワード

MySQL       (mgr   )

                            
            ,                  
                  ;


                         ,        
mysql             ,            :
MySQL        ,                     ,       
         (       );         ,           ,
           ;                 MySQL     
           ,       ;

mysql           ,   cnf       ,       
[mysqld]/[mysql]   
[mysqld]                ,[mysql]        
              MySQL8, mysql8         
[mysql]
default-auth=mysql_native_password

   MySQL                 ,      navicat  
         ,     default-auth=mysql_native_password  
[mysqld]  ,             ,        ,      
navicat             ,   MySQL              
         :
max_connections=2000
  MySQL         [mysql]  ,MySQL       ,     
    [mysqld]/[mysql]  


 MySQL8             ,    MySQL        ,  
lower_case_table_names = 1,          ,     MySQL 
--initialize           ,                  
  ,     MySQL           



    MySQL     MySQL         ,            ,
       ,     MySQL      ,         ,    
               ;          ,        
MySQL        ,                ,          
         MySQL,              mysql      ;


        :
1、  MySQL                  MySQL,    MySQL      
     ,       MySQL      ;

2、      MySQL        ,       MySQL     ,     
       ,        id  ,  MySQL serviceid      


           ,      master   slave      ,  MGR、       ,
PXC             。           ,                 ,
  :
CHANGE MASTER TO
MASTER_HOST='172.30.61.203',
MASTER_USER='MasterToSlave_user',
MASTER_PASSWORD='repl',
MASTER_LOG_FILE='mysql-bin.000001',
MASTER_LOG_POS=1867;

             ,           ,        IP、    、       、
    log   、   log    ;
            ;

                   ,     start/stop;                   
     start  ,   MGR  start group_repkication;         ;       ,  
  start slave         ;       ,mgr          ,          ,
                         ,                 ,        
      ;

            ,               ,              ,       
         ,            ,               reset master/reset slave
      ,flush privileges/flush logs    ;

                 ,        ,         ,             
  ,MGR             ,               
  :
set GLOBAL group_replication_bootstrap_group=ON;

            :
start group_repkication;

                   
set gGLOBAL group_replication_bootstrap_group=OFF;

                                         ,         ,
  MGR                   ,           ;


mysql           ,     ,          ,  mgr   MySQL     mgr  
  :
INSTALL PLUGIN group_replication SONAME 'group_replication.so';
       ,  MGR         ,       ,           ,         ;


       MySQL     ,    mgr      :

#     
[mysqld]
server-id=1
port=3306
#       
basedir=/app/mysql-8.0.21-el7-x86_64
#        
datadir=/data/mysql8.0/data
#  socket      
socket=/data/mysql8.0/mysql.sock
#            
secure_file_priv =/data

#      
#     ,   2000,            
max_connections=2000
#                ,        
max_allowed_packet=64M
#mysql8     
default-authentication-plugin=mysql_native_password

#      
#    
log-error=/data/mysql8.0/logs/mysqld_err.log
#pid    
pid-file=/data/mysql8.0/mysqld.pid
#binlog    、   、  、   
log-bin=/data/mysql8.0/binlog/mysql-bin
binlog_expire_logs_seconds=604800
binlog_format=ROW
log_slave_updates=ON
binlog_checksum=NONE
# sql    、    、   sql    
slow_query_log=1
slow_query_log_file=/data/mysql8.0/logs/slow_query.log
long_query_time=1

#innodb    
innodb_buffer_pool_size=50G
innodb_log_file_size=2048M
innodb_log_files_in_group=2
innodb_flush_method=O_DIRECT
innodb_buffer_pool_instances=8

#MGR Replication    
gtid_mode=on
enforce_gtid_consistency=on
master_info_repository=TABLE
relay_log_info_repository=TABLE
relay_log_recovery=ON
slave-parallel-type=LOGICAL_CLOCK
slave-parallel-workers=8
slave-preserve-commit-order=1
binlog_transaction_dependency_tracking=WRITESET

loose-group_replication_group_name=d738saff-5asb-11e9-9d26-90bvbnc26b74
loose-group_replication_start_on_boot=on
loose-group_replication_local_address="172.30.61.201:33061"
loose-group_replication_group_seeds="172.30.61.201:33061,172.30.61.202:33061,172.30.61.203:33061"
loose-group_replication_bootstrap_group=off
loose-group_replication_ip_whitelist="172.30.61.0/24"
report_host=172.30.61.201
loose-group_replication_flow_control_applier_threshold=100000
loose-group_replication_flow_control_certifier_threshold=100000

#Load data      
local-infile=1

#       
[mysql]
default-auth=mysql_native_password