mysql分布式架构mycat
1. 转自https://www.jianshu.com/p/5e0062f6cf62
1. MyCAT基础架构图
image.png
2. MyCAT基础架构准备
2.1 环境准备:
两台虚拟机 db01 db02 每台创建四个mysql实例:3307 3308 3309 3310
2.2 删除历史环境:
pkill mysqld rm -rf /data/330* mv /etc/my.cnf /etc/my.cnf.bak
2.3 创建相关目录初始化数据
mkdir /data/33{07..10}/data -p mysqld --initialize-insecure --user=mysql --datadir=/data/3307/data --basedir=/app/mysql mysqld --initialize-insecure --user=mysql --datadir=/data/3308/data --basedir=/app/mysql mysqld --initialize-insecure --user=mysql --datadir=/data/3309/data --basedir=/app/mysql mysqld --initialize-insecure --user=mysql --datadir=/data/3310/data --basedir=/app/mysql
2.4 准备配置文件和启动脚本
========db01============== cat >/data/3307/my.cnf<<EOF [mysqld] basedir=/app/mysql datadir=/data/3307/data socket=/data/3307/mysql.sock port=3307 log-error=/data/3307/mysql.log log_bin=/data/3307/mysql-bin binlog_format=row skip-name-resolve server-id=7 gtid-mode=on enforce-gtid-consistency=true log-slave-updates=1 EOF cat >/data/3308/my.cnf<<EOF [mysqld] basedir=/app/mysql datadir=/data/3308/data port=3308 socket=/data/3308/mysql.sock log-error=/data/3308/mysql.log log_bin=/data/3308/mysql-bin binlog_format=row skip-name-resolve server-id=8 gtid-mode=on enforce-gtid-consistency=true log-slave-updates=1 EOF cat >/data/3309/my.cnf<<EOF [mysqld] basedir=/app/mysql datadir=/data/3309/data socket=/data/3309/mysql.sock port=3309 log-error=/data/3309/mysql.log log_bin=/data/3309/mysql-bin binlog_format=row skip-name-resolve server-id=9 gtid-mode=on enforce-gtid-consistency=true log-slave-updates=1 EOF cat >/data/3310/my.cnf<<EOF [mysqld] basedir=/app/mysql datadir=/data/3310/data socket=/data/3310/mysql.sock port=3310 log-error=/data/3310/mysql.log log_bin=/data/3310/mysql-bin binlog_format=row skip-name-resolve server-id=10 gtid-mode=on enforce-gtid-consistency=true log-slave-updates=1 EOF cat >/etc/systemd/system/mysqld3307.service<<EOF [Unit] Description=MySQL Server Documentation=man
相关推荐
CoderToy 2020-11-16
emmm00 2020-11-17
王艺强 2020-11-17
ribavnu 2020-11-16
bianruifeng 2020-11-16
wangshuangbao 2020-11-13
苏康申 2020-11-13
vivenwan 2020-11-13
moyekongling 2020-11-13
云中舞步 2020-11-12
要啥自行车一把梭 2020-11-12
aydh 2020-11-12
kuwoyinlehe 2020-11-12
minerk 2020-11-12
vitasfly 2020-11-12
jazywoo在路上 2020-11-11
敏敏张 2020-11-11
世樹 2020-11-11