- vip => 192.168.18.101
- redis(master) + keepalived => 192.168.18.102
- redis(slave) + keepalived => 192.168.18.103
- sidekiq => 192.168.18.110
centos7
yum -y install epel-release
yum -y install redis
master
bind 0.0.0.0
slave
bind 0.0.0.0
slaveof 192.168.18.102 6379
systemctl start redis
systemctl enable redis
redis-cli role
1) "master"
2) (integer) 0
3) (empty list or set)
redis-cli role
1) "slave"
2) "192.168.18.102"
3) (integer) 6379
4) "connect"
5) (integer) -1
yum -y install keepalived
master
global_defs {
notification_email {
[email protected]
}
notification_email_from [email protected]
smtp_server 127.0.0.1
smtp_connect_timeout 30
router_id REDIS_KEEPALIVED
}
vrrp_script check_redis {
script "/usr/local/bin/check_redis.sh"
interval 2
fall 2
rise 2
}
vrrp_instance REDIS {
state BACKUP
nopreempt
interface eth1
virtual_router_id 51
priority 110
advert_int 1
unicast_peer {
192.168.18.103
}
authentication {
auth_type PASS
auth_pass redis
}
virtual_ipaddress {
192.168.18.101
}
track_script {
check_redis
}
notify_master /usr/local/bin/notify_master_redis.sh
notify_backup /usr/local/bin/notify_slave_redis.sh
}
slave
global_defs {
notification_email {
[email protected]
}
notification_email_from [email protected]
smtp_server 127.0.0.1
smtp_connect_timeout 30
router_id REDIS_KEEPALIVED
}
vrrp_script check_redis {
script "/usr/local/bin/check_redis.sh"
interval 2
fall 2
rise 2
}
vrrp_instance REDIS {
state BACKUP
nopreempt
interface eth1
virtual_router_id 51
priority 100
advert_int 1
unicast_peer {
192.168.18.102
}
authentication {
auth_type PASS
auth_pass redis
}
virtual_ipaddress {
192.168.18.101
}
track_script {
check_redis
}
notify_master /usr/local/bin/notify_master_redis.sh
notify_backup /usr/local/bin/notify_slave_redis.sh
}
#!/bin/sh
/bin/redis-cli info
#!/bin/sh
/bin/redis-cli slaveof no one
master
#!/bin/sh
/bin/redis-cli slaveof 192.168.18.103 6379
slave
#!/bin/sh
/bin/redis-cli slaveof 192.168.18.102 6379
systemctl start keepalived
systemctl enable keepalived
ip addr show dev eth1 | grep 192.168.18.101
http://qiita.com/nysalor/items/94ecd53c2141d1c27d1f
yum -y install ruby
echo 'gem: --no-ri --no-rdoc' > ~/.gemrc
gem i bundler