redis cluster 前端调度需要加lvs keepalived吗

发布网友 发布时间:2022-04-25 16:03

我来回答

1个回答

热心网友 时间:2022-04-08 10:44

redis cluster 前端调度需要加lvs keepalived

Keepalived的安装:
yum -y install openssl-devel
yum install popt-devel
wget
 
tar zxf keepalived-1.2.6.tar.gz 
 
cd keepalived-1.2.6
 
./configure --prefix=/usr/local/keepalived 
 
make
 
make install
cp /usr/local/keepalived/etc/rc.d/init.d/keepalived /etc/init.d/keepalived
chmod +x /etc/init.d/keepalived

#修改/etc/init.d/keepalived, 寻找大约15行左右的. /etc/sysconfig/keepalived, 修改为: 
#.  /usr/local/keepalived/etc/sysconfig/keepalived, 即指向正确的文件位置
 
#同时在上述行下添加以下内容(将keepavlied主程序所在路径导入到环境变量PATH中):
 
#PATH="$PATH:/usr/local/keepalived/sbin"
 
#export PATH
 
#3. 修改/usr/local/keepalived/etc/sysconfig/keepalived文件,设置正确的服务启动参数 
#KEEPALIVED_OPTIONS="-D -f /usr/local/keepalived/etc/keepalived/keepalived.conf"
#
 
#4. 切勿忘记将此服务设置为开机启动
#
#chkconfig keepalived on
 
#5. 经过以上修改,keepalived基本安装即可完成,启动测试之: 
#service keepalived restart
 
默认的配置文件中,指定了两个数个虚拟IP : 192.168.200.16  192.168.200.17  192.168.200.18
可使用ip addr命令验证之。
LVS的安装:
wget
ln -s /usr/src/kernels/2.6.18-1.el5-i686/ /usr/src/linux
tar zxvf ipvsadm-1.24.tar.gz
cd ipvsadm-1.24
make && make install
ipvsadm  //将ipvsadm注入LINUX内核

可以通过ipvsadm –help或是lsmod | grep ip_vs查看是否成功安装
 
keepalived.conf的配置如下:
! Configuration File for keepalived
global_defs {
   notification_email {
     hesongling@meilele.com
   }
   notification_email_from service@meilele.com
   smtp_server localhost
   smtp_connect_timeout 30
   router_id NodeA
}
 
vrrp_instance VI_1 {
    state MASTER
    interface eth0
    virtual_router_id 51
    priority 100
    advert_int 1
    authentication {
        auth_type PASS
        auth_pass 1111
    }
    virtual_ipaddress {
         192.168.0.201
    }
}

声明声明:本网页内容为用户发布,旨在传播知识,不代表本网认同其观点,若有侵权等问题请及时与本网联系,我们将在第一时间删除处理。E-MAIL:11247931@qq.com