加入收藏 | 设为首页 | 会员中心 | 我要投稿 温州站长网 (https://www.52wenzhou.com/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > MySql教程 > 正文

MySQL8.0的MGR多主创建与测试

发布时间:2022-03-22 20:59:35 所属栏目:MySql教程 来源:互联网
导读:环境: 虚拟机VMware, OS:CentOS Linux release 7.3.1611 (Core) 按照下述的单机Mysql8.0的安装方式进行安装完之后,将该机复制两台,分别修改IP为192.168.1.78和192.168.1.78,以及两台新机器配置文件/etc/my.cnf的serverid,还有要去数据路径下删掉auto.
      环境:
 
      虚拟机VMware,
 
      OS:CentOS Linux release 7.3.1611 (Core)
 
      按照下述的单机Mysql8.0的安装方式进行安装完之后,将该机复制两台,分别修改IP为192.168.1.78和192.168.1.78,以及两台新机器配置文件/etc/my.cnf的serverid,还有要去数据路径下删掉auto.cnf不然配置不成。
 
      vim /etc/hosts
 
192.168.1.78 mgr-mul1
 
192.168.1.79 mgr-mul2
 
192.168.1.80 mgr-mul3
 
     要用hostname修改每台机器的主机名确保不相同,不然配置不成功。
 
一、单机安装(192.168.1.78)
 
官网下载8.0.11版本的tar.gz包解压,复制更名到/usr/local/mysql
 
创建数据路径及日志路径并把他们权限改给mysql用户:
 
/data/mysql3306/mysql3306
 
/data/mysql3306/logs
 
配置文件如下:注意修改server-id及组相关ip
 
vim /etc/my.cnf
   
default_authentication_plugin = mysql_native_password
 
skip_name_resolve = 1
 
character_set_server = utf8mb4
 
collation_server = utf8mb4_unicode_ci
 
max_connections = 2000
 
max_connect_errors = 10000
 
interactive_timeout = 600
 
wait_timeout = 600
 
table_open_cache = 2048
 
thread_cache_size = 51
 
max_allowed_packet = 16M
 
tmp_table_size = 256M
 
max_heap_table_size = 96M
 
sort_buffer_size = 4M
 
read_buffer_size = 4M #??IO
 
join_buffer_size = 4M
 
read_rnd_buffer_size = 64M #??篓虏
 
bulk_insert_buffer_size = 64M #
 
log_error = /data/mysql3306/logs/mysql-error.log
 
log_timestamps = system
 
slow_query_log = 1
 
slow_query_log_file = /data/mysql3306/logs/mysql-slow.log
 
long_query_time = 1
 
log_queries_not_using_indexes = 1
 
log_throttle_queries_not_using_indexes =10
 
log_slow_admin_statements = 1
 
log_slow_slave_statements = 1
 
min_examined_row_limit = 100
 
log_queries_not_using_indexes = 1
 
log_output = FILE
 
relay_log = /data/mysql3306/mysql3306/mysql-relay
 
#binlog
 
server_id = 1783306
 
log_bin = /data/mysql3306/mysql3306/mysql-bin
 
binlog_expire_logs_seconds =604800
 
binlog_format = row
 
max_binlog_size = 1024M
 
max_binlog_cache_size = 8G
 
binlog_cache_size = 4M
 
sync_binlog = 1
 
master_info_repository = TABLE
 
relay_log_info_repository = TABLE
 
relay_log_recovery = ON
 
log_slave_updates = 1
 
slave-parallel-type=LOGICAL_CLOCK
 
slave-parallel-workers=16
 
master_info_repository=TABLE
 
relay_log_info_repository=TABLE
 
relay_log_recovery=ON
 
binlog_checksum=NONE
 
slave_preserve_commit_order=1
 
#group_replication_flow_control_mode=DISABLED
 
log_slave_updates=1
 
#GR
 
enforce_gtid_consistency=1
 
gtid_mode = on
 
transaction_write_set_extraction =XXHASH64 # off
 
loose-group_replication_group_name ="a876d35e-9110-11e6-a365-882b2b5s09d6" #可在库里使用SELECT UUID()生成,一个组的所有机器都相同。
 
loose-group_replication_local_address ="192.168.1.78:24900" #本机IP
 
loose-group_replication_group_seeds ="192.168.1.78:24900,192.168.1.79:24900,192.168.1.80:24900"
 
loose-group_replication_bootstrap_group =off # off
 
loose-group_replication_start_on_boot =off #非常重要。

(编辑:温州站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    热点阅读