github.com/ddfisher/etcdctl@v0.1.2-0.20130925194301-eab7435d452d/README.md (about)

     1  etcdctl
     2  ========
     3  
     4  [![Build Status](https://travis-ci.org/coreos/etcdctl.png)](https://travis-ci.org/coreos/etcdctl)
     5  
     6  `etcdctl` is a command line client for [etcd][etcd]. It can be used in scripts or for administrators to explore an etcd cluster.
     7  
     8  [etcd]: https://github.com/coreos/etcd
     9  
    10  ## Getting etcdctl
    11  
    12  The latest release is available as a binary at [Github][github-release] along with etcd.
    13  
    14  [github-release]: https://github.com/coreos/etcd/releases/
    15  
    16  You can also build etcdctl from source:
    17  
    18  ```
    19  ./build
    20  ```
    21  
    22  ## Usage
    23  
    24  ### Key Value Storage
    25  
    26  Setting a key on `/foo/bar`:
    27  
    28  ```
    29  etcdctl set /foo/bar "Hello world"
    30  Hello world
    31  ```
    32  
    33  Getting a key:
    34  
    35  ```
    36  etcdctl get /foo/bar
    37  Hello world
    38  ```
    39  
    40  Deleting a key:
    41  
    42  ```
    43  etcdctl delete /foo/bar
    44  Hello world
    45  ```
    46  
    47  Tailing a key:
    48  
    49  ```
    50  etcdctl watch /foo/bar -f
    51  Hello world
    52  .... client hangs forever until ctrl+C printing values as key change
    53  ```
    54  
    55  ### Sets
    56  
    57  `etcdctl` implements _sets_ on top of the key-value store that etcd
    58  provides. These are useful for storing lists of unique items. A common
    59  use-case is servers of a particular type that register themselves under
    60  an etcd key, so that they can be detected and used by clients.
    61  
    62  Adding members to a set:
    63  
    64  ```
    65  etcdctl sadd /queues amqp://user:password@rabbitmq1
    66  amqp://user:password@rabbitmq1
    67  etcdctl sadd /queues amqp://user:password@rabbitmq2 --ttl=60
    68  amqp://user:password@rabbitmq2
    69  ```
    70      
    71  List all members:
    72  
    73  ```
    74  etcdctl smembers /queues
    75  amqp://user:password@rabbitmq1
    76  amqp://user:password@rabbitmq2
    77  ```
    78  
    79  To delete a member:
    80  
    81  ```
    82  etcdctl sdel /queues amqp://user:password@rabbitmq1
    83  ```
    84  
    85  ## Return Codes
    86  
    87  0	Success
    88  
    89  1	Malformed etcdctl arguments
    90  
    91  2	Failed to connect to host
    92  
    93  3	Failed to auth (client cert rejected, ca validation failure, etc)
    94  
    95  4	400 error from etcd
    96  
    97  5	500 error from etcd
    98  
    99  ## Project Details
   100  
   101  ### Versioning
   102  
   103  etcdctl uses [semantic versioning][semver].
   104  Releases will follow lockstep with the etcd release cycle.
   105  
   106  [semver]: http://semver.org/
   107  
   108  ### License
   109  
   110  etcdctl is under the Apache 2.0 license. See the [LICENSE][license] file for details.
   111  
   112  [license]: https://github.com/coreos/etcdctl/blob/master/LICENSE