Cluster Generation 3 (using the ipvsadm command)

Source: Internet
Author: User

Because your cluster is implemented in the user space, similar to the iptables service in linux, you need to use ipvsadm to implement it. Since linux kernel version 2.6, the Code has been compiled into the kernel, for an earlier version, you need to manually compile it into the kernel and re-compile the kernel. The ipvsadm command is the cluster service command used to deal with the kernel. For convenience, I will refer to the man manual to sort out the use methods related to ipvsadm.
To help you better understand this command manual, let's give a brief introduction to the terms used in the manual:
1. virtual-service-address: indicates the ip address of the virtual server.
2. real-service-address: the ip address of the real Server.
3. sched: Scheduling Method
( translation ipvsadm v1.21 April 2004)
The usage and format of ipvsadm are as follows:
Ipvsadm-A | E-t | u | f virutal-service-address: port [-s scheduler] [-p
[Timeout] [-M netmask]
Ipvsadm-D-t | u | f virtual-service-address
Ipvsadm-S [-n]
Ipvsadm-a | e-t | u | f service-address: port-r real-server-address: port
[-G | I | m] [-w weight]
Ipvsadm-d-t | u | f service-address-r server-address
Ipvsadm-L | l [options]
Ipvsadm-Z [-t | u | f service-address]
Ipvsadm -- set tcp tcpfin udp
Ipvsadm -- start-daemon state [-- mcast-interface]
Ipvsadm -- stop-daemon

Command Option explanation:
There are two Command Option formats, long and short, with the same meaning. In actual use, either of them can be used.
-A -- add-service adds A new virtual server record in the virtual server table of the kernel. That is, add a new virtual server.
-E -- edit-service: edit a virtual server record in the kernel virtual server table.
-D -- delete-service: delete a virtual server record in the kernel virtual server table.
-C -- clear clears all records in the kernel virtual server table.
-R -- restore virtual server rules
-S -- save saves the Virtual Server rule and outputs the readable format of the-R Option
-A -- add-server adds a new Real server record to a record in the kernel virtual server table. That is, add a new real server to a virtual server.
-E -- edit-server: edit a Real server record in a virtual server record
-D -- delete-server: delete a Real server record in a virtual server record.
-L |-l -- list displays the kernel virtual server table
-Z -- zero virtual service table counters are cleared (the current number of connections is cleared, etc)
-- Set tcp tcpfin udp sets the connection timeout value
-- Start-daemon: start the synchronization daemon. It can be followed by a master or backup to indicate that the LVS Router is a master or backup. You can also use the VRRP feature of keepalived.
-- Stop-daemon: stop synchronization daemon
-H -- help: displays help information.

Other options:
-T -- tcp-service-address indicates that the virtual server provides the tcp service.
[Vip: port] or [real-server-ip: port]
-U -- udp-service-address indicates that the virtual server provides udp services.
[Vip: port] or [real-server-ip: port]
-F -- fwmark-service fwmark indicates the service type marked by iptables.
-S -- the scheduling algorithm used by scheduler, which has the following options:
Rr | wrr | lc | wlc | lblc | lblcr | dh | sh | sed | nq,

The default scheduling algorithm is: wlc.
-P -- persistent [timeout] persistent and stable service. This option means that multiple requests from the same customer will be processed by the same real server. The default timeout value is 300 seconds.
-M -- netmask persistent granularity mask
-R -- real-server-address Real Server [real-server: port]
-G -- gatewaying specifies that the LVS working mode is the direct routing mode (also the default LVS mode)
-I -- ipip: Specify the LVS working mode as tunnel mode.
-M -- masquerading: Specify the LVS working mode as NAT
-W -- weight actual server weight
-- Mcast-interface: Specifies the multicast synchronization interface.
-C -- connection displays the current connection of LVS, for example, ipvsadm-L-c.
-- Timeout: display the timeout value of tcp tcpfin udp, for example, ipvsadm-L -- timeout.
-- Daemon: displays the synchronization daemon status.
-- Stats display statistics
-- Rate: Display rate information
-- Sort sorts and outputs virtual servers and real servers
-- Numeric-n: Number of output IP addresses and ports

Author: "Long marks"

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: 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.