【转载】MySQL和Keepalived高可用双主复制

服务器主机IP和虚拟浮动IP配置

RealServer A 192.168.75.133
RealServer B 192.168.75.134
VIP A 192.168.75.110
VIP B 192.168.75.111

安装KeepAlived软件包

[[email protected] ~]# yum install keepalived

================================================================================
 Package Arch Version Repository Size
================================================================================
 Installing:
 keepalived i686 1.2.7-3.el6 base 170 k
 Installing for dependencies:
 libnl i686 1.1.4-2.el6 base 124 k
 lm_sensors-libs i686 3.1.1-17.el6 base 37 k
 net-snmp-libs i686 1:5.5-49.el6_5.1 updates 1.5 M
 perl i686 4:5.10.1-136.el6 base 9.7 M
 perl-Module-Pluggable i686 1:3.90-136.el6 base 40 k
 perl-Pod-Escapes i686 1:1.04-136.el6 base 32 k
 perl-Pod-Simple i686 1:3.13-136.el6 base 212 k
 perl-libs i686 4:5.10.1-136.el6 base 593 k
 perl-version i686 3:0.77-136.el6 base 51 k
Transaction Summary
================================================================================
Install 10 Package(s)

查看RPM包的文件路径

[[email protected] ~]# rpm -lq keepalived
 /etc/keepalived
 /etc/keepalived/keepalived.conf
 /etc/rc.d/init.d/keepalived
 /etc/sysconfig/keepalived
 /usr/bin/genhash
 /usr/sbin/keepalived
 /usr/share/doc/keepalived-1.2.7
 /usr/share/doc/keepalived-1.2.7/AUTHOR
 /usr/share/doc/keepalived-1.2.7/CONTRIBUTORS
 /usr/share/doc/keepalived-1.2.7/COPYING
 /usr/share/doc/keepalived-1.2.7/ChangeLog
 /usr/share/doc/keepalived-1.2.7/README
 /usr/share/doc/keepalived-1.2.7/TODO
 /usr/share/doc/keepalived-1.2.7/keepalived.conf.HTTP_GET.port
 /usr/share/doc/keepalived-1.2.7/keepalived.conf.IPv6
 /usr/share/doc/keepalived-1.2.7/keepalived.conf.SMTP_CHECK
 /usr/share/doc/keepalived-1.2.7/keepalived.conf.SSL_GET
 /usr/share/doc/keepalived-1.2.7/keepalived.conf.SYNOPSIS
 /usr/share/doc/keepalived-1.2.7/keepalived.conf.fwmark
 /usr/share/doc/keepalived-1.2.7/keepalived.conf.inhibit
 /usr/share/doc/keepalived-1.2.7/keepalived.conf.misc_check
 /usr/share/doc/keepalived-1.2.7/keepalived.conf.misc_check_arg
 /usr/share/doc/keepalived-1.2.7/keepalived.conf.quorum
 /usr/share/doc/keepalived-1.2.7/keepalived.conf.sample
 /usr/share/doc/keepalived-1.2.7/keepalived.conf.status_code
 /usr/share/doc/keepalived-1.2.7/keepalived.conf.track_interface
 /usr/share/doc/keepalived-1.2.7/keepalived.conf.virtual_server_group
 /usr/share/doc/keepalived-1.2.7/keepalived.conf.virtualhost
 /usr/share/doc/keepalived-1.2.7/keepalived.conf.vrrp
 /usr/share/doc/keepalived-1.2.7/keepalived.conf.vrrp.localcheck
 /usr/share/doc/keepalived-1.2.7/keepalived.conf.vrrp.lvs_syncd
 /usr/share/doc/keepalived-1.2.7/keepalived.conf.vrrp.routes
 /usr/share/doc/keepalived-1.2.7/keepalived.conf.vrrp.scripts
 /usr/share/doc/keepalived-1.2.7/keepalived.conf.vrrp.static_ipaddress
 /usr/share/doc/keepalived-1.2.7/keepalived.conf.vrrp.sync
 /usr/share/man/man1/genhash.1.gz
 /usr/share/man/man5/keepalived.conf.5.gz
 /usr/share/man/man8/keepalived.8.gz
 /usr/share/snmp/mibs/KEEPALIVED-MIB.txt
 [[email protected] ~]#

KeepAlived双主RealServer A配置
! Configuration File for keepalived

global_defs {
notification_email {
[email protected]
[email protected]
[email protected]
}
notification_email_from [email protected]
smtp_server 192.168.200.1
smtp_connect_timeout 30
router_id LVS_DEVEL
}

vrrp_instance VI_1 {
state MASTER
interface eth0
virtual_router_id 51
priority 100
advert_int 1
authentication {
auth_type PASS
auth_pass 1111
}
virtual_ipaddress {
#192.168.200.16
#192.168.200.17
#192.168.200.18
192.168.75.110
}
}

vrrp_instance VI_2 {
state BACKUP
interface eth0
virtual_router_id 52
priority 50
advert_int 1
authentication {
auth_type PASS
auth_pass 2222
}
virtual_ipaddress {
#192.168.200.16
#192.168.200.17
#192.168.200.18
192.168.75.111
}
}

KeepAlived双主RealServer B配置
! Configuration File for keepalived

global_defs {
notification_email {
[email protected]
[email protected]
[email protected]
}
notification_email_from [email protected]
smtp_server 192.168.200.1
smtp_connect_timeout 30
router_id LVS_DEVEL
}

vrrp_instance VI_1 {
state BACKUP
interface eth0
virtual_router_id 51
priority 50
advert_int 1
authentication {
auth_type PASS
auth_pass 1111
}
virtual_ipaddress {
#192.168.200.16
#192.168.200.17
#192.168.200.18
192.168.75.110
}
}

vrrp_instance VI_2 {
state MASTER
interface eth0
virtual_router_id 52
priority 100
advert_int 1
authentication {
auth_type PASS
auth_pass 2222
}
virtual_ipaddress {
#192.168.200.16
#192.168.200.17
#192.168.200.18
192.168.75.111
}
}
在RealServer B上启动KeepAlived服务
[[email protected] keepalived]# chkconfig –list keepalived
keepalived 0:off 1:off 2:off 3:off 4:off 5:off 6:off
[[email protected] keepalived]# chkconfig –level 35 keepalived on
[[email protected] keepalived]# service keepalived start
Starting keepalived: [ OK ]
[[email protected] keepalived]#

查看两个Virtual IP信息
[[email protected] keepalived]# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN qlen 1000
link/ether 00:0c:29:7c:b3:f2 brd ff:ff:ff:ff:ff:ff
inet 192.168.75.134/24 brd 192.168.75.255 scope global eth0
inet 192.168.75.110/32 scope global eth0
inet 192.168.75.111/32 scope global eth0
inet6 fe80::20c:29ff:fe7c:b3f2/64 scope link
valid_lft forever preferred_lft forever
[[email protected] keepalived]#
在RealServer A上启动KeepAlived服务后查看Virtual IP信息
[[email protected] keepalived]# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN qlen 1000
link/ether 00:0c:29:13:94:f0 brd ff:ff:ff:ff:ff:ff
inet 192.168.75.133/24 brd 192.168.75.255 scope global eth0
inet 192.168.75.110/32 scope global eth0
inet6 fe80::20c:29ff:fe13:94f0/64 scope link
valid_lft forever preferred_lft forever
[[email protected] keepalived]#

在RealServer B上再次查看Virtual IP信息
[[email protected] keepalived]# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 00:0c:29:7c:b3:f2 brd ff:ff:ff:ff:ff:ff
inet 192.168.75.134/24 brd 192.168.75.255 scope global eth0
inet 192.168.75.111/32 scope global eth0
inet6 fe80::20c:29ff:fe7c:b3f2/64 scope link
valid_lft forever preferred_lft forever
[[email protected] keepalived]#
————————–MySQL

[[email protected] ~]# yum install mysql-server mysql

================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
mysql i686 5.1.73-3.el6_5 updates 903 k
mysql-server i686 5.1.73-3.el6_5 updates 8.8 M
Installing for dependencies:
perl-DBD-MySQL i686 4.013-3.el6 base 134 k
perl-DBI i686 1.609-4.el6 base 705 k

Transaction Summary
================================================================================
Install 4 Package(s)
[[email protected] ~]# /usr/bin/mysqladmin -u root password ‘mysqlpass’

[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0

server-id=1
log-bin=mysql-bin
binlog-ignore-db=mysql
binlog_format=mixed
expire_logs_days=7
sync_binlog=1

auto_increment_offset=1
auto_increment_increment=2
log_slave_updates

[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

—————————
server-id=2
log-bin=mysql-bin
binlog-ignore-db=mysql
binlog_format=mixed
expire_logs_days=7
sync_binlog=1

auto_increment_offset=2
auto_increment_increment=2
log_slave_updates

———————————–
添加复制用户并授权
A

mysql> grant replication slave on *.* to [email protected]’192.168.75.134′ identified by ‘replpasswd’;
Query OK, 0 rows affected (0.00 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

B

mysql> grant replication slave on *.* to [email protected]’192.168.75.133′ identified by ‘replpasswd’;
Query OK, 0 rows affected (0.00 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

—————-
锁定表为只读状态,并查看二进制日志的当前位置信息
A

mysql> flush tables with read lock;
Query OK, 0 rows affected (0.00 sec)

mysql> show master status;
+——————+———-+————–+——————+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB |
+——————+———-+————–+——————+
| mysql-bin.000001 | 348 | | mysql |
+——————+———-+————–+——————+
1 row in set (0.00 sec)
B

mysql> flush tables with read lock;
Query OK, 0 rows affected (0.00 sec)

mysql> show master status;
+——————+———-+————–+——————+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB |
+——————+———-+————–+——————+
| mysql-bin.000003 | 491 | | mysql |
+——————+———-+————–+——————+
1 row in set (0.00 sec)
——————-
各自指定对方为master主机的连接配置信息和位置信息
A

mysql> change master to master_host=’192.168.75.134′,master_user=’repl’,master_password=’replpasswd’,master_log_file=’mysql-bin.000003′,master_log_pos=491;
Query OK, 0 rows affected (0.03 sec)

mysql>
B

mysql> change master to master_host=’192.168.75.133′,master_user=’repl’,master_password=’replpasswd’,master_log_file=’mysql-bin.000001′,master_log_pos=348;
Query OK, 0 rows affected (0.03 sec)

mysql>
————–
解除表锁定,分别启动Slave并查看复制运行状态
A

mysql> unlock tables;
Query OK, 0 rows affected (0.00 sec)

mysql> start slave;
Query OK, 0 rows affected (0.00 sec)

mysql> show slave status\G;
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 192.168.75.134
Master_User: repl
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mysql-bin.000003
Read_Master_Log_Pos: 491
Relay_Log_File: mysqld-relay-bin.000002
Relay_Log_Pos: 251
Relay_Master_Log_File: mysql-bin.000003
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
Replicate_Do_DB:
Replicate_Ignore_DB:
Replicate_Do_Table:
Replicate_Ignore_Table:
Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
Last_Errno: 0
Last_Error:
Skip_Counter: 0
Exec_Master_Log_Pos: 491
Relay_Log_Space: 407
Until_Condition: None
Until_Log_File:
Until_Log_Pos: 0
Master_SSL_Allowed: No
Master_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: No
Last_IO_Errno: 0
Last_IO_Error:
Last_SQL_Errno: 0
Last_SQL_Error:
1 row in set (0.00 sec)

ERROR:
No query specified

mysql>

B
mysql> unlock tables;
Query OK, 0 rows affected (0.00 sec)

mysql> start slave;
Query OK, 0 rows affected (0.00 sec)
mysql> start slave;
Query OK, 0 rows affected (0.00 sec)

mysql> show slave status\G;
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 192.168.75.133
Master_User: repl
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mysql-bin.000001
Read_Master_Log_Pos: 348
Relay_Log_File: mysqld-relay-bin.000002
Relay_Log_Pos: 251
Relay_Master_Log_File: mysql-bin.000001
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
Replicate_Do_DB:
Replicate_Ignore_DB:
Replicate_Do_Table:
Replicate_Ignore_Table:
Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
Last_Errno: 0
Last_Error:
Skip_Counter: 0
Exec_Master_Log_Pos: 348
Relay_Log_Space: 407
Until_Condition: None
Until_Log_File:
Until_Log_Pos: 0
Master_SSL_Allowed: No
Master_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: No
Last_IO_Errno: 0
Last_IO_Error:
Last_SQL_Errno: 0
Last_SQL_Error:
1 row in set (0.00 sec)

ERROR:
No query specified

mysql>

[[email protected] ~]# netstat -nt |grep 3306
tcp 0 0 192.168.75.133:3306 192.168.75.134:36244 ESTABLISHED
tcp 0 0 192.168.75.133:60121 192.168.75.134:3306 ESTABLISHED
[[email protected] ~]#
[[email protected] keepalived]# netstat -nt |grep 3306
tcp 0 0 192.168.75.134:3306 192.168.75.133:60121 ESTABLISHED
tcp 0 0 192.168.75.134:36244 192.168.75.133:3306 ESTABLISHED
[[email protected] keepalived]#
———————–
测试:
A
mysql> create database aaa;
Query OK, 1 row affected (0.00 sec)

mysql>
B

mysql> show databases;
+——————–+
| Database |
+——————–+
| information_schema |
| aaa |
| mysql |
| test |
+——————–+
4 rows in set (0.00 sec)

mysql> create database bbb;
Query OK, 1 row affected (0.00 sec)

mysql>

A

mysql> show databases;
+——————–+
| Database |
+——————–+
| information_schema |
| aaa |
| bbb |
| mysql |
| test |
+——————–+
5 rows in set (0.01 sec)

mysql>

——————–

VIP测试

A

mysql> create database ccc;
Query OK, 1 row affected (0.00 sec)

mysql> grant all on ccc.* to [email protected]’%’;
Query OK, 0 rows affected (0.00 sec)

mysql> set password for [email protected]’%’=password(‘cccpwd’);
Query OK, 0 rows affected (0.00 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)

mysql>
VIP 192.168.75.110

[[email protected] ~]# mysql -u cccuser -pcccpwd -h 192.168.75.110
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 5.1.73-log Source distribution

Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

mysql> use ccc;
Database changed

mysql> create table list (id int(4) not null primary key auto_increment,
-> name char(20) not null,
-> address char(40) not null);
Query OK, 0 rows affected (0.01 sec)

mysql> show tables;
+—————+
| Tables_in_ccc |
+—————+
| list |
+—————+
1 row in set (0.00 sec)

mysql> quit
Bye
[[email protected] ~]#

VIP 192.168.75.111

[[email protected] ~]# mysql -u cccuser -pcccpwd -h 192.168.75.111
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 9
Server version: 5.1.73-log Source distribution

Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

mysql> use ccc;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> show tables;
+—————+
| Tables_in_ccc |
+—————+
| list |
+—————+
1 row in set (0.00 sec)

mysql> quit
Bye
[[email protected] ~]#
————————-
关闭RealServer B 测试KeepAlived VIP可用性和数据库连接
[[email protected] ~]# mysql -u cccuser -pcccpwd -h 192.168.75.110
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 10
Server version: 5.1.73-log Source distribution

Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

mysql> quit
Bye
[[email protected] ~]# mysql -u cccuser -pcccpwd -h 192.168.75.111
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 11
Server version: 5.1.73-log Source distribution

Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

mysql> quit
Bye
[[email protected] ~]#
在RealServer B关闭情况下的ping测试
[[email protected] ~]# ping -c 4 192.168.75.110
PING 192.168.75.110 (192.168.75.110) 56(84) bytes of data.
64 bytes from 192.168.75.110: icmp_seq=1 ttl=64 time=0.535 ms
64 bytes from 192.168.75.110: icmp_seq=2 ttl=64 time=0.312 ms
64 bytes from 192.168.75.110: icmp_seq=3 ttl=64 time=0.351 ms
64 bytes from 192.168.75.110: icmp_seq=4 ttl=64 time=0.356 ms

— 192.168.75.110 ping statistics —
4 packets transmitted, 4 received, 0% packet loss, time 3001ms
rtt min/avg/max/mdev = 0.312/0.388/0.535/0.088 ms
[[email protected] ~]# ping -c 4 192.168.75.111
PING 192.168.75.111 (192.168.75.111) 56(84) bytes of data.
64 bytes from 192.168.75.111: icmp_seq=1 ttl=64 time=0.572 ms
64 bytes from 192.168.75.111: icmp_seq=2 ttl=64 time=0.301 ms
64 bytes from 192.168.75.111: icmp_seq=3 ttl=64 time=0.452 ms
64 bytes from 192.168.75.111: icmp_seq=4 ttl=64 time=0.293 ms

— 192.168.75.111 ping statistics —
4 packets transmitted, 4 received, 0% packet loss, time 3006ms
rtt min/avg/max/mdev = 0.293/0.404/0.572/0.117 ms
[[email protected] ~]#

原文地址:http://www.linuxcache.com/archives/2831

转载请注明原文地址

时间: 2024-10-06 21:55:40

【转载】MySQL和Keepalived高可用双主复制的相关文章

Nginx+keepalived(高可用双主模式)

Nginx+keepalived(高可用双主模式) tips:前面已经介绍了nginx+keepalived高可用主从模式,今天补充下高可用的双主模式,均可以作为主机使用 server1:192.168.237.128             VIP1:192.168.237.10 server2:192.168.237.129             VIP2:192.168.237.20 vim /etc/keepalived/keepalived.conf //编辑配置文件,增加一段新的v

keepalived高可用双主配置文件

###########################lb01 cat /etc/keepalived/keepalived.conf ! Configuration File for keepalived_lb01 global_defs { #  notification_email { #  [email protected] #  } router_id LB01 } vrrp_script check_lb { script "/server/scripts/check_lb.sh&q

基于heartbeat v1配置mysql和httpd的高可用双主模型

一.配置高可用集群的前提:(以两节点的heartbeat为例) ⑴时间必须保持同步 ⑵节点之间必须用名称互相通信 建议使用/etc/hosts,而不要用DNS 集群中使用的主机名为`uname -n`表示的主机名: ⑶ping node(仅偶数节点才需要) ⑷ssh密钥认证进行无障碍通信: 二.heartbeat v1的配置 程序主配置文件:ha.cf 认证密钥:authkeys, 其权限必须为组和其它无权访问: 资源配置文件:haresources /usr/share/doc/heartbe

MySQL的keepalived高可用监控脚本

MySQL的keepalived高可用监控脚本 MySQL(或者其它服务)的keepalived高可用监控脚本 开发脚本需求 :我们知道,keepalive是基于虚拟ip的存活来判断是否抢占master的机制的,但是如果我们做了MySQL的keepalived的高可用的时候,就要考虑一种情况的发生,那就是如果机器网卡并没有断,二十由于MySQL服务的不稳定,或者人为的误操作,导致的服务关闭,会引起的结果就是,keepalive并不会切换,因为并不是主master的虚拟ip不存在,而是服务已经停止

mysql高可用双主+keepalived

Mysql双主复制 实验拓扑:sql1  192.168.10.1   server id 1 vip 192.168.10.100 Sql2  192.168.10.2   server id 2 vip 192.168.10.100 客户端 192.168.10.3 Sql1配置双主 主库配置:vim /etc/my.cnf Log-bin=mysql-bin    //打开二进制日志 Server-id=1 Service mysqld start   //重启mysql进程 登录到mys

mysql学习-mysql8.0配置双主复制+keepalived实现高可用架构

一般小型公司数据库,使用主从复制即可保证数据库的高可用,但是一旦主数据库故障,切换到从库需要一定的时间,这样就导致了停机时间过长,不能及时恢复业务.使用双主(master)配合keepalived这种mysql高可用架构也是基于主从复制的原理而搭建的.这是一种简单.便捷的解决方案,在高可用集群环境中,keepalived使用vip,利用keepalived自带的服务监控功能和自定义脚本来实现mysql故障时自动切换. 1.mysql双主复制介绍 双主复制,就是相互做主从复制,每个master既是

[Mysql高可用]——双主互备+keepalived

实验架构图    实验环境 主机名 操作系统 Mysql版本 keepalived版本 主机IP VIP lyj1(Master/Slave) Red Hat release 6.5 Mysql5.6.31 keepalived-1.2.12 10.0.100.201 10.0.100.220 lyj2(Slave/Master) Red Hat release 6.5 Mysql5.6.31 keepalived-1.2.12 10.0.100.202 构建双主互备 1. 分别修改DB1和DB

keepAlived+nginx实现高可用双主模型LVS

实验目的: 利用keepalived实现高可用反向代理的nginx.以及双主模型的ipvs 实验环境: node1:在nginx做代理时做反向代理节点,在keepalived实现LVS时做Director.VIP1:172.16.18.22 VIP2:172.16.18.23 node2:在nginx做代理时做反向代理节点,在keepalived实现LVS时做Director.VIP1:172.16.18.22 VIP2:172.16.18.23 node3:在nginx做代理时做web服务器.

mysql主从+keepalived高可用

两台机子,一台是192.168.223.143做主,一台是192.168.223.144主从,现在要实现的需求是两台机子做主从+高可用,VIP这里设置为192.168.223.100 首先在两台机子上装好mysql,做好主从复制, 参考http://pc1990.blog.51cto.com/10541224/1687171 二.在两台机子上安装keepalived tar  –zxvf  keepalived-1.2.7.tar.gz cd keepalived-1.2.7 yum insta