website: Cleanup the 'lock' documentation

pull/627/head
Armon Dadgar 2015-01-21 17:35:06 -08:00
parent cf04d6ae31
commit d478f786db
1 changed files with 5 additions and 4 deletions

View File

@ -3,9 +3,7 @@ layout: "docs"
page_title: "Commands: Lock" page_title: "Commands: Lock"
sidebar_current: "docs-commands-lock" sidebar_current: "docs-commands-lock"
description: |- description: |-
The lock command provides a mechanism for leader election, mutual exclusion, The lock command provides a mechanism for leader election, mutual exclusion, or worker pools. For example, this can be used to ensure a maximum number of services running at once across a cluster.
or worker pools. For example, this can be used to ensure a maximum number of
services running at once across a cluster.
--- ---
# Consul Lock # Consul Lock
@ -25,6 +23,9 @@ If the lock holder count is more than one, then a semaphore is used instead.
A semaphore allows more than a single holder, but the is less efficient than A semaphore allows more than a single holder, but the is less efficient than
a simple lock. This follows the [semaphore algorithm](/docs/guides/semaphore.html). a simple lock. This follows the [semaphore algorithm](/docs/guides/semaphore.html).
All locks using the same prefix must agree on the value of `-n`. If conflictling
values of `-n` are provided, an error will be returned.
An example use case is for highly-available N+1 deployments. In these An example use case is for highly-available N+1 deployments. In these
cases, if N instances of a service are required, N+1 are deployed and use cases, if N instances of a service are required, N+1 are deployed and use
consul lock with `-n=N` to ensure only N instances are running. For singleton consul lock with `-n=N` to ensure only N instances are running. For singleton
@ -50,7 +51,7 @@ The list of available flags are:
* `-n` - Optional, limit of lock holders. Defaults to 1. The underlying * `-n` - Optional, limit of lock holders. Defaults to 1. The underlying
implementation switches from a lock to a semaphore when increased past implementation switches from a lock to a semaphore when increased past
one. one. All locks on the same prefix must use the same value.
* `-name` - Optional name to associate with the underlying session. * `-name` - Optional name to associate with the underlying session.
If not provided, one is generated based on the child command. If not provided, one is generated based on the child command.