Home IT Linux Windows Database Network Programming Server Mobile  
  Home \ Server \ Keepalived achieve high availability Nginx Reverse Proxy     - Browser caching mechanism on the analysis (Linux)

- The difference between equals and == in Java (Programming)

- Linux Network Programming - raw socket Example: sending a UDP packet (Programming)

- C language function pointer and a callback function (Programming)

- Oracle 12C RAC optimizer_adaptive_features cause of data into overtime (Database)

- systemctl Command Complete Guide (Linux)

- How to fix apt-get update can not add a new CD-ROM error (Linux)

- Linux System shutdown procedures (Linux)

- Sublime Text 3 best features, plug-ins and settings (Linux)

- Source code to compile and install MySQL 5.7.9 (Database)

- Use chattr and lsattr command to manage linux files and directory attributes (Linux)

- Singleton (Linux)

- CentOS 6.4 RPM install MySQL-5.6.22-1 (Database)

- Zabbix Agent for Linux Installation and Configuration (Server)

- Linux non-graphical interface to install Oracle Database (Database)

- How to achieve SSH without password login (Server)

- How to install or upgrade to the Linux kernel in Ubuntu 4.2 (Linux)

- CentOS7 install JDK (Linux)

- Linux security settings Basics (Linux)

- Docker Private Registry Installation Guide at CentOS6.X (Linux)

  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.
- Exploring the Android Listview display confusion (Programming)
- shell script: a key optimization CentOS system (Linux)
- Linux serial debugging tools xgcom install (Linux)
- Compiling source code Nginx module installation subs_filter (Server)
- Ubuntu 14.04 installed VirtualBox 4.3 appears vboxdrv: Unknown symbol mcount (Linux)
- Thinking in Java study notes - initialization and cleanup (Programming)
- Proficient in C / C ++ can also find a very good job (Programming)
- Oracle () trunc function usage (Database)
- Command filter MySQL slow query log (Database)
- Analysis of MySQL Dockerfile 5.6 (Database)
- Four levels to deal with Linux server attacks (Linux)
- Unable to solve the official version of Android Studio online update problem (Linux)
- CentOS install video converter FFmpeg and cutting tools segmenter (Linux)
- Linux system security configuration (Linux)
- Shell programming entry (Programming)
- OpenSSL for secure transmission and use of skills of files between Windows and Linux (Linux)
- VMware clone Linux find eth0 (Linux)
- Advanced permissions Linux file system settings (Linux)
- Android working with Volley Comments (Programming)
- Oracle archive log summary (Database)
  CopyRight 2002-2016 newfreesoft.com, All Rights Reserved.