MySQL Group Replication 多机多实例安装配置(Windows环境)
程序员文章站
2022-07-13 09:10:01
...
1、下载mysql5.7.17 下载地址
2、解压zip到指定的目录
本机安装目录为:D:\tools\mysql-5.7.17
3、配置mysql环境变量
PATH=D:\tools\mysql-5.7.17\bin;$PATH
注意:如果之前有安装过mysql,请手动卸载并清除注册表信息和mysql服务链接。
查看注册表信息,WIN+R键入:regedit,如果存在请清除。 查看服务链接,WIN+R键入:services.msc 如果存在请在命令窗口中键入:sc delete MySQL
4、配置hosts
10.10.1.17 node3-04 node3-04.novalocal lihua-pc 10.10.2.140 node3-05 node3-05.novalocal win7-64-PC 10.10.2.168 node3-06 node3-06.novalocal zyz-pc
5、配置my.ini
[client] default-character-set=utf8 [mysqld] basedir = D:/tools/mysql-5.7.17 datadir = D:/tools/mysql-5.7.17/data port = 3306 tmpdir = D:/tools/mysql-5.7.17/tmp socket = D:/tools/mysql-5.7.17/mysql.sock log-error= D:/tools/mysql-5.7.17/logs/mysql_error.log sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES #Replication Framework server_id=4 gtid_mode=ON enforce_gtid_consistency=ON master_info_repository=TABLE relay_log_info_repository=TABLE binlog_checksum=NONE log_slave_updates=ON log_bin=D:/tools/mysql-5.7.17/logs/binlog binlog_format=ROW binlog_row_image=minimal relay-log=D:/tools/mysql-5.7.17/logs/relay-bin #Group Replication transaction_write_set_extraction=XXHASH64 loose-group_replication_group_name="0374cfa3-deae-11e6-b0fe-fa163e2d23ab" loose-group_replication_start_on_boot=off loose-group_replication_local_address= "node3-04:24901" loose-group_replication_group_seeds= "node3-04:24901,node3-05:24901,node3-06:24901" loose-group_replication_bootstrap_group= off loose-group_replication_single_primary_mode=FALSE loose-group_replication_enforce_update_everywhere_checks=TRUEmy.ini配置好后放在C:\Windows目录下即可,这里不同的机子对应的server_id,loose-group_replication_local_address会有所不同。
6、初始化数据库
WIN+R 键入:cmd mysqld --initialize-insecure --user=mysql
注意:如果没有配置mysql环境变量,或者mysql路径指定错误,命令行中执行以上命令会报错。
7、启动mysql服务
mysqld install
然后在services.msc中手动启动mysql服务,如果需要将mysql的服务调整为手动启动。
8、登录并修改密码
#首次登录无密码 mysql -uroot -p #修改root密码 SET PASSWORD = PASSWORD('root'); flush privileges;
9、创建group replication所需要的用户
SET SQL_LOG_BIN=0; CREATE USER rpl_user@'%'; GRANT REPLICATION SLAVE ON *.* TO rpl_user@'%' IDENTIFIED BY 'rpl_pass'; FLUSH PRIVILEGES; SET SQL_LOG_BIN=1; CHANGE MASTER TO MASTER_USER='rpl_user', MASTER_PASSWORD='rpl_pass' FOR CHANNEL 'group_replication_recovery';
10、安装组复制插件
INSTALL PLUGIN group_replication SONAME 'group_replication.dll'; SHOW PLUGINS;
11、启动组复制
#启动group replication SET GLOBAL group_replication_bootstrap_group=ON; START GROUP_REPLICATION; SET GLOBAL group_replication_bootstrap_group=OFF; #查看组成员状态 SELECT * FROM performance_schema.replication_group_members;
接下来的操作和在linux下差别不大,这里就不赘述,具体参考:MySQL Group Replication多机多实例安装配置
over!
上一篇: java多线程(七)
下一篇: Oracle 修改字段类型