|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
小知识:Linux发展和成长过程始终依赖着五个重要支柱:UNIX操作系统、MINIX操作系统、GNU计划、POSIX标准和Internet网络。
1、需求背景
发明公司很多多少项目都用到memched。而且都是单点,memched办事器挂了就会影响营业,因而百度之,发明memched不成以集群,也没有看到有甚么高可用计划,可是发明了repcached(memched主从复制),分离LVS的NAT形式分歧端口转发完成memched双机HA,本文章纪录自己的部署历程,附属实战,没有笔墨性的申明,接待列位指导。
2、情况:
1、体系情况:
[/code]2、收集情况
[/code]
- 调剂机(master):
- vip:172.28.26.100
- vip1:172.28.16.100(lvs转发网关)
- eth1:172.28.26.101(内网)
- eth2:172.28.16.101(lvs转发网段)
- 调剂机(backup):
- eth1:172.28.26.99(内网)
- eth2:172.28.16.99(lvs转发网段)
- memched备节点:
- eth1:172.28.26.102(内网)
- eth2:172.28.16.102(lvs转发网段)
- memched主节点:
- eth1:172.28.26.103(内网)
- eth2:172.28.16.103(lvs转发网段)
3、路由战略
[/code]
- 调剂机(master):
- echo201eth1>>/etc/iproute2/rt_tables
- echodefaulttableeth1via172.28.26.1deveth1>/etc/sysconfig/network-scripts/route-eth1
- echofrom172.28.26.101/255.255.255.255tableeth1>/etc/sysconfig/network-scripts/rule-eth1
- echofrom172.28.26.100/255.255.255.255tableeth1>>/etc/sysconfig/network-scripts/rule-eth1
- echofrom172.28.16.101/32tableZW_LVS_LAN>/etc/sysconfig/network-scripts/rule-eth2
- memched节点1:
- echodefaulttableZW_LVS_LANvia172.28.16.100>/etc/sysconfig/network-scripts/route-eth2
- echofrom172.28.16.0/24tableZW_LVS_LAN>/etc/sysconfig/network-scripts/rule-eth2
- echo202ZW_LVS_LAN>>/etc/iproute2/rt_tables
- memched节点2:
- echodefaulttableZW_LVS_LANvia172.28.16.100>/etc/sysconfig/network-scripts/route-eth2
- echofrom172.28.16.0/24tableZW_LVS_LAN>/etc/sysconfig/network-scripts/rule-eth2
- echo202ZW_LVS_LAN>>/etc/iproute2/rt_tables
4、内核参数
[/code]
- fs.file-max=1000000
- kernel.core_uses_pid=1
- kernel.msgmax=1048560
- kernel.msgmnb=1073741824
- kernel.shmall=4294967296
- kernel.shmmax=68719476736
- kernel.sysrq=0
- net.core.netdev_max_backlog=1048576
- net.core.rmem_default=2097152
- net.core.rmem_max=16777216
- net.core.somaxconn=1048576
- net.core.wmem_default=2097152
- net.core.wmem_max=16777216
- net.ipv4.conf.default.accept_source_route=0
- net.ipv4.conf.default.rp_filter=1
- net.ipv4.ip_forward=1
- net.ipv4.ip_local_port_range=102465000
- net.ipv4.neigh.default.gc_thresh1=10240
- net.ipv4.neigh.default.gc_thresh2=40960
- net.ipv4.neigh.default.gc_thresh3=81920
- net.ipv4.tcp_fin_timeout=1
- net.ipv4.tcp_keepalive_intvl=15
- net.ipv4.tcp_keepalive_probes=5
- net.ipv4.tcp_keepalive_time=30
- net.ipv4.tcp_max_orphans=3276800
- net.ipv4.tcp_max_syn_backlog=1048576
- net.ipv4.tcp_max_tw_buckets=50000
- net.ipv4.tcp_mem=94500000915000000927000000
- net.ipv4.tcp_orphan_retries=3
- net.ipv4.tcp_reordering=5
- net.ipv4.tcp_retrans_collapse=0
- net.ipv4.tcp_retries2=5
- net.ipv4.tcp_rmem=4096873804194304
- net.ipv4.tcp_sack=1
- net.ipv4.tcp_synack_retries=1
- net.ipv4.tcp_syncookies=0
- net.ipv4.tcp_syn_retries=1
- net.ipv4.tcp_timestamps=1
- net.ipv4.tcp_tw_recycle=1
- net.ipv4.tcp_tw_reuse=1
- net.ipv4.tcp_window_scaling=1
- net.ipv4.tcp_wmem=4096163844194304
- net.ipv6.conf.all.disable_ipv6=1
- net.ipv6.conf.default.disable_ipv6=1
- net.ipv4.conf.eth0.rp_filter=1#memched节点不必要
- net.ipv4.conf.eth1.rp_filter=1#memched节点不必要
- net.ipv4.conf.eth2.rp_filter=1#memched节点不必要
- net.ipv4.conf.all.rp_filter=0#memched节点不必要
3、办事安装
1、调剂机(master、backup)
[/code]
- yum-yinstallipvsadmkeepalivedsendmail
2、memched节点1、memched节点2
[/code]
- wgethttp://memcached.googlecode.com/files/memcached-1.4.15.tar.gz
- wgethttp://www.monkey.org/~provos/libevent-1.4.13-stable.tar.gz
- wgethttp://downloads.sourceforge.net/repcached/memcached-1.2.8-repcached-2.2.tar.gz
[/code]
- tar-zxvflibevent-1.4.13-stable.tar.gz
- cdlibevent-1.4.13-stable
- ./configure--prefix=/usr/local
- make
- makeinstall
- tar-zxvfmemcached-1.4.15.tar.gz
- cdmemcached-1.4.15
- ./configure--with-libevent=/usr/local
- make
- makeinstall
- tar-zxvfmemcached-1.2.8-repcached-2.2.tar.gz
- cdmemcached-1.2.8-repcached-2.2
- ./configure--enable-replication
- make
- makeinstall
4、keepalived设置(master、backup)
[root@LVS1keepalived]#cat/etc/keepalived/gobal_module
[/code]<olclass="dp-sql"style="padding:5px0px;color:rgb(92,92,92);list-style-position:initial;list-style-image:initial;border-left-width:3px;border-style:nonenonenonesolid;border-left-color:rgb(20,107,0);margin:0px0px1px3em!important;"><liclass="alt"style="padding:0px3px0px10px!important;margin-top:0px!important;margin-right:0px!important;margin-bottom:0px!important;margin-left:20px;list-style:decimal-leading-zerooutside;color:inherit;line-height:1.3em;border:none;">!globalconfigurefile<listyle="margin-left:20px;list-style:decimal-leading-zerooutside;line-height:1.3em;border:none;padding:0px3px0px10px!important;margin-top:0px!important;margin-right:0px!important;margin-bottom:0px!important;"><liclass="alt"style="padding:0px3px0px10px!important;margin-top:0px!important;margin-right:0px!important;margin-bottom:0px!important;margin-left:20px;list-style:decimal-leading-zerooutside;color:inherit;line-height:1.3em;border:none;">global_defs{<listyle="margin-left:20px;list-style:decimal-leading-zerooutside;line-height:1.3em;border:none;padding:0px3px0px10px!important;margin-top:0px!important;margin-right:0px!important;margin-bottom:0px!important;">notification_email{<liclass="alt"style="padding:0px3px0px10px!important;margin-top:0px!important;margin-right:0px!important;margin-bottom:0px!important;margin-left:20px;list-style:decimal-leading-zerooutside;color:inherit;line-height:1.3em;border:none;">navyaijm@qq.com<listyle="margin-left:20px;list-style:decimal-leading-zerooutside;line-height:1.3em;border:none;padding:0px3px0px10px!important;margin-top:0px!important;margin-right:0px!important;margin-bottom:0px!important;">}<liclass="alt"style="padding:0px3px0px10px!important;margin-top:0px!important;margin-right:0px!important;margin-bottom:0px!important;margin-left:20px;list-style:decimal-leading-zerooutside;color:inherit;line-height:1.3em;border:none;">notification_email_fromnavyaijm@qq.com<listyle="margin-left:20px;list-style:decimal-leading-zerooutside;line-height:1.3em;border:none;padding:0px3px0px10px!important;margin-top:0px!important;margin-right:0px!important;margin-bottom:0px!important;">smtp_server127.0.0.1<liclass="alt"style="padding:0px3px0px10px!important;margin-top:0px!important;margin-right:0px!important;margin-bottom:0px!important;margin-left:20px;list-style:decimal-leading-zerooutside;color:inherit;line-height:1.3em;border:none;">smtp_connect_timeout30<listyle="margin-left:20px;list-style:decimal-leading-zerooutside;line-height:1.3em;border:none;padding:0px3px0px10px!important;margin-top:0px!important;margin-right:0px!important;margin-bottom:0px!important;">router_idZH_DG_LVS1<liclass="alt"style="padding:0px3px0px10px!important;margin-top:0px!important;margin-right:0px!important;margin-bottom:0px!important;margin-left:20px;list-style:decimal-leading-zerooutside;color:inherit;line-height:1.3em;border:none;">}<listyle="margin-left:20px;list-style:decimal-leading-zerooutside;line-height:1.3em;border:none;padding:0px3px0px10px!important;margin-top:0px!important;margin-right:0px!important;margin-bottom:0px!important;"><liclass="alt"style="padding:0px3px0px10px!important;margin-top:0px!important;margin-right:0px!important;margin-bottom:0px!important;margin-left:20px;list-style:decimal-leading-zerooutside;color:inherit;line-height:1.3em;border:none;">[root@LVS1keepalived]#cat/etc/keepalived/keepalived.conf<listyle="margin-left:20px;list-style:decimal-leading-zerooutside;line-height:1.3em;border:none;padding:0px3px0px10px!important;margin-top:0px!important;margin-right:0px!important;margin-bottom:0px!important;">!Keepalivedmainconfigurefile<liclass="alt"style="padding:0px3px0px10px!important;margin-top:0px!important;margin-right:0px!important;margin-bottom:0px!important;margin-left:20px;list-style:decimal-leading-zerooutside;color:inherit;line-height:1.3em;border:none;">include/etc/keepalived/gobal_module |
|