1、MyCAT基础架构准备
MyCAT基础架构图
文章插图
摘自oldguo
1.1 MyCAT基础架构准备
1.1.1 环境准备:
两台虚拟机 db01(10.0.0.51) db02(10.0.0.52) 每台创建四个MySQL实例:3307 3308 3309 3310 1.1.2 删除历史环境:
pkill mysqldrm -rf /data/330* mv /etc/my.cnf /etc/my.cnf.bak1.1.3 创建相关目录初始化数据
mkdir /data/33{07..10}/data -pmysqld --initialize-insecure --user=mysql --datadir=/data/3307/data --basedir=/Application/mysqlmysqld --initialize-insecure --user=mysql --datadir=/data/3308/data --basedir=/application/mysqlmysqld --initialize-insecure --user=mysql --datadir=/data/3309/data --basedir=/application/mysqlmysqld --initialize-insecure --user=mysql --datadir=/data/3310/data --basedir=/application/mysql1.1.4 准备配置文件和启动脚本
========db01==============cat >/data/3307/my.cnf<<EOF[mysqld]basedir=/application/mysqldatadir=/data/3307/datasocket=/data/3307/mysql.sockport=3307log-error=/data/3307/mysql.loglog_bin=/data/3307/mysql-binbinlog_format=rowskip-name-resolveserver-id=7gtid-mode=onenforce-gtid-consistency=truelog-slave-updates=1EOFcat >/data/3308/my.cnf<<EOF[mysqld]basedir=/application/mysqldatadir=/data/3308/dataport=3308socket=/data/3308/mysql.socklog-error=/data/3308/mysql.loglog_bin=/data/3308/mysql-binbinlog_format=rowskip-name-resolveserver-id=8gtid-mode=onenforce-gtid-consistency=truelog-slave-updates=1EOFcat >/data/3309/my.cnf<<EOF[mysqld]basedir=/application/mysqldatadir=/data/3309/datasocket=/data/3309/mysql.sockport=3309log-error=/data/3309/mysql.loglog_bin=/data/3309/mysql-binbinlog_format=rowskip-name-resolveserver-id=9gtid-mode=onenforce-gtid-consistency=truelog-slave-updates=1EOFcat >/data/3310/my.cnf<<EOF[mysqld]basedir=/application/mysqldatadir=/data/3310/datasocket=/data/3310/mysql.sockport=3310log-error=/data/3310/mysql.loglog_bin=/data/3310/mysql-binbinlog_format=rowskip-name-resolveserver-id=10gtid-mode=onenforce-gtid-consistency=truelog-slave-updates=1EOFcat >/etc/systemd/system/mysqld3307.service<<EOF[Unit]Description=MySQL ServerDocumentation=man:mysqld(8)Documentation=http://dev.mysql.com/doc/refman/en/using-systemd.htmlAfter=network.targetAfter=syslog.target[Install]WantedBy=multi-user.target[Service]User=mysqlGroup=mysqlExecStart=/application/mysql/bin/mysqld --defaults-file=/data/3307/my.cnfLimitNOFILE = 5000EOFcat >/etc/systemd/system/mysqld3308.service<<EOF[Unit]Description=MySQL ServerDocumentation=man:mysqld(8)Documentation=http://dev.mysql.com/doc/refman/en/using-systemd.htmlAfter=network.targetAfter=syslog.target[Install]WantedBy=multi-user.target[Service]User=mysqlGroup=mysqlExecStart=/application/mysql/bin/mysqld --defaults-file=/data/3308/my.cnfLimitNOFILE = 5000EOFcat >/etc/systemd/system/mysqld3309.service<<EOF[Unit]Description=MySQL ServerDocumentation=man:mysqld(8)Documentation=http://dev.mysql.com/doc/refman/en/using-systemd.htmlAfter=network.targetAfter=syslog.target[Install]WantedBy=multi-user.target[Service]User=mysqlGroup=mysqlExecStart=/application/mysql/bin/mysqld --defaults-file=/data/3309/my.cnfLimitNOFILE = 5000EOFcat >/etc/systemd/system/mysqld3310.service<<EOF[Unit]Description=MySQL ServerDocumentation=man:mysqld(8)Documentation=http://dev.mysql.com/doc/refman/en/using-systemd.htmlAfter=network.targetAfter=syslog.target[Install]WantedBy=multi-user.target[Service]User=mysqlGroup=mysqlExecStart=/application/mysql/bin/mysqld --defaults-file=/data/3310/my.cnfLimitNOFILE = 5000EOF========db02===============cat >/data/3307/my.cnf<<EOF[mysqld]basedir=/application/mysqldatadir=/data/3307/datasocket=/data/3307/mysql.sockport=3307log-error=/data/3307/mysql.loglog_bin=/data/3307/mysql-binbinlog_format=rowskip-name-resolveserver-id=17gtid-mode=onenforce-gtid-consistency=truelog-slave-updates=1EOFcat >/data/3308/my.cnf<<EOF[mysqld]basedir=/application/mysqldatadir=/data/3308/dataport=3308socket=/data/3308/mysql.socklog-error=/data/3308/mysql.loglog_bin=/data/3308/mysql-binbinlog_format=rowskip-name-resolveserver-id=18gtid-mode=onenforce-gtid-consistency=truelog-slave-updates=1EOFcat >/data/3309/my.cnf<<EOF[mysqld]basedir=/application/mysqldatadir=/data/3309/datasocket=/data/3309/mysql.sockport=3309log-error=/data/3309/mysql.loglog_bin=/data/3309/mysql-binbinlog_format=rowskip-name-resolveserver-id=19gtid-mode=onenforce-gtid-consistency=truelog-slave-updates=1EOFcat >/data/3310/my.cnf<<EOF[mysqld]basedir=/application/mysqldatadir=/data/3310/datasocket=/data/3310/mysql.sockport=3310log-error=/data/3310/mysql.loglog_bin=/data/3310/mysql-binbinlog_format=rowskip-name-resolveserver-id=20gtid-mode=onenforce-gtid-consistency=truelog-slave-updates=1EOFcat >/etc/systemd/system/mysqld3307.service<<EOF[Unit]Description=MySQL ServerDocumentation=man:mysqld(8)Documentation=http://dev.mysql.com/doc/refman/en/using-systemd.htmlAfter=network.targetAfter=syslog.target[Install]WantedBy=multi-user.target[Service]User=mysqlGroup=mysqlExecStart=/application/mysql/bin/mysqld --defaults-file=/data/3307/my.cnfLimitNOFILE = 5000EOFcat >/etc/systemd/system/mysqld3308.service<<EOF[Unit]Description=MySQL ServerDocumentation=man:mysqld(8)Documentation=http://dev.mysql.com/doc/refman/en/using-systemd.htmlAfter=network.targetAfter=syslog.target[Install]WantedBy=multi-user.target[Service]User=mysqlGroup=mysqlExecStart=/application/mysql/bin/mysqld --defaults-file=/data/3308/my.cnfLimitNOFILE = 5000EOFcat >/etc/systemd/system/mysqld3309.service<<EOF[Unit]Description=MySQL ServerDocumentation=man:mysqld(8)Documentation=http://dev.mysql.com/doc/refman/en/using-systemd.htmlAfter=network.targetAfter=syslog.target[Install]WantedBy=multi-user.target[Service]User=mysqlGroup=mysqlExecStart=/application/mysql/bin/mysqld --defaults-file=/data/3309/my.cnfLimitNOFILE = 5000EOFcat >/etc/systemd/system/mysqld3310.service<<EOF[Unit]Description=MySQL ServerDocumentation=man:mysqld(8)Documentation=http://dev.mysql.com/doc/refman/en/using-systemd.htmlAfter=network.targetAfter=syslog.target[Install]WantedBy=multi-user.target[Service]User=mysqlGroup=mysqlExecStart=/application/mysql/bin/mysqld --defaults-file=/data/3310/my.cnfLimitNOFILE = 5000EOF
推荐阅读
- 为什么要有分布式系统?
- 大型电商网站分布式秒杀系统设计三种姿势
- 京东架构专家分享京东架构之路
- 架构师大神带你读懂C++
- 高并发服务器架构--SEDA架构分析
- 系统架构进化过程
- 3分钟学会mysql数据库的逻辑架构原理
- 全面讲解分布式数据库架构设计特点
- 什么是架构?什么样的人才能被称之为架构师?架构师是做什么的?
- Zipkin架构简介