Use piranha to configure LVS

Source: Internet
Author: User

Use the piranha tool provided by RedHat to configure LVS

 

Yum-y install piranha

 

 

[[Email protected] ~] # Sed-n "/^ [^ #]/P"/etc/sysconfig/HA/LVS. cf

Serial_no = 18 # No.

Service = LVS # specify the service name of the dual Server

Primary = 10.2.16.250 # specify the real IP address of LVS

Network = direct # specify the LVS working mode. Direct indicates the Dr mode, Nat indicates the NAT mode, and tunnel indicates the Tun mode.

# Backup_active = 1 # Whether to activate the standby LVS scheduling server. If the value 0 indicates that the server is not activated, the value 1 indicates that the server is activated.

# Backup = 10.2.16.245 # specify the real IP address of the standby LVS scheduling server. If no standby ctor-server exists, use 0.0.0.0 instead.

# Heartbeat = 1 # indicates whether heartbeat is enabled. 1 indicates that heartbeat is enabled, and 0 indicates that heartbeat is disabled.

# Heartbeat_port = 539 # specify the UDP port for heartbeat

# Keepalive = 5 # Heartbeat interval, in seconds

# Deadtime = 10 # If the primary ctor-server does not respond after deadtime seconds, the Standby Director-server takes over the master

# Debug_level = none # define the debug information level


Virtual server1 {# Name of the virtual service provided by LVS to external users

Address = 10.2.16.252 eth0: 1 # VIP and network interfaces for external services

Vip_nmask = mask 255 # Set mask

Active = 1 # activate

Load_monitor = none? # LVS monitors the Load Status of real-server. The following describes how to run the rstatd service on the Real-server and ruptime on the Real-server.

Timeout = 5 # Remove the time required by the expired real-server from the LVS routing table after the real-server expires, in seconds

Reentry = 10 # The duration required to add a real-server to the LVS route table after it is removed. Unit: S.

Port = 80 # virtual service port

Send = "Get/HTTP/1.0 \ r \ n" # verification string sent to Real Server

Response Ct = "HTTP" # The text response information normally returned by the real-server is used to determine whether the real-server works normally.

Sched = RR # specify LVS to select RR Round Robin Scheduling Algorithm

Quiesce_server = 0 # If it is 1, when a new node joins LVS, the minimum number of connections is set to 0. Therefore, LVS sends a large number of requests to this node, causing service congestion, we recommend that you set it to 0.

Protocol = TCP # specify the protocol type

# Sorry_server = 127.0.0.1

Server real1 {# specify the service name of real-Server

Address = 10.2.16.253 # specify the real IP address of the Real-Server

Active = 1 # activate

Weight = 1 # weight

}

Server real2 {

Address = 10.2.16.254

Active = 1

Weight = 1

}

}



Run the nginx service on real-server, write and run the lvsrs script (for the script content, see another LVS configuration document in this blog ), specify the lo VIP of real-server as The lvs vip:

 

STARTUP script:

[[Email protected] ~] # Service lvsrs start

Start LVS of Real Server

 

Start the pulse service:

[[Email protected] ~] # Service pulse restart

Shutting down pulse: [OK]

 

View the LVS route table on Director-Server:

[[Email protected] ~] # Ipvsadm-ln

IP Virtual Server version 1.2.1 (size = 4096)

Prot localaddress: Port sched1_flags

-> Remoteaddress: port forward weight activeconn inactconn

TCP 10.2.16.252: 80 rr

-> 10.2.16.253: 80 Route 1 1 0

-> 10.2.16.254: 80 Route 1 1 0

 

Verification: Entering http: // 10.20..252/in the browser is successful!

 

 


This article is from the "fate" blog, please be sure to keep this source http://czybl.blog.51cto.com/4283444/1536507

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.