death114 发表于 2018-12-30 15:39:52

Linux负载均衡软件LVS+keepalived

  原文:http://www.weiruoyu.cn/?p=703
  教程参考:http://nhylovezyh.blog.运维网.com/1444948/666446
  安装ipvsadm
  # yum install ipvsadm
  即可。
  或者其它办法安装:
  1.下载2.4版本
  # wght -c http://www.linuxvirtualserver.org/software/kernel-2.6/ipvsadm-1.24.tar.gz
  # tar zxf ipvsadm-1.24.tar.gz
  # cd ipvsadm-1.24
  如果报错:
  添加链接:
  # ln -s /usr/src/kernels/2.6.18-238.el5-i686/ /usr/src/linux
  如果kernels里面什么都没有,就运行如下命令进行安装内核
  #yum -y install openssl openssl-devel
  安装keepalived
  #wget http://www.keepalived.org/software/keepalived-1.1.20.tar.gz

http://nhylovezyh.blog.运维网.com/images/editer/InBlock.gif#tar xzvf keepalived-1.1.20.tar.gz
http://nhylovezyh.blog.运维网.com/images/editer/InBlock.gif#cd keepalived-1.1.20
http://nhylovezyh.blog.运维网.com/images/editer/InBlock.gif#./configure --prefix=/usr/local/keepalived
http://nhylovezyh.blog.运维网.com/images/editer/InBlock.gif#make && make install正确完成安装会显示如下信息:Keepalived configuration  ------------------------
  Keepalived version : 1.1.20
  Compiler : gcc
  Compiler flags : -g -O2
  Extra Lib : -lpopt -lssl -lcrypto
  Use IPVS Framework : Yes
  IPVS sync daemon support : Yes
  Use VRRP Framework : Yes
  Use Debug flags : No
然后对keepalived做以下操作:http://nhylovezyh.blog.运维网.com/images/editer/InBlock.gif#cp /usr/local/keepalived/etc/rc.d/init.d/keepalived /etc/rc.d/init.d/
http://nhylovezyh.blog.运维网.com/images/editer/InBlock.gif#cp /usr/local/keepalived/etc/sysconfig/keepalived /etc/sysconfig
http://nhylovezyh.blog.运维网.com/images/editer/InBlock.gif#mkdir /etc/keepalived
http://nhylovezyh.blog.运维网.com/images/editer/InBlock.gif#cp /usr/local/keepalived/etc/keepalived/keepalived.conf /etc/keepalived/
http://nhylovezyh.blog.运维网.com/images/editer/InBlock.gif#cp /usr/local/keepalived/sbin/keepalived /usr/sbin/  里面的有些出入:安装完keepalive后,需要添加服务,不要使用下面的命令:

http://nhylovezyh.blog.运维网.com/images/editer/InBlock.gif#check --add keepalived  应该使用如下命令:
  先查看:
  # chkconfig --list keepalived
  如果没有,就添加
  # chkconfig --add keepalived
  然后开启在查看:
  # chkconfig --list keepalived
  keepalived   0:关闭 1:关闭 2:关闭 3:关闭 4:关闭 5:关闭 6:关闭
  发现是关闭的,然后设置开机启动,并查看
  # chkconfig keepalived on
  # chkconfig --list keepalived
  keepalived   0:关闭 1:关闭 2:启用 3:启用 4:启用 5:启用 6:关闭
  修改配置文件
  参考:http://crazyming.blog.运维网.com/1048571/496526
  参考:http://ixdba.blog.运维网.com/2895551/554029

页: [1]
查看完整版本: Linux负载均衡软件LVS+keepalived