KeepAlived+Nginx 安装
yum install -y gcc gcc-c++ openssl openssl-devel
目前keepalived最新版本下载:
[root@rhel ~]#wget -c http://www.keepalived.org/software/keepalived-1.2.12.tar.gz
[root@rhel ~]# tar zxvf keepalived-1.2.12.tar.gz
[root@rhel ~]# cd keepalived-1.2.12
安装编译环境:
[root@rhel ~]# yum install -y gcc gcc-c++ openssl openssl-devel
1
//指定安装路径
[root@rhel keepalived-1.2.12]# ./configure --prefix=/usr/local/keepalived --sysconf=/etc
[root@rhel keepalived-1.2.12]# make && make install //安装
将keepalived命令软连接到/usr/bin下
[root@rhel keepalived-1.2.12]# ln -s /usr/local/keepalived/sbin/keepalived /usr/bin/keepalived
添加启动脚本且方便用service keepalived start/stop/restart管理(如果没有init.d/keepalived则从源码目录拷贝)
[root@rhel keepalived-1.2.12]# cp /keepalived/keepalived-2.0.8/keepalived/etc/init.d/keepalived /etc/init.d/keepalived
[root@rhel keepalived-1.2.12]# chmod 755 /etc/init.d/keepalived //添加执行权限
[root@rhel keepalived-1.2.12]# chkconfig keepalived on //开机启动
修改/etc/init.d/keepalived中的程序路径
# Source configuration file (we set KEEPALIVED_OPTIONS there)
. /etc/sysconfig/keepalived
改为:
# Source configuration file (we set KEEPALIVED_OPTIONS there)
. /keepalived/keepalived-2.0.8/keepalived/etc/sysconfig/keepalived
默认情况下,keepalived 会读取 /etc/keepalived 下keepalived.conf 文件
如果没有建立这个文件,keepalived也不会报错,但是会发现,所创建的关于keepalived的相关参数根本就没有生效。
[root@rhel keepalived-1.2.12]# mkdir /etc/keepalived
[root@rhel keepalived-1.2.12]# ln -s /usr/local/keepalived/etc/keepalived/keepalived.conf /etc/keepalived/keepalived.conf
keepalived.conf
! Configuration File for keepalived
global_defs {
notification_email {
root@localhost
}
notification_email_from keepalived@localhost
smtp_server 127.0.0.1
smtp_connect_timeout 30
router_id LVS_DEVEL
}
vrrp_script Monitor_Nginx {
script "/monitor_nginx.sh"
interval 2
weight 2
}
vrrp_instance VI_1 {
state MASTER
interface ens192
virtual_router_id 51
priority 100
advert_int 1
authentication {
auth_type PASS
auth_pass 123456
}
track_script {
Monitor_Nginx #(调用nginx进程检测脚本)
}
virtual_ipaddress {
172.16.9.30
}
}
monitor_nginx.sh
启动测试:
[root@rhel keepalived-1.2.12]# service keepalived restart
停止 keepalived: [确定]
启动 keepalived: [确定]
安装完成
service keepalived restart
service keepalived stop
service keepalived start
systemctl start keepalived
systemctl restart keepalived
systemctl stop keepalived
KeepAlived+Nginx 安装的更多相关文章
- LVS+Nginx(LVS + Keepalived + Nginx安装及配置)
(也可以每个nginx都挂在上所有的应用服务器) nginx大家都在用,估计也很熟悉了,在做负载均衡时很好用,安装简单.配置简单.相关材料也特别多. lvs是国内的章文嵩博士的大作,比nginx被广 ...
- LVS + Keepalived + Nginx安装及配置
1.概述 上篇文章<架构设计:负载均衡层设计方案(6)——Nginx + Keepalived构建高可用的负载层>(http://blog.csdn.net/yinwenjie/artic ...
- 架构设计:负载均衡层设计方案(7)——LVS + Keepalived + Nginx安装及配置
1.概述 上篇文章<架构设计:负载均衡层设计方案(6)——Nginx + Keepalived构建高可用的负载层>(http://blog.csdn.net/yinwenjie/artic ...
- keepalived+nginx安装配置
软件版本号: pcre8.36 ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.36.tar.gz keepalived1.2 ...
- keepalived+nginx安装
安装keepalived+nginx做为公司服务器前端高可用反向代理安装nginx 1.yum install -y pcre pcre-devel gcc-c++ zlib zlib-devel o ...
- keepalived与nginx安装
目的: 当用户请求访问时,会通过nginx来访问web服务应用,因此我们必须要保证nginx的高可用,要保证nginx的高可用,我们需要通过keepalived来监控nginx,并对外提供1个虚拟的v ...
- Nginx+keepalived 脚本安装主从双机热备自动切换解决方案
Nginx+keepalived 脚本安装主从双机热备自动切换解决方案 2013-07-02 19:24:13 标签:filesnginx keepalived 原创作品,允许转载,转载时请务必以超链 ...
- centos安装与配置keepalived+nginx高可用
一.安装启动keepalived 1.下载keepalived 在centos系统中,用wget下载最新版本: mkdir tool cd tool wget https://www.keepaliv ...
- 架构设计:负载均衡层设计方案(2)——Nginx安装
来源:http://blog.csdn.net/yinwenjie(未经允许严禁用于商业用途!) 目录(?)[-] Nginx重要算法介绍 1一致性Hash算法 2轮询与加权轮询 Nginx的安装 1 ...
随机推荐
- Spring利用注解@Value获取properties属性为null
今天在项目中想使用@Value来获取Springboot中properties中属性值. 场景:定义了一个工具类,想要获取一些配置参数,使用了@value来获取,但是死活也获取不到. 如何解决:在使用 ...
- React将某段文字插入到某个元素里
最基本使用: 引入依赖文件: <script src="https://unpkg.com/react@16/umd/react.development.js">< ...
- ElasicSearch(4) 与jest结合
https://spring.io/projects/spring-data-elasticsearch https://docs.spring.io/spring-data/elasticsearc ...
- python 关于文件的操作
1.打开文件: f=open(r'E:\PythonProjects\test7\a.txt',mode='rt',encoding='utf-8') 以上三个单引号内分别表示:要打开的文件的路径,m ...
- Java虚拟机 内存区域划分
(图片来自https://www.cnblogs.com/whgk/p/6138522.html) 先从线程私有区开始介绍 虚拟机栈 Java虚拟机栈是由一个个栈帧组成的,当一个方法被调用时,代表这个 ...
- springboot整合dubbox与zookeeper
springboot中dubbo依赖的引入和配置(application.properties)参见:https://blog.csdn.net/wohaqiyi/article/details/72 ...
- C++重写(覆盖)、重载、重定义、
总结: 重写(覆盖)override 是指派生类函数重写(覆盖)基类函数 不同的范围,分别位于基类和派生类中 函数的名字相同 参数相同 基类函数必须有virtual关键字 重载overload 成员函 ...
- fabric 在阿里云Ubuntu部署 注意
部署时候报 段错误: signal SIGSEGV: segmentation violation code=0x1 addr=0x63 pc=0x7fcd47490259] 解决方案: 更新Hype ...
- git 使用遇到的问题
本博客只记录遇到的问题和解决方案 问题一:git上与本地不同步无法上传 先git pull origin master再git push -u origin master(实在不行或者清空本地,或者清 ...
- 安装Ubuntu 18.04后的一些操作
安装Ubuntu 18.04后的一些操作 1.设置root密码 sudo passwd 2.登陆root(输入密码后看到井号就是切换成为root账户) su 3.删除预装 apt-get remove ...