The type command configures a sticky session mode.
The undo type deletes the configured sticky session mode and restores the default configuration.
type { cookie-insert | cookie-passive | cookie-rewrite | source-ip | session-id } [ aging-time aging-time ]
undo type
| Parameter | Description | Value |
|---|---|---|
| cookie-insert | Indicates the HTTP cookie-insert mode of sticky session. | - |
| cookie-passive | Indicates the HTTP cookie-passive mode of sticky session. | - |
| cookie-rewrite | Indicates the HTTP cookie-rewrite mode of sticky session. | - |
| source-ip | Indicates the client source IP address-based sticky session mode. | - |
| session-id | Indicate the SSL session ID-based sticky session mode. | - |
| aging-time aging-time | Specifies the aging time of a sticky session node. | The value is an integer ranging from 1 to 65535.
|
By default, the sticky session mode is source-ip.
If the virtual server protocol is SSL, the sticky session mode can be session-id or source-ip. If the virtual server protocol is HTTP or HTTPS (SSL uninstallation is configured for HTTPS), the sticky session mode can be cookie-insert, cookie-passive, cookie-rewrite, or source-ip. If the virtual server protocol is another protocol, the sticky session mode can only be source-ip. If the sticky session mode is not selected correctly, a prompt "virtual server protocol conflicts with the session persistence mode" is displayed.
If many clients access the server through the proxy or source NAT, the sticky session mode source-ip is not preferred. If the sticky session mode source-ip is set, the connections of all clients are allocated to one real server, causing server load unbalancing.
# Set the sticky session mode to Cookie-insert and use the default aging time.
<sysname> system-view [sysname] slb [sysname-slb] persistence a [sysname-slb-persistence-0] type cookie-insert
# Set the sticky session mode to Cookie-insert and the aging time to 800 seconds.
<sysname> system-view [sysname] slb [sysname-slb] persistence a [sysname-slb-persistence-0] type cookie-insert aging-time 800