Rate This Document
Findability
Accuracy
Completeness
Readability

General Operations

The following operations are commonly performed in LVS O&M.

ipvsadm Operations on a Cluster

ipvsadm Operations on a Cluster:

ipvsadm -A|E|D -t|u|f  director_addr:port [-s scheduler] [-p [timeout]]

Table 1 describes the parameters.

Table 1 Parameters for ipvsadm to perform operations on a cluster

Parameter

Description

-A

Adds a cluster service.

-E

Edits a cluster service.

-D

Deletes a cluster service, example: ipvsadm -D -t 10.1.0.5:80.

-t

TCP protocol service

-u

UDP protocol service

-f

Firewall make, which binds two or more services as a service for processing. It is a number.

director_addr

Indicates VIP.

-s

Scheduling algorithm. The default value is wlc [rr wrr sh dh lc wlc sed nq lblc lblcr] unless otherwise specified.

-p

Indicates the LVS persistent connection. If no value is specified, the default value 300 seconds is used.

service-address

Indicates the IP address of the LVS server plus the protocol type and port number specified in the previous option.

An example of ipvsadm operations on a cluster:

ipvsadm -A -f 11 -s wrr     

In the preceding command, 11 is obtained by running the iptables xxxx -j MARK --set-mark 11 command. For example, you can use 80 and 443 in one command and use the ipvsadm tool to perform unified scheduling.

ipvsadm Operations on the RS

ipvsadm operations on the RS

ipvsadm -a -t|u|f director_addr:port -r RS_addr -[g|i|m] [-w weight]

The LVS type is defined here.

Table 2 describes the parameters.

Table 2 Parameters of ipvsadm operations on the RS

Parameter

Description

-a

Adds an RS.

-e

Performs modification.

-d

Performs deletion.

-r

Followed by ip[:port] of the RS.

-g

Gateway: DR. If this parameter is not specified, the DR model is used by default.

-m

Masquerade: NAT model

-i

IPIP: TUN model

-w

Weight. This parameter is used only for algorithms that support the weight. For example, the -w option is invalid for algorithms that do not support weight, such as RR and LC.

Other Rule Commands

Rule

Parameter

Description

Display rules

-L|l

-

-n, --numeric

Displays the host IP address and port number in numeric format, without reverse resolution of the IP address and port number.

--exact

Displays the exact value.

--stats

Statistical data

--rate

Rate

--timeout

Displays the timeout periods of the TCP, TCP FIN, and UDP sessions.

--sort

Displays the current IPVS connection status.

-c, --connection

Checks the number of connections.

Clear rules

ipvsadm -C

Clear.

Save rule.

(The default save path is /etc/sysconfig/ipvsadm.)

ipvsadm -S

Default standard output, which can be redirected to a specified file.

ipvsadm-save

Default standard output, which can be redirected to a specified file.

systemctl stop ipvsadm.service

Automatically saved when stopped

Import rules (two types)

ipvsadm -R < /saved_file

ipvsadm-restore < /saved_file

-