allows the addition, modification and deletion of sessions in a consul cluster. These sessions can then be used in conjunction with key value pairs to implement distributed locks. In depth documentation for working with sessions can be found here http://www.consul.io/docs/internals/sessions.html

Options

namedescriptionrequiredchoices
state whether the session should be present i.e. created if it doesn't exist, or absent, removed if present. If created, the ID for the session is returned in the output. If absent, the name or ID is required to remove the session. Info for a single session, all the sessions for a node or all available sessions can be retrieved by specifying info, node or list for the state; for node or info, the node name or session id is required as parameter.
  • present
  • absentinfonodelist
name the name that should be associated with the session. This is opaque to Consul and not required.
delay the optional lock delay that can be attached to the session when it is created. Locks for invalidated sessions ar blocked from being acquired until this delay has expired. Valid units for delays include 'ns', 'us', 'ms', 's', 'm', 'h'
node the name of the node that with which the session will be associated. by default this is the name of the agent.
datacenter name of the datacenter in which the session exists or should be created.
checks 1. list of checks that will be used to verify the session health. If all the checks fail, the session will be invalidated and any locks associated with the session will be release and can be acquired once the associated lock delay has expired.
host host of the consul agent defaults to localhost
port the port on which the consul agent is running

Author

Steve Gargan (@sgargan)