欢迎来到天天文库
浏览记录
ID:33700932
大小:247.17 KB
页数:15页
时间:2019-02-28
《keepalivedha配置和测试过程forlinux》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、Keepalived配置和测试过程forlinux安装环境:两台server:Systemx3650M3Nodel:硬盘:130GCPU:2颗E5620@2.40GHz内存:4GNode2:换盘:130GCPU:2颗E5620@2.40GHz内存:8G1>安装redhat6.4系统丿IJU盘安装rhel-server-6.4-x86_64-dvd.iso分区:/boot200M/boot/efi200MSwap4096M13000M只安装Basic版本,不耍安装桌面需要在language里而选择Chinese包安装系
2、统完成后设置网卡ethONodel:[root©nodel〜]#vi/etc/sysconfig/network-scripts/ifcfg-ethODEVlCE=ethOHWADDR=5C:F3:FC:4B:5B:60TYPE-EthernetUUID-226d3dal-c651-4d5c-9de4-91dd714fb298ONBOOT«yesBOOTPROTO-StaticIPADDR=172.16.0.121NETWASK=255.255.255.0GATEWAY=172.16.0.254Node2:[root
3、@node2〜]#vi/etc/sysconfig/network-scripts/ifcfg-ethODEVICE=ethOHWADDR=5C:F3:FC:4A:19:D4TYPE=EthernetUUID=8a7ffdl3-24ed-4c94-b8aa-099096fb8235ONBOOT=yesBOOTPROTO=StaticIPADDR=172.16.0.122NETMASK=255.255.255.0GATEWAY=172.16.0.2542、设置keepalivedNodel:[root^nodel〜]#
4、vi/etc/keepa11ved/keepa11ved・conf!configurationFileforkeepalivedglobal_aefs{router_id234567}vrrp_instancevi_3{statebackupnopreemptinterfaceethovirtual_router_id40priority100advert_int1authentication{auth_typepassauth_pass10101010virtual_ipaddress{172.16,0,120de
5、vetholabeleth0:0cuaambf11•!aalppaeepeeekke//kcc/ttceet//eM/f9phhssh••syy•ffySCIaaumba!ConfigurationFileforkeepalivedglobal_defs{router_id234567#router_id,配置一个网络唯一的ID}vrrpjnstanceVl_3{#为keeplived实例号,•般•台服务器只有1个实例,不用更改stateBACKUP#为keepalived初始状态,此处需要设置成BACKUPnopr
6、eempt#配置为非抢山模式,在nodel切到node2,vip从nodel飘到node2后,nodel恢复后,服务不会再切回nodel,而是继续II:node2做MASTER,服务在node2±面继续跑interfaceethO#为启用keepalived的接口,根据实际惜况设置virtual_router_id40#为keepalived虚拟ID,同一集群必须相同priority100#服务优先级,MASTER设曽为100,BACKUP设置为90advertjnt1#心跳区间设置为1秒authentication
7、{auth_typePASSauth_pass10101010#设置验证密码,同一集能必须相同}virtual_ipaddress{172.16.0.120devethOlabelethO:O#设置服务IP,devlabelnJ'省略}notify_master"/etc/keepalived/notify.shmaster"#切换成master,执行一次脚木notify_backup"/etc/keepalived/notify.shbackup"#切换成backup,执行-次脚本notify_fault"/etc
8、/keepalived/notify.shfault"#切换成fault,执行-次脚本}Node2:[root@node2〜j#vi/etc/keepalived/keepalived.conf!conf^iqura廿。nforkeepalivedglobal_aefs{router_id123456}vrrp_1nstancevi_3{sta
此文档下载收益归作者所有