本文主要是介绍高可用架构-lvs+keepalived+nginx实现高性能负载均衡(1.软件安装),希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
1.安装nginx
1.wget http://nginx.org/download/nginx-1.9.10.tar.gz
2.tar -zxvf nginx-1.9.10.tar.gz
3.[root@192 nginx-1.9.10]# ./configure
4.make && make install
5.systemctl stop firewalld 关闭防火墙
6./usr/local/nginx/sbin/nginx
2.安装keepalived,注:lvs在linux系统中为默认自带的
1.wget http://www.keepalived.org/software/keepalived-1.2.18.tar.gz
2.tar -zxvf keepalived-1.2.18.tar.gz -C /usr/local/
3.yum install -y openssl openssl-devel
4.cd keepalived-1.2.18/ && ./configure --prefix=/usr/local/keepalived
5.make && make install
将keepalived安装成服务
因为没有使用keepalived的默认安装路径(默认路径:/usr/local),安装完成之后,需要做一些修改工作:
首先创建文件夹,将keepalived配置文件进行复制:
1.mkdir /etc/keepalived
2.cp /usr/local/keepalived/etc/keepalived/keepalived.conf /etc/keepalived/
然后复制keepalived脚本文件:
3.cp /usr/local/keepalived/etc/rc.d/init.d/keepalived /etc/init.d/
4.cp /usr/local/keepalived/etc/sysconfig/keepalived /etc/sysconfig/
5.ln -s /usr/local/sbin/keepalived /usr/sbin/
6.ln -s /usr/local/keepalived/sbin/keepalived /sbin/
可以设置开机启动:chkconfig keepalived on,到此我们安装完毕!
启动命令
service keepalived start
service keepalived stop
这篇关于高可用架构-lvs+keepalived+nginx实现高性能负载均衡(1.软件安装)的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!