Home IT Linux Windows Database Network Programming Server Mobile  
  Home \ Server \ Keepalived achieve high availability Nginx Reverse Proxy     - Graphical interface for the CentOS 6.4 installed and connected by remote VNC (Linux)

- In-depth understanding of capture Node.js garbage collection and memory leaks (Programming)

- Ubuntu install virtual machine software VirtualBox 4.3.10 (Linux)

- CentOS6 install Redis (Database)

- Oracle 12c In-Memory Study (Database)

- Linux file system structure Introduction (Linux)

- Ubuntu configuration SVN and http mode access (Server)

- Asynchronous JavaScript loading (Programming)

- sed command (Linux)

- Redhat Close SELinux correct step (Linux)

- CentOS 7.0 local address and configure yum source address priority (Linux)

- Teach you how to ensure password security under the Linux operating system (Linux)

- iOS developers - a simple factory pattern and OC reflection (Programming)

- GitLab issued Merge Request return error 500 when the two solutions log (Linux)

- UNIX how to restrict users by IP Telnet (Linux)

- Why you can have JavaScript string method (Programming)

- How to Install Puppet in the Ubuntu 15.04 (Server)

- Modify MySQL character encoding under Linux (Database)

- ARM Linux system call (Linux)

- Docker use Dockerfile created since the launch of the service support SSH container mirror (Server)

  Keepalived achieve high availability Nginx Reverse Proxy
  Add Date : 2017-03-03      
  Experimental System:

(1) CentOS 6.6_x86_64;

(2) There are three hosts, this experiment ip address to a host name that the host 131, host 132, 133 hosts.

Experimental conditions: firewall and selinux are closed, time synchronization between host

Experimental Software: nginx-x86_64-1.6.2keepalived-x86_64-1.2.13

First, the installation configuration keepalived

1. Direct use yum install 133 hosts only install nginx:

yum -y install keepalived nginx

2. On the Host Configuration 131 keepalived:

vim /etc/keepalived/keepalived.conf
! Configuration File for keepalived

global_defs {// ignore this section Configuration
  notification_email {
  notification_email_from Alexandre.Cassen@firewall.loc
  smtp_connect_timeout 30
  router_id LVS_DEVEL

vrrp_instance VI_1 {
    state MASTER // host defined as MASTER
    interface eth0
    virtual_router_id 55 // virtual id
    priority 100 // Priority
advert_int 1 // detection interval
    authentication {
        auth_type PASS // authentication
        auth_pass abcd // authentication password
    virtual_ipaddress { // virtual ip, namely VIP

    Action after notify_master "/etc/init.d/nginx start" // become MASTER executed
    Action after notify_backup "/etc/init.d/nginx stop" // become BACKUP executed
    After notify_fault "/etc/init.d/nginx stop" // FAULT actions to be performed

3. 132 configuration files to the host, and configuration:

vim /etc/keepalived/keepalived.conf

-------------------------------------------------- only change the following two lines

state BACKUP // defined as BACKUP

priority 99 // Priority

4. The two hosts start keepalived service, which now hosts 131 to MASTER, so services have played on this host:

service keepalived start

ip addr show

5. Stop 131 host keepalived service, you can see the service has been transferred to the 132 this host:

service keepalived stop

6. Start again host keepalived 131 service, it can be seen from the log, it has become a MASTER

Second, the configuration of the reverse proxy nginx

1.131 and 132 host configuration nginx:

vim /etc/nginx/conf.d/default.conf
location / {// increase this paragraph

#location / {// Make this comment out
    # Root / usr / share / nginx / html;
    # Index index.html index.htm;
    # Example
    #ModSecurityEnabled On;
    #ModSecurityConfig /etc/nginx/modsecurity.conf;
service nginx restart
service keepalived restart

2.133 host starts a test page:

rm -rf / usr / share / nginx / html / * // delete the original page file
vim /usr/share/nginx/html/index.html
< H1> This is a test! < / H1>
service nginx start

Visit http: //,133 page file on the host in the reverse proxy successful. Close 131 host keepalived service, 132 host becomes MASTER, pages can still be accessed. However, when the process is nginx kill off, and can not achieve high availability.
- Linux network security probing tools Hping2 (Linux)
- OpenResty load balancing MySQL (Database)
- Use UDEV SCSI Rules configured ASM on Oracle Linux 5 and 6 (Database)
- MySQL separation Amoeba achieve literacy (Database)
- Java implementation of stacks and queues (Programming)
- Bitmap memory footprint of computing Android memory optimization (Linux)
- C ++ overloaded stream insertion operator and the stream extraction operator (Programming)
- Experience CoreCLR stack unwinding characteristics of initial implementation on Linux / Mac (Linux)
- CV: Linux command displays the progress of the run command (Linux)
- Strategy Games Ubuntu installation of Wesnoth 1.12.1 (Linux)
- CentOS 5.3 under broadcom NIC dual activation issues (Linux)
- Linux Getting Started tutorial: XWindow what (Linux)
- Linux System Getting Started Learning: The Linux anacron command (Linux)
- Oracle Migration partition table (Database)
- Ubuntu 14.04 / 13.10 users how to install Ubuntu Touch core applications (Linux)
- Linux and SELinux Exploration Program Manager (Linux)
- Binary search -Java achieve (Programming)
- ELKstack log analysis platform (Server)
- Use Epoll develop high-performance application server on Linux (Server)
- How to install Perl modules from CPAN (Linux)
  CopyRight 2002-2016 newfreesoft.com, All Rights Reserved.