In the CentOS 6.4 system, Ipvs code has been included in the kernel, so only need to install user space management tools, how to see if the system kernel supports IPVS and how to install the User space Configuration tool, see below.
[Email protected] ~]# grep-i "Ip_vs"/boot/config-2.6.32-358.el6.x86_64 #查看内核中是否编译进了ipvs的代码
[Email protected] ~]# yum-y install Ipvsadm #安装用户空间的配置管理工具
Using Ipvs's User space Configuration management tool IPVSADM Configuring a load Balancing Cluster service system is broadly divided into two steps, the first defining a Cluster service, and the second step is to add individual real server nodes for this Cluster service.
Below is a brief introduction to the basic syntax for configuring and managing a load-balanced Cluster service system using IPVSADM:
1. Define a Cluster service
ipvsadm-a| E-t|u|f Service-address [-S scheduler]
--add-service-a adding a virtual Cluster service
--EDIT-SERVICE-E Modifying an existing virtual Cluster service
--tcp-service-t service-address service-address is host[:p ort] (define a TCP-based virtual service)
--udp-service-u service-address service-address is host[:p ort] (define a UCP-based virtual service)
--fwmark-service-f fwmark Fwmark is an integer greater than zero (defines the tag code for the firewall)
--scheduler-s Scheduler One of the rr|wrr|lc|wlc|lblc|lblcr|dh|sh|sed|nq,the default scheduler is WLC. (Define scheduling algorithm)
2. Delete the Cluster service
ipvsadm-d-t|u|f service-address
-D,--delete-service (delete Cluster service)
Delete a virtual service, along with any associated real servers.
3. Add a real server to the Cluster service
Ipvsadm-a|e-t|u|f service-address-r server-address [options]
-A,--add-server
ADD a real server to a virtual service. (Add an RS address to the cluster)
-E,--edit-server
Edit a real server in a virtual service. (Editing an RS in the cluster)
-R,--real-server server-address (Specify rs,host[:p ORT] format)
4. Delete the real server in the Cluster service
ipvsadm-d-t|u|f service-address-r server-address
-D,--delete-server
Remove a real server from a virtual service. (Remove the specified real server from the virtual service)
5, clear all the cluster services
Ipvsadm-c
-C,--clear
Clear the Virtual server table. (Empty the Cluster service)
6. Save and reload rules
Ipvsadm-s >/path/to/some_rule_file (save with output redirection to save rules in a file, saved in/etc/sysconfig/ipvsadm by default)
-S,--save
Dump the Linux Virtual Server rules to stdout in a format that can is read by
Ipvsadm-r </path/from/some_rule_file (the default is to read the rules from the standard input, usually using input redirection to read files that have saved the rule)
-R,--restore
7. View the defined Cluster service and real server information
Ipvsadm-l-N
-C: View each connection condition to see which client accessed which virtual service, the director dispatched to the backend which real server information
--stats: Display statistics to see the number of client accesses, Bytes received and sent
--rate: Display Rate
--exact: Show exact values
This article is from the "focus on operations, and Linux Dances" blog, please be sure to keep this source http://zhaochj.blog.51cto.com/368705/1650098
Introduction to LVS installation and basic grammar