OneProxy高可用

进程级高可用
/oneproxy/conf/proxy.conf 中增加如下配置
[oneproxy]
keepalive = 1

ps -ef|grep oneproxy
root 25927 1 0 13:59 ? 00:00:00 /opt/oneproxy/bin/oneproxy –defaults-file=/oneproxy/conf/proxy.conf
root 25929 25927 0 13:59 ? 00:00:00 /opt/oneproxy/bin/oneproxy –defaults-file=/oneproxy/conf/proxy.conf
root 25950 25859 0 14:00 pts/3 00:00:00 grep oneproxy

模拟故障:kill掉oneproxy

kill -9 25929 ; tail -f ../log/oneproxy.log

2017-09-04 14:00:58: (critical) chassis-unix-daemon.c:227: [angel] PID=25929 died on signal=9 (it used 21 kBytes max) … waiting 3min before restart
2017-09-04 14:01:00: (critical) plugin oneproxy 6.1.3 (Aug 23 2017) started
2017-09-04 14:01:00: (critical) Max Open File-descriptors = 65535
2017-09-04 14:01:00: (critical) Enterprise Register Code = OVKY-PHJQ-UUBP-JCNY-RDHV
2017-09-04 14:01:00: (critical) valid config checksum = 3347008714
2017-09-04 14:01:01: (critical) Welcome to OneProxy Comminity Edition!
2017-09-04 14:01:01: (critical) Ping backend ([email protected]:3316) success, mark it up!
2017-09-04 14:01:01: (critical) Ping backend ([email protected]:3326) success, mark it up!
2017-09-04 14:01:01: (critical) Ping backend ([email protected]:3316) success, mark it up!
2017-09-04 14:01:01: (critical) Ping backend ([email protected]:3326) success, mark it up!

发现oneproxy可用自动重启
ps -ef|grep oneproxy
root 25927 1 0 13:59 ? 00:00:00 /oneproxy/bin/oneproxy –defaults-file=/opt/oneproxy/conf/proxy.conf
root 25952 25927 0 14:01 ? 00:00:56 /oneproxy/bin/oneproxy –defaults-file=/opt/oneproxy/conf/proxy.conf
root 26114 26094 0 16:07 pts/1 00:00:00 grep oneproxy

双机高可用
如果操作系统崩溃或者硬件故障,进程级高可用就会失效。OneProxy 自带
的双机热备方案,当一台机器宕机之后,另一台机器就会接管VIP,继续提供服务。

如果OneProxy1 宕机之后,则会发生切换

OneProxy1 IP :172.25.18.94
OneProxy2 IP:172.25.18.114

OneProxy1 上的配置方式:
/oneproxy/conf/proxy.conf 中增加如下配置
remote-address = 172.25.18.114:4041
vip-address = 172.25.18.20/eth0:0

OneProxy2 上的配置方式:
/oneproxy/conf/proxy.conf 中增加如下配置
remote-address = 172.25.18.94:4041
vip-address = 172.25.18.20/eth0:0

双机热备方案测试
OneProxy2:
../oneproxy.service stop ; tail -20f ../log/oneproxy.log
2017-09-04 13:46:05: (critical) stop working port for oneproxy restart

OneProxy1:
tail -f ../log/oneproxy.log
2017-09-04 13:46:06: (critical) Ping remote admin port (172.25.18.114:4041) failed!

ip a|grep 172.25.18
inet 172.25.18.20/8 brd 10.255.255.255 scope global eth0:0
inet 172.25.18.94/24 brd 172.25.18.255 scope global bond0

双机热备的情况下:
一个oneProxy挂掉(2017-09-04 13:46:05)
2017-09-04 13:46:05: (critical) stop working port for oneproxy restart
另一个oneproxy能在秒级接管。
2017-09-04 13:46:06: (critical) Ping remote admin port (172.25.18.114:4041) failed!

你可能感兴趣的:(MySQL)