keepalived(nginx的高可用)安装文档
2018-09-18 06:31:52来源:博客园 阅读 ()
1. 安装环境
su - root
yum -y install kernel-devel*
yum -y install openssl-*
yum -y install popt-devel
yum -y install lrzsz
yum -y install openssh-clients
yum -y install libnl libnl-devel popt
2. 安装keepalived
2.1. 安装keepalived
将keepalived-1.2.15.tar.gz上传到服务器/usr/local/下。
cd /usr/local
tar -zxvf keepalived-1.2.15.tar.gz
cd keepalived-1.2.15
执行配置命令
./configure --prefix=/usr/local/keepalived
3、编译
make
4、安装
make install
至此安装成功
5、拷贝执行文件
cp /usr/local/keepalived/sbin/keepalived /usr/sbin/
6、将init.d文件拷贝到etc下,加入开机启动项
cp /usr/local/keepalived/etc/rc.d/init.d/keepalived /etc/init.d/keepalived
7、将keepalived文件拷贝到etc下,加入网卡配置
cp /usr/local/keepalived/etc/sysconfig/keepalived /etc/sysconfig/
8、创建keepalived文件夹
mkdir -p /etc/keepalived
9、将keepalived配置文件拷贝到etc下
cp /usr/local/keepalived/etc/keepalived/keepalived.conf /etc/keepalived/keepalived.conf
10、添加可执行权限
chmod +x /etc/init.d/keepalived
2.2. 加入开机启动:
chkconfig --add keepalived #添加时必须保证/etc/init.d/keepalived存在
chkconfig keepalived on
添加完可查询系统服务是否存在:chkconfig --list
2.3. 启动keepalived
启动:service keepalived start
停止:service keepalived stop
重启:service keepalived restart
3. 配置日志文件
1.将keepalived日志输出到local0:
vi /etc/sysconfig/keepalived
KEEPALIVED_OPTIONS="-D -d -S 0"
2.在/etc/rsyslog.conf里添加:
local0.* /var/log/keepalived.log
3.重新启动keepalived和rsyslog服务:
service rsyslog restart
service keepalived restart
4. 打开防火墙的通讯地址
iptables -A INPUT -d 224.0.0.18 -j ACCEPT
/etc/rc.d/init.d/iptables save
标签:
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有
上一篇:Java基础——封装类
- 初识Nginx——前后端发布 2020-06-03
- 简单了解一下 Nginx 2020-05-07
- nginx开启ssl并把http重定向到https的两种方式 2020-05-02
- 京东资深架构师推荐学习6本实战文档:Redis+Nginx+MySQL+JVM 2020-04-29
- 使用nginx转换HTTPS流量 2020-04-14
IDC资讯: 主机资讯 注册资讯 托管资讯 vps资讯 网站建设
网站运营: 建站经验 策划盈利 搜索优化 网站推广 免费资源
网络编程: Asp.Net编程 Asp编程 Php编程 Xml编程 Access Mssql Mysql 其它
服务器技术: Web服务器 Ftp服务器 Mail服务器 Dns服务器 安全防护
软件技巧: 其它软件 Word Excel Powerpoint Ghost Vista QQ空间 QQ FlashGet 迅雷
网页制作: FrontPages Dreamweaver Javascript css photoshop fireworks Flash