- 浏览: 86120 次
- 性别:
- 来自: 上海
文章分类
最新评论
-
ygongziy:
...
【趣味shell&python】倒三角控制台输出图形 -
i-david:
i-david 写道突然又发现一个获取随机数的方法,更简单
# ...
一个有趣的Shell随机数
基本环境
MASTER机,10.0.0.9
BACKUP机,10.0.0.10
1,安装
2,配置(低版本貌似才需要这个配置)
3,MASTER配置keepalived.conf,避免立即将vip还回去配置双BACKUP
4,BACKUP配置keepalived.conf
5,启动
由于/etc/rc.d/init.d/keepalived start报错,故采用如此启动
6,MASTER机验证网络信息
7,停MASTER机keepalived服务,验证BACKUP机网络
8,更新后的配置
9,查看网络信息
ip a
ifconfig
MASTER机,10.0.0.9
BACKUP机,10.0.0.10
1,安装
wget http://www.keepalived.org/software/keepalived-1.2.7.tar.gz tar xvzf keepalived-1.2.7.tar.gz cd keepalived-1.2.7 ./configure make make install
2,配置(低版本貌似才需要这个配置)
cp /usr/local/etc/rc.d/init.d/keepalived /etc/rc.d/init.d/ cp /usr/local/etc/sysconfig/keepalived /etc/sysconfig/ mkdir /etc/keepalived cp /usr/local/sbin/keepalived /usr/sbin/ vi /etc/keepalived/keepalived.conf
3,MASTER配置keepalived.conf,避免立即将vip还回去配置双BACKUP
vrrp_instance VI_1 { state BACKUP interface eth0 virtual_router_id 11 priority 100 advert_int 1 authentication { auth_type PASS auth_pass 1111 } virtual_ipaddress { 10.0.0.100 10.0.0.101 } } vrrp_instance VI_2 { state BACKUP interface eth1 virtual_router_id 21 priority 100 advert_int 1 authentication { auth_type PASS auth_pass 1111 } virtual_ipaddress { 192.168.0.100 192.168.0.101 } }
4,BACKUP配置keepalived.conf
vrrp_instance VI_1 { state BACKUP interface eth0 virtual_router_id 11 priority 10 advert_int 1 authentication { auth_type PASS auth_pass 1111 } virtual_ipaddress { 10.0.0.100 10.0.0.101 } } vrrp_instance VI_2 { state BACKUP interface eth1 virtual_router_id 21 priority 10 advert_int 1 authentication { auth_type PASS auth_pass 1111 } virtual_ipaddress { 192.168.0.100 192.168.0.101 } }
5,启动
[root@davidserver keepalived]# keepalived
由于/etc/rc.d/init.d/keepalived start报错,故采用如此启动
6,MASTER机验证网络信息
[root@davidserver keepalived]# ip a 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000 link/ether 00:50:56:20:3d:2a brd ff:ff:ff:ff:ff:ff inet 10.0.0.9/24 brd 10.0.0.255 scope global eth0 inet 10.0.0.100/32 scope global eth0 inet 10.0.0.101/32 scope global eth0 inet6 fe80::250:56ff:fe20:3d2a/64 scope link valid_lft forever preferred_lft forever 3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000 link/ether 00:50:56:34:80:48 brd ff:ff:ff:ff:ff:ff inet 192.168.0.9/16 brd 192.168.0.255 scope global eth1 inet 192.168.0.100/32 scope global eth1 inet 192.168.0.101/32 scope global eth1 inet6 fe80::250:56ff:fe34:8048/64 scope link valid_lft forever preferred_lft forever
7,停MASTER机keepalived服务,验证BACKUP机网络
[root@davidserver keepalived]# /etc/rc.d/init.d/keepalived stop Stopping keepalived: [ OK ]
[root@davidserver keepalived]# ip a 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000 link/ether 00:50:56:2e:2b:6d brd ff:ff:ff:ff:ff:ff inet 10.0.0.10/24 brd 10.0.0.255 scope global eth0 inet 10.0.0.100/32 scope global eth0 inet 10.0.0.101/32 scope global eth0 inet6 fe80::250:56ff:fe2e:2b6d/64 scope link valid_lft forever preferred_lft forever 3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000 link/ether 00:50:56:3b:e8:e2 brd ff:ff:ff:ff:ff:ff inet 192.168.0.10/16 brd 192.168.0.255 scope global eth1 inet 192.168.0.100/32 scope global eth1 inet 192.168.0.101/32 scope global eth1 inet6 fe80::250:56ff:fe3b:e8e2/64 scope link valid_lft forever preferred_lft forever
8,更新后的配置
[root@davidserver ~]# cat /etc/keepalived/keepalived.conf global_defs { notification_email { jie.zhang@ttpod.com } notification_email_from keepalived@ttpod.com smtp_server 127.0.0.1 stmp_connect_timeout 30 router_id keepalived_for_backup } vrrp_script check_top { script "/root/bin/check_top" interval 10 weight 10 } vrrp_instance VI_1 { state BACKUP interface eth0 virtual_router_id 11 priority 10 advert_int 1 nopreempt authentication { auth_type PASS auth_pass 1111 } virtual_ipaddress { 10.0.0.100/24 dev eth0 label eth0:0 10.0.0.101/24 dev eth0 label eth0:1 } track_script { check_top weight 20 } } vrrp_instance VI_2 { state BACKUP interface eth1 virtual_router_id 21 priority 10 advert_int 1 nopreempt authentication { auth_type PASS auth_pass 1111 } virtual_ipaddress { 192.168.0.100/16 dev eth1 label eth1:0 192.168.0.101/16 dev eth1 label eth1:1 } track_script { check_top } }
9,查看网络信息
ip a
[root@davidserver ~]# ip a 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000 link/ether 00:50:56:20:3d:2a brd ff:ff:ff:ff:ff:ff inet 10.0.0.9/24 brd 10.0.0.255 scope global eth0 inet 10.0.0.100/24 scope global eth0:0 inet 10.0.0.101/24 scope global eth0:1 inet6 fe80::250:56ff:fe20:3d2a/64 scope link valid_lft forever preferred_lft forever 3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000 link/ether 00:50:56:34:80:48 brd ff:ff:ff:ff:ff:ff inet 192.168.0.9/16 brd 192.168.0.255 scope global eth1 inet 192.168.0.100/16 scope global eth1:0 inet 192.168.0.101/16 scope global eth1:1 inet6 fe80::250:56ff:fe34:8048/64 scope link valid_lft forever preferred_lft forever
ifconfig
[root@davidserver ~]# ifconfig eth0 Link encap:Ethernet HWaddr 00:50:56:20:3D:2A inet addr:10.0.0.9 Bcast:10.0.0.255 Mask:255.255.255.0 inet6 addr: fe80::250:56ff:fe20:3d2a/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:1206 errors:0 dropped:0 overruns:0 frame:0 TX packets:1282 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:125352 (122.4 KiB) TX bytes:148912 (145.4 KiB) eth0:0 Link encap:Ethernet HWaddr 00:50:56:20:3D:2A inet addr:10.0.0.100 Bcast:0.0.0.0 Mask:255.255.255.255 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 eth0:1 Link encap:Ethernet HWaddr 00:50:56:20:3D:2A inet addr:10.0.0.101 Bcast:0.0.0.0 Mask:255.255.255.255 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 eth1 Link encap:Ethernet HWaddr 00:50:56:34:80:48 inet addr:192.168.0.9 Bcast:192.168.0.255 Mask:255.255.0.0 inet6 addr: fe80::250:56ff:fe34:8048/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:349754 errors:0 dropped:0 overruns:0 frame:0 TX packets:476 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:21502934 (20.5 MiB) TX bytes:32269 (31.5 KiB) eth1:0 Link encap:Ethernet HWaddr 00:50:56:34:80:48 inet addr:192.168.0.100 Bcast:0.0.0.0 Mask:255.255.255.255 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 eth1:1 Link encap:Ethernet HWaddr 00:50:56:34:80:48 inet addr:192.168.0.101 Bcast:0.0.0.0 Mask:255.255.255.255 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
发表评论
-
linux挂载linux,需要指定username password参数
2013-02-21 11:00 946smb配置 [mp3] comment = MP3 pa ... -
nginx 499问题的一种方法
2012-12-03 18:38 1041proxy_ignore_client_abort on; ... -
ubuntu 历史版本收集
2012-11-23 21:48 828http://old-releases.ubuntu.com/ ... -
测试磁盘读写速度
2012-11-21 17:59 886#!/bin/bash i=1 while [ 1 ... -
简单收录
2012-10-11 15:18 1030时间太紧张 简单收录些东东,非标准的文章 清除 wind ... -
haproxy 实现代理
2012-09-25 18:04 10091,安装haproxy mkdir -p /data/so ... -
CentOS (rsa & dsa) 公钥与密钥的使用
2012-09-20 19:45 29011,基本环境 系统版本 [centospub@david ... -
useradd 深入使用
2012-09-13 09:40 24361,查看帮助 [root@davidserver ~]# ... -
CentOS下搭建FastDFS
2012-09-12 12:58 2148背景描述 OS CentOS-6.3_x86-64 trac ... -
内网网段与IPv4地址划分
2012-09-11 11:32 2166A类 1.0.0.0 到126.0.0.0 0.0.0.0 和 ... -
CentOS默认服务单阐述
2012-09-10 18:29 778NetworkManager 自动在多种网络连接中进行转换,如 ... -
CentOS 6.3 初次安装网络配置
2012-09-10 15:22 32931,修改静态网络配置 [root@davidserver ... -
webbench使用
2012-07-19 16:42 10581,webbench的安装 ubuntu 12.04 amd6 ... -
linux 文本文件格式转换
2012-07-16 16:02 1416使用od -c -t x1 abc.txt 查看文本文件里的特 ...
相关推荐
Nginx+keepalived双机热备(主从模式)是一种常见的负载均衡技术,用于实现高可用环境和故障转移。该技术通过将Nginx与keepalived结合,实现了前端负载均衡和高可用性。 Nginx是一款流行的开源Web服务器软件,具有...
本文将详细介绍 MYSQL+KEEPALIVED 双机热备方案的实现细节。 MYSQL 主主复制配置 MYSQL 主主复制是 MYSQL+KEEPALIVED 双机热备方案的核心组件。通过配置 MYSQL 主主复制,可以实现两个 MYSQL 节点的实时数据同步,...
Keepalived 实现双机热备 Keepalived 是一个类似于 Layer3, 4, 5 交换机制的软件,也就是我们平时说的第 3 层、第 4 层和第 5 层交换。Keepalived 的作用是检测 Web 服务器的状态,如果有一台 Web 服务器死机,或...
其中,使用双机热备方案是实现高可用性的一种有效方法,而Keepalived是实现双机热备的常用工具之一。本文档介绍了如何构建Keepalived双机热备架构,以便在网络中部署高可用的负载均衡服务。 ### Keepalived双机热备...
LVS+Keepalived双机热备的实现步骤大致如下: 1. **配置LVS**:首先,在两台服务器上分别安装LVS,设置相应的负载均衡策略,例如轮询、权重分配等。然后,配置虚拟IP地址,这将是对外提供服务的统一入口。 2. **...
标题 "keepalived + redis 实现双机热备" 涉及到的是在IT行业中构建高可用性系统的关键技术。keepalived 和 redis 是两个关键组件,它们一起工作以确保服务的持续运行,即使在主服务器故障时也能无缝切换到备份...
【标题】:Linux环境下基于Keepalived的MySQL双机热备实现详解 【描述】:在企业级系统中,数据库往往是性能瓶颈的关键所在。MySQL主从架构虽然能缓解这一问题,但在面临单一主库故障时,系统仍存在风险。本文将...
本片详细记录了Nginx+keepalived双机热备(主从模式)高可用集群方案-完整部署过程,讲解十分到位,可作为线上实操手册。特在此分享,希望能帮助到有用到的朋友。
nginx+keepalived实现双机热备高可用 本文详细介绍了使用nginx和keepalived实现双机热备高可用的技术解决方案。该解决方案旨在解决nginx集群部署时的单点故障问题。通过keepalived软件,实现对nginx服务器的高可用...
"keepalived双击热备 检测mysql服务是否正常"的标题揭示了一个关键的解决方案,即利用Keepalived实现对MySQL服务的健康检查和高可用性设置。Keepalived是一款开源的网络和服务监控软件,它能够为Linux环境下的服务...
"suse12 redis-sensienl-keepalived双击热备部署"是一个针对SUSE Linux Enterprise Server 12 (SLES12) 上的Redis数据库进行高可用配置的实践案例。在这个部署方案中,Redis被配置为双主模式(也称为双活或双击),...
通过上述步骤,我们可以成功地实现一个基于Nginx的负载均衡系统,并利用Keepalived来实现双机热备,确保了系统的高可用性和稳定性。这种架构不仅能够有效分发流量至多个Web服务器,还能在一台服务器出现故障时自动...
### RedHat 5.9 通过 Keepalived 实现 Nginx 双机热备部署详解 #### 一、背景介绍 随着业务需求的增长和技术的发展,服务器单点故障的风险日益凸显,因此高可用(High Availability,简称HA)架构设计成为了企业IT...
MySQL主主搭建与Keepalived实现双机热备是构建高可用数据库系统的关键技术,它确保了即使在一台服务器故障时,数据服务也能不间断运行。以下是对这一主题的详细解释: 1. **MySQL主主复制**: 主主复制是一种...
一.Keepalived Keepalived是保证集群高可用的服务软件,网络中优先级高的节点为master负责响应VIP的ARP包,将VIP和MAC地址映射关系告诉网络内其他主机,还会以多播的形式向网络中发送VRRP通告,告知自己的优先级。...