Skip to content
This repository has been archived by the owner on Jul 27, 2023. It is now read-only.

Session

ChrisAubuchon edited this page Jul 14, 2015 · 3 revisions

session-create

API Reference

Create new session

Basic Usage

Usage: consul-cli session-list [options]

Command Line 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 with nodeName. 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 is 15s

Examples

$ ./consul-cli session-create --ttl=0
d385ba9d-696e-4b98-5962-18bad549247e

session-destroy

API Reference

Destroy the given session

Basic Usage

Usage: consul-cli session-destroy [options] sessionId

Examples

$ ./consul-cli session-destroy d385ba9d-696e-4b98-5962-18bad549247e
$

session-info

API Reference

Get information on a session

Basic Usage

Usage: consul-cli session-info [options] sessionId

Examples

$ ./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"
}

session-list

API Reference

List active sessions for a datacenter

Basic Usage

Usage: consul-cli session-list [options]

Examples

$ ./consul-cli session-list 
[
  {
    "CreateIndex": 462,
    "ID": "d385ba9d-696e-4b98-5962-18bad549247e",
    "Name": "",
    "Node": "default",
    "Checks": [
      "serfHealth"
    ],
    "LockDelay": 0,
    "Behavior": "release",
    "TTL": "0"
  }
]

session-node

API Reference

Get the active sessions for a node

Basic Usage

Usage: consul-cli session-node [options] nodeName

Examples

$ ./consul-cli session-node default
[
  {
    "CreateIndex": 462,
    "ID": "d385ba9d-696e-4b98-5962-18bad549247e",
    "Name": "",
    "Node": "default",
    "Checks": [
      "serfHealth"
    ],
    "LockDelay": 0,
    "Behavior": "release",
    "TTL": "0"
  }
]

session-renew

API Reference

Renew the given TTL session

Basic Usage

Usage: consul-cli session-renew [options] sessionId

Examples

$ ./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"
}
Clone this wiki locally