Keepalived installation and configuration under Linux

http://www.cnblogs.com/dcrq/p/5642680.html

 

1. Environmental description

 

1. Operating system kernel version: 2.6.9-78.ELsmp

    2. Keepalived software version: keepalived - 1.1.20.tar.gz

 

2. Environment configuration

 

1. The IP address  of the main Keepalived server is 192.168.111.223

2. The IP address   of the Keepalived server is 192.168.111.100

3. Keepalived virtual IP address   192.168.111.150 _

 

3. Software download address

 

      http://www.keepalived.org/software/keepalived-1.1.20.tar.gz

 

Fourth, the installation process

 

   1. Upload Keepalived to the /home/ directory

    2. Unzip the Keepalived software

      [root@localhost home]# tar -zxvf keepalived-1.1.20.tar.gz 

      [root@localhost home]# cd keepalived-1.1.20

      [root@localhost keepalived-1.1.20]# ln -s /usr/src/kernels/2.6.9-78.EL-i686/usr/src//linux

      [root@localhost keepalived-1.1.20]# ./configure 

 

  Encountered an error message: configure: error: Popt libraries is required

  This error is caused by not installing the popt development kit. The solution is also very simple. Just yum install popt-devel can install the popt development kit.

  re./configure

  did not encounter skip this step

   3. Tips

          

 

   4. Compile and compile and install

      [root@localhost keepalived-1.1.20]# make && make install

      5. Comment out the part called by types.h to solve the problem in 4

     vi/usr/src/kernels/2.6.9-78.EL-i686/include/linux/types.h 

     To line 158 , the operation is as follows

     

   #endif 

    

    

 6. Recompile and compile and install

     [root@localhost keepalived-1.1.20]# make && make install

       

   7. Modify the configuration file path

       [[email protected]]#cp/usr/local/etc/rc.d/init.d/keepalived/etc/rc.d/init.d/

       [[email protected]]# cp /usr/local/etc/sysconfig/keepalived /etc/sysconfig/

       [root@localhost keepalived-1.1.20]# mkdir /etc/keepalived

       [[email protected]]#cp /usr/local/etc/keepalived/keepalived.conf/etc/keepalived/                           

       [root@localhost keepalived-1.1.20]# cp /usr/local/sbin/keepalived /usr/sbin/

   8. Set as a service, start at boot

       [root@localhost keepalived-1.1.20]# vi /etc/rc.local 

       

 

Five, the main Keepalived configuration

     1. Modify the configuration file

        [root@localhost keepalived-1.1.20]# vi /etc/keepalived/keepalived.conf 

       

6. Prepare Keepalived configuration

       1. Modify the configuration file

       

Seven, start the service

    

Eight, view the network card information

 1. Main Keepalived NIC information

9. Verification test

 1. Create a new web page on the main server with the content  192.168.111.223

 2. Create a new web page on the standby server with the content  192.168.111.100

 3. Start the http service and Keepalived service of the primary and secondary servers

 4. Enter the virtual IP address  192.168.111.150 by browsing the number

        The page appears as  192.168.111.223

5. Turn off the Keepalived service of the main server and enter the IP address 192.168.111.150 through the browser

        The page shows up as  192.168.111.100

6. Start the Keepalived service of the main server again , and enter the IP address 192.168.111.150 through the browser

        The page appears as  192.168.111.223

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326542851&siteId=291194637