-
Notifications
You must be signed in to change notification settings - Fork 67
Session
Subcommand | Synopsis |
---|---|
create | Create a new session |
destroy | Destroy a session |
info | Get information on a session |
list | List active sessions for a datacenter |
node | Get active sessions for a node |
renew | Renew the given session |
Create new session
Usage: consul-cli session list [options]
-
--lock-delay=<duration>
The amount of time before another process can acquire the lock after it is released. A duration of zero indicates that the lock can be immediately acquired after release. The default is 15s -
--name=<sessionName>
Assign the human-readable name to the session -
--node=<nodeName>
Associate the newly created session withnodeName
. By default, the agent's name is used -
--checks=<checkName>
Associate the check with the newly created session. Multiple--checks
options can be specified on the command line -
--behavior=[delete|release]
Lock behavior when the session is invalidated -
--ttl=<duration>
Time to Live for the session. A value of zero indicates that the session does not expire. The default is15s
$ ./consul-cli session create --ttl=0
d385ba9d-696e-4b98-5962-18bad549247e
Destroy the given session
Usage: consul-cli session destroy [options] sessionId
$ ./consul-cli session destroy d385ba9d-696e-4b98-5962-18bad549247e
$
Get information on a session
Usage: consul-cli session info [options] sessionId
$ ./consul-cli session info d385ba9d-696e-4b98-5962-18bad549247e
{
"CreateIndex": 462,
"ID": "d385ba9d-696e-4b98-5962-18bad549247e",
"Name": "",
"Node": "default",
"Checks": [
"serfHealth"
],
"LockDelay": 0,
"Behavior": "release",
"TTL": "0"
}
List active sessions for a datacenter
Usage: consul-cli session list [options]
$ ./consul-cli session list
[
{
"CreateIndex": 462,
"ID": "d385ba9d-696e-4b98-5962-18bad549247e",
"Name": "",
"Node": "default",
"Checks": [
"serfHealth"
],
"LockDelay": 0,
"Behavior": "release",
"TTL": "0"
}
]
Get the active sessions for a node
Usage: consul-cli session node [options] nodeName
$ ./consul-cli session node default
[
{
"CreateIndex": 462,
"ID": "d385ba9d-696e-4b98-5962-18bad549247e",
"Name": "",
"Node": "default",
"Checks": [
"serfHealth"
],
"LockDelay": 0,
"Behavior": "release",
"TTL": "0"
}
]
Renew the given TTL session
Usage: consul-cli session renew [options] sessionId
$ ./consul-cli session renew d385ba9d-696e-4b98-5962-18bad549247e
{
"CreateIndex": 462,
"ID": "d385ba9d-696e-4b98-5962-18bad549247e",
"Name": "",
"Node": "default",
"Checks": [
"serfHealth"
],
"LockDelay": 0,
"Behavior": "release",
"TTL": "0"
}