memcached 双机热备
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
memcached 双机热备
一、需求背景
发现公司好多项目都用到memched。并且都是单点,memched服务器挂了就会影响业务,于是百度之,发现memched不可以集群,也没有看到有什么高可用方案,但是发现了repcached(memched主从复制),结合LVS的NAT模式不同端口转发实现memched双机HA,本文章记录本人的部署过程,从属实战,没有文字性的说明,欢迎各位指点。
二、环境:
1、系统环境:
1.CentOS release 6.4 (Final)
2、网络环境
1.调度机(master):
2.vip:172.28.26.100
3.vip1:172.28.16.100(lvs转发网关)
4.eth1:172.28.26.101 (内网)
5.eth2:172.28.1
6.101(lvs转发网段)
6.调度机(backup):
7.eth1:172.28.26.99 (内网)
8.eth2:172.28.16.99(lvs转发网段)
9.memched备节点:
10.eth1:172.28.26.102 (内网)
11.eth2:172.28.16.102(lvs转发网段)
12.memched主节点:
13.eth1:172.28.26.103 (内网)
14.eth2:172.28.16.103(lvs转发网段)
3、路由策略
1.调度机(master):
2.echo '201 eth1'>> /etc/iproute2/rt_tables
3.echo 'default table eth1 via 172.28.26.1 dev eth1'> /etc/sysconfig/netwo
rk-scripts/route-eth1
4.echo 'from 172.28.26.101/25
5.255.255.255 table eth1'> /etc/sysconfig/networ
k-scripts/rule-eth1
5.echo 'from 172.28.2
6.100/255.255.255.255 table eth1'>> /etc/sysconfig/netwo
rk-scripts/rule-eth1
6.echo 'from 172.28.16.101/32 table ZW_LVS_LAN'> /etc/sysconfig/network-scrip
ts/rule-eth2
7.memched节点1:
8.echo 'default table ZW_LVS_LAN via 172.28.16.100'> /etc/sysconfig/network-
scripts/route-eth2
9.echo 'from 172.28.16.0/24 table ZW_LVS_LAN'> /etc/sysconfig/network-scripts
/rule-eth2
10.echo '202 ZW_LVS_LAN'>> /etc/iproute2/rt_tables
11.memched节点2:
12.echo 'default table ZW_LVS_LAN via 172.28.16.100'> /etc/sysconfig/network-
scripts/route-eth2
13.echo 'from 172.28.16.0/24 table ZW_LVS_LAN'> /etc/sysconfig/network-scripts
/rule-eth2
14.echo '202 ZW_LVS_LAN'>> /etc/iproute2/rt_tables
4、内核参数
1.fs.file-max= 1000000
2.kernel.core_uses_pid = 1
3.kernel.msgmax = 1048560
4.kernel.msgmnb = 1073741824
5.kernel.shmall = 4294967296
6.kernel.shmmax = 68719476736
7.kernel.sysrq = 0
dev_max_backlog = 1048576
.core.rmem_default = 2097152
.core.rmem_max = 16777216
.core.somaxconn = 1048576
.core.wmem_default = 2097152
.core.wmem_max = 16777216
.ipv4.conf.default.accept_source_route = 0
.ipv4.conf.default.rp_filter = 1
.ipv4.ip_forward = 1
.ipv4.ip_local_port_range = 1024 65000
.ipv4.neigh.default.gc_thresh1 = 10240
.ipv4.neigh.default.gc_thresh2 = 40960
.ipv4.neigh.default.gc_thresh3 = 81920
.ipv4.tcp_fin_timeout = 1
.ipv4.tcp_keepalive_intvl = 15
.ipv4.tcp_keepalive_probes = 5
.ipv4.tcp_keepalive_time = 30
.ipv4.tcp_max_orphans = 3276800