Memcached HA实战笔记(2)

 

 

首页服务器应用

背景:

阅读新闻

Memcached HA实战笔记

[日期:2013-04-13]   来源:Linux社区  作者:navyaijm   [字体:]  

三、服务安装
 
1、调度机(master、backup)
 
yum -y install ipvsadm keepalived sendmail
 
2、memched节点1、memched节点2
 
wget
 wget ~provos/libevent-1.4.13-stable.tar.gz
 wget
 


 
tar -zxvf libevent-1.4.13-stable.tar.gz
 cd libevent-1.4.13-stable
 ./configure --prefix=/usr/local
 make
 make install
 
tar -zxvf memcached-1.4.15.tar.gz
 cd memcached-1.4.15
 ./configure --with-libevent=/usr/local
 make
 make install
 

tar -zxvf memcached-1.2.8-repcached-2.2.tar.gz
 cd memcached-1.2.8-repcached-2.2
 ./configure  --enable-replication
 make
 make install
 


 
四、keepalived配置(master、backup)
 
[root@LVS1 keepalived]# cat /etc/keepalived/gobal_module
 ! global configure file
 
global_defs {
    notification_email {
      navyaijm@qq.com
    }
    notification_email_from navyaijm@qq.com
    smtp_server 127.0.0.1
    smtp_connect_timeout 30
    router_id ZH_DG_LVS1
 }
 

[root@LVS1 keepalived]# cat /etc/keepalived/keepalived.conf
 ! Keepalived main configure file
 include /etc/keepalived/gobal_module
 include /etc/keepalived/vrrpd_module
 include /etc/keepalived/lvs_module
 

[root@LVS1 keepalived]# cat /etc/keepalived/vrrpd_module
 vrrp_sync_group ZH_DG_Memcached1 {
    group {
        ZH_DG_WAN1
        ZH_DG_LAN1
    }
    smtp_alter
 }
 
vrrp_instance ZH_DG_WAN1 {
    state MASTER    (从上为:backup)     
    interface eth1 
    virtual_router_id 10  (从为:9)
    priority 100 
    advert_int 1
    authentication {
        auth_type PASS
        auth_pass 08756CD0
    }
    virtual_ipaddress {
        172.28.26.100  # tmp
    }
 }
 

vrrp_instance ZH_DG_LAN2 {
    state MASTER (从上为:backup)
    interface eth2
    virtual_router_id 10 (从为:9)
    priority 100
    advert_int 1
    authentication {
        auth_type PASS
        auth_pass 6F8DBC2E
    }
    virtual_ipaddress {
        172.28.16.100 # Memcached 虚拟网关
    }
 }
 


 
[root@LVS1 keepalived]# cat /etc/keepalived/lvs_module
 virtual_server 172.28.26.100 11211 {
    delay_loop 6
    lb_algo wrr
    lb_kind NAT
    persistence_timeout 60
    protocol TCP
 
    include /etc/keepalived/realserver/172.28.26.102_11234.conf
    include /etc/keepalived/realserver/172.28.26.103_11233.conf
 }
 
 
 
[root@LVS1 keepalived]# cat /etc/keepalived/realserver/172.28.26.102_11234.conf
 real_server 172.28.16.102 11234 {
        weight 1                        #权重
        inhibit_on_failure              #故障会修改权重为零
        TCP_CHECK {
                connect_timeout 10      #10秒无响应超时
                nb_get_retry 3          #重连次数
                delay_before_retry 3    #重连间隔,单位为秒
                connect_port 11234        #检测端口
        }
 }
 


 
[root@LVS1 keepalived]# cat /etc/keepalived/realserver/172.28.26.103_11233.conf
 real_server 172.28.16.103 11233 {
        weight 1                        #权重
        inhibit_on_failure              #故障会修改权重为零
        TCP_CHECK {
                connect_timeout 10      #10秒无响应超时
                nb_get_retry 3          #重连次数
                delay_before_retry 3    #重连间隔,单位为秒
                connect_port 11233        #检测端口
        }
 }

 

CentOS 集群自动同步时间的一种方法

Hadoop 常见问题总结

相关资讯      

   

本文评论   查看全部评论 (0)


评论声明

尊重网上道德,遵守中华人民共和国的各项有关法律法规

承担一切因您的行为而直接或间接导致的民事或刑事法律责任

本站管理��员有权保留或删除其管辖留言中的任意内容

本站有权在网站内转载或引用您的评论

参与本评论即表明您已经阅读并接受上述条款

 

 

 

最新资讯

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/94a9710c5da0fb06532b58b581995e13.html