MySQL MM+KeepAlived高可用架构部署测试

上传人:n**** 文档编号:37442456 上传时间:2018-04-16 格式:DOCX 页数:26 大小:591.03KB
返回 下载 相关 举报
MySQL MM+KeepAlived高可用架构部署测试_第1页
第1页 / 共26页
MySQL MM+KeepAlived高可用架构部署测试_第2页
第2页 / 共26页
MySQL MM+KeepAlived高可用架构部署测试_第3页
第3页 / 共26页
MySQL MM+KeepAlived高可用架构部署测试_第4页
第4页 / 共26页
MySQL MM+KeepAlived高可用架构部署测试_第5页
第5页 / 共26页
点击查看更多>>
资源描述

《MySQL MM+KeepAlived高可用架构部署测试》由会员分享,可在线阅读,更多相关《MySQL MM+KeepAlived高可用架构部署测试(26页珍藏版)》请在金锄头文库上搜索。

1、MySQL MM+KeepAlived 高可用架构部署测试马飞2017-2-23一、环境准备一、环境准备1.11.1 操作系统信息操作系统信息安装三台 CentOS6.7 64 位操作系统。采用最小安装模式。sed -i s/=enforcing/=disabled/g /etc/selinux/configservice itpables stopchkconfig iptables off1.21.2 配置配置 NTPNTP 同步时间同步时间yum -y install ntp vi /etc/ntp.conf增加 3 个时间服务器 server iburst #西南地区网络中心 ser

2、ver iburst #西北地区网络中心 server iburst #东北地区网络中心启动 ntp 服务 systemctl start ntpd systemctl enable ntpd 查看状态 ntpq -p1.31.3 配置角色信息配置角色信息主机名IP 地址描述Server idDb1192.168.8.100Master11Db2192.168.8.101Master22Db3192.168.8.102Slave131.41.4 服务角色及描述服务角色及描述IP 地址角色描述192.168.8.100ReadWrite r应用程序连接该 IP 对主库进写请求192.168.

3、8.101ReadWrite r应用程序连接该 IP 对主库进写请求192.168.8.102Read Only应用程序连接到该 IP 处理读请求192.168.8.140ReadWrite r应用程序连接到该虚 IP 处理读写请求(不直 联 100,101) ,通过连接 140 实现高可用。1.51.5 配置配置/etc/hosts/etc/hosts在其中添加所有的主机信息:rootdb1 mysql# more /etc/hosts 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 :

4、1 localhost localhost.localdomain localhost6 localhost6.localdomain6 192.168.8.32 db1 192.168.8.33 db2 192.168.8.40b3二、安装二、安装 MySQLMySQL 2.12.1 卸载卸载 rpmrpm 包包roothadoop61 # rpm -qa | grep -i mysql mysql-5.1.73-5.el6_7.1.x86_64 mysql-server-5.1.73-5.el6_7.1.x86_64 perl-DBD-MySQL-4.013-3.el6.x86_64 my

5、sql-devel-5.1.73-5.el6_7.1.x86_64 mysql-libs-5.1.73-5.el6_7.1.x86_64rpm -ev mysql-devel-5.1.73-5.el6_7.1.x86_64 rpm -ev mysql-server-5.1.73-5.el6_7.1.x86_64 rpm -ev perl-DBD-MySQL-4.013-3.el6.x86_64 rpm -ev mysql-5.1.73-5.el6_7.1.x86_64 roothadoop61 # rpm -e -nodeps mysql-libs-5.1.73-5.el6_7.1.x86_6

6、4 warning: /etc/f saved as /etc/f.rpmsave http:/ 收集收集 mysqlmysql 对应的文件夹对应的文件夹roothadoop61 # find / -name mysql /var/lib/mysql /var/lib/mysql/mysql2.32.3 删除删除 mysqlmysql 对应的文件夹对应的文件夹rm -rf /var/lib/mysql2.42.4 下载下载 mysqlmysql 安装程序安装程序2.52.5 解压解压 mysqlmysql 安装程序安装程序tar -zxvf mysql-5.6.31-linux-glibc2.

7、5-x86_64.tar.gz -C /usr/local cd /usr/local mv mysql-5.6.31-linux-glibc2.5-x86_64 mysql5.62.62.6 添加用户和组添加用户和组groupadd mysql useradd -r -g mysql mysql2.72.7 安装数据库安装数据库进入安装 mysql 软件目录: cd /usr/local/mysql修改当前目录拥有者为 mysql 用户: chown -R mysql:mysql ./安装数据库: mkdir -p /data/mysql/data chown -R mysql.mysql

8、/data/mysql#若是最小安装系统,还需要安装以下包: yum -y install perl perl-devel yum -y install libaio./scripts/mysql_install_db -basedir=/usr/local/mysql5.6 -datadir=/data/mysql/data - user=mysql修改配置文件: cp /usr/local/mysql5.6/f /etc/f# vi /etc/f mysqld basedir=/usr/local/mysql datadir=/data/mysql/data port=3306 sql_m

9、ode=NO_ENGINE_SUBSTITUTIO character-set-server=utf8 mysql default-character-set=utf8 client default-character-set=utf8启动脚本放到开机初始化目录 cp support-files/mysql.server /etc/init.d/mysql启动 mysql 服务: service mysql start查看 mysql 进程: ps -ef|grep mysql三、修改三、修改 MySQLMySQL 配置配置db1,db2,db3 三台主机上分别建立如下目录 mkdir /va

10、r/log/mysql #从 db1 上导出数据 mysqldump -master-data=2 -single-transaction -R -triggers -A all.sql#拷贝 all.sql 至 db2,db3 scp all.sql rootdb2:/usr/local/mysql5.6 scp all.sql rootdb3:/usr/local/mysql5.6(2)配置 db2#将 all.sql 导入 db2,db3 从库mysql -f -default-character-set=utf8 show slave statusG * 1. row *Slave_I

11、O_State: Waiting for master to send eventMaster_Host: 192.168.1.212Master_User: replicationMaster_Port: 3306Connect_Retry: 10Master_Log_File: mysql-master-002-bin.000001Read_Master_Log_Pos: 120Relay_Log_File: mysql-master-001-bin.000004Relay_Log_Pos: 294 Relay_Master_Log_File: mysql-master-002-bin.0

12、00001Slave_IO_Running: YesSlave_SQL_Running: YesReplicate_Do_DB:Replicate_Ignore_DB: mysqlReplicate_Do_Table: Replicate_Ignore_Table: Replicate_Wild_Do_Table: Replicate_Wild_Ignore_Table:Last_Errno: 0Last_Error:Skip_Counter: 0Exec_Master_Log_Pos: 120Relay_Log_Space: 472Until_Condition: NoneUntil_Log

13、_File:Until_Log_Pos: 0Master_SSL_Allowed: NoMaster_SSL_CA_File:Master_SSL_CA_Path:Master_SSL_Cert:Master_SSL_Cipher:Master_SSL_Key: Seconds_Behind_Master: 0 Master_SSL_Verify_Server_Cert: NoLast_IO_Errno: 0Last_IO_Error:Last_SQL_Errno: 0Last_SQL_Error: Replicate_Ignore_Server_Ids:Master_Server_Id: 2

14、Master_UUID: 3d3b9f4f-f74f-11e5-9a30-005056b324c4Master_Info_File: /opt/mysql/data/master.infoSQL_Delay: 0SQL_Remaining_Delay: NULL Slave_SQL_Running_State: Slave has read all relay log; waiting for the slave I/O thread to update itMaster_Retry_Count: 86400Master_Bind: Last_IO_Error_Timestamp: Last_

15、SQL_Error_Timestamp:Master_SSL_Crl:Master_SSL_Crlpath:Retrieved_Gtid_Set:Executed_Gtid_Set:Auto_Position: 0 1 row in set (0.00 sec)注意注意: Slave_IO_Running: Yes Slave_SQL_Running: Yes4.24.2 配置配置 db1db1 作为主复制到作为主复制到 db3db3(1)配置 db3 指定 change master 为 db1,表示从 db1 复制到 db3#ssh 到 db3 服务器 mysql -u root -p #在 mysql 控制台录入 #这个是在 f 中没有使用 GTID(MySQL5.6 新特性)下的命令: CHANGE MASTER TO MASTER_HOST=192.168.8.33, MASTER_USER=repl, MASTER_PASSWORD=repl, MASTER_PORT=3306, MASTER_LOG_FILE=mysql-bin.000007, MASTER_LOG_POS=120, MASTER_CONNECT_RETRY=10;#

展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 电子/通信 > 综合/其它

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号