Implement dual-host hot backup for Ftp service in Linux

Source: Internet
Author: User
Tags ftp client
Linux Ftp service dual-machine hot standby system: opensuse11.332 bit hot standby service software: LVS: ipvsadm-1.26-3.1.i586.rpmKeepAlived: keepalived-1.2.2.tar.gzwww.2cto.com installation steps: A, lvs rpm Package installation is more convenient # rpm-ivhipvs... linux Ftp service dual-machine hot standby system: opensuse 11.3 32-bit hot standby service software: LVS: ipvsadm-1.26-3.1.i586.rpmKeepAlived: keepalived-1.2.2.tar.gz www.2cto.com installation steps:, lvs using rpm Package installation is more convenient # rpm-ivh ipvsadm-1.26-3.1.i586.rpm two, keepalived use source code installation # tar-zxvf keepalived-1.1.15.tar.gz # cd keepalived-1. 1.15 #. /configure -- prefix =/usr/local/keepalived # make & make install configuration Edit/etc/keepalived. conf #============================================================== configuration start = ======================================! Configuration File for keepalived # global Configuration global_defs {icationication_email {hbyc@163.com} route root @ localhost smtp_server 127.0.0.1 route 30 router_id route} # VRRP configure vrrp_instance VI_1 {state MASTER interface eth1 limit 51 priority 100 advert_int 1 authentication {auth_type PASS auth_pass 1111} virtual_ipaddress {192.168.1.80} virtual_server 1 92.161.80 80 {delay_loop 6 255.rr 255.dr 255.255.255.255.0 255.50 protocol TCP real_server 192.168.1.81 80 {weight 1 TCP_CHECK {connect_timeout 10 2.163 protocol 3 connect_port 80 }} real_server 192.168.1.82 80 {weight 1 protocol {connect_timeout 10 nb_get_retry 3 delay_before_retry 3 connect_port 80 }}#================== ========== End of configuration =========================================================1, start lvs # ipvsadm to check whether startup is successful, # lsmod | grep ip_vip_vs_rr 1122 1 ip_vs 106759 3 ip_vs_rrlibcrc32c 971 1 ip_vs 2, start keepalive # keepalived start to check whether startup is successful, # ps-ef | grep keepalivedroot 3242 1 0? 00:00:00 keepalived startroot 3243 3242 0? 00:00:00 keepalived startroot 3244 3242 0? 00:00:00 keepalived startroot 3280 3107 0 00:00:00 pts/0 grep keepalived 3, view hot standby status, # define sadmip Virtual Server version 1.2.1 (size = 4096) Prot LocalAddress: port Scheduler Flags-> RemoteAddress: Port Forward Weight ActiveConn InActConnTCP 192.168.1.80: http rr persistent 50 # View hot standby run logs # tail-f/var/log/messageMar 12 23:35:24 linux-e1j0 avahi-daemon [2016]: Registering new address record for 192.168.1. 80 on eth1.IPv4. Mar 12 23:35:26 linux-e1j0 Keepalived_healthcheckers: TCP connection to [192.168.1.81]: 80 failed !!! Mar 12 23:35:26 linux-e1j0 Keepalived_healthcheckers: Removing service [192.168.1.81]: 80 from VS [192.168.1.80]: 80Mar 12 23:35:26 linux-e1j0 Keepalived_healthcheckers: Remote SMTP server [127.0.0.1: 25] connected. 4. check whether the virtual address is properly loaded to the network card. # Ip a2: eth1: Mtu 1500 qdisc pfifo_fast state UNKNOWN qlen 1000 link/ether 00: 0c: 29: cb: c8: 7d brd ff: ff inet 192.168.1.71/24 brd 192.168.1.255 scope global eth1 inet 192.168.1.80/32 scope global eth1 inet6 fe80: 20c: 29ff: fecb: c87d/64 scope link valid_lft forever preferred_lft forever can see that the virtual address 192.168.1.80/32 is loaded normally. Test the hot standby service: enable log Monitoring # tail-f/var/log/message to turn off the main service # killall-9 keepalived, you can see the backup service log output: mar 13 23:00:27 linux-backup Keepalived_vrrp: VRRP_Instance (VI_1) Transition to MASTER STATEMar 13 23:00:28 linux-backup Keepalived_vrrp: VRRP_Instance (VI_1) entering MASTER STATEMar 13 23:00:28 linux-backup avahi-daemon [2053]: Registering new address record for 192.168.1.80 on eth2.IPv4. mar 13 23:00:28 linux-backup avah I-daemon [2053]: Withdrawing address record for fe80: 20c: 29ff: fec4: da16 on eth2.Mar 13 23:00:28 linux-backup avahi-daemon [2053]: withdrawing address record for 192.168.1.72 on eth2. enable master server service # keepalived start. you can see the backup service log output: Mar 13 23:01:00 linux-backup Keepalived_vrrp: VRRP_Instance (VI_1) received higher prio advertMar 13 23:01:00 linux-backup Keepalived_vrrp: VRRP_Instance (VI_1) Entering BACKUP STATE Mar 13 23:01:00 linux-backup avahi-daemon [2053]: Server startup complete. host name is linux-backup-89.local. local service cookie is 2700730627.Mar 13 23:01:00 linux-backup avahi-daemon [2053]: Withdrawing address record for 192.168.1.80 on eth2. To test the dual-backup service, you can enable the ftp service at the same time on the master/slave service. # Service vsftpd start and use a third-party computer to access the virtual address ftp 192.168.1.80. you can see that when the master/slave service is switched, the ftp client will log on to different servers (71 or 72) respectively ), it proves that the ftp service is properly set up with dual-host hot backup.
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.