Commit Graph

545 Commits (5c726cfe255a2ea50c2a1c8e5d0f893e60eb451a)

Author SHA1 Message Date
Hitoshi Mitake 0173564122 etcdctl: slightly enhance output of role revoke-permission 2016-06-20 16:57:50 +09:00
Ajit Yagaty ad5d55dd4c v3api: Add a flag to RangeRequest to return only the keys.
Currently the user can't list only the keys in a prefix search. In
order to support such operations the filtering will be done on the
server side to reduce the encoding and network transfer costs.
2016-06-19 14:18:39 -07:00
Hitoshi Mitake 18253e2723 *: support getting all users and roles in auth v3
This commit expands RPCs for getting user and role and support list up
all users and roles. etcdctl v3 is now support getting all users and
roles with the newly added option --all e.g. etcdctl user get --all
2016-06-17 16:22:41 +09:00
Gyu-Ho Lee 1e38ab1706 etcdctl: print API version (v2, v3 separate) 2016-06-14 15:33:39 -07:00
Hitoshi Mitake 253e313c09 *: support granting and revoking range
This commit adds a feature for granting and revoking range of keys,
not a single key.

Example:
$ ETCDCTL_API=3 bin/etcdctl role grant r1 readwrite k1 k3
Role r1 updated
$ ETCDCTL_API=3 bin/etcdctl role get r1
Role r1
KV Read:
        [a, b)
        [k1, k3)
        [k2, k4)
KV Write:
        [a, b)
        [k1, k3)
        [k2, k4)
$ ETCDCTL_API=3 bin/etcdctl --user u1:p get k1 k4
k1
v1
$ ETCDCTL_API=3 bin/etcdctl --user u1:p get k1 k5
Error:  etcdserver: permission denied
2016-06-08 14:58:25 -07:00
Gyu-Ho Lee 624d5eb0cb etcdctl: support range_end for watch command
Fix https://github.com/coreos/etcd/issues/5575.
2016-06-07 16:52:15 -07:00
Gyu-Ho Lee 1e4d3603db clientv3,ctlv3: following changes for proto change 2016-06-07 13:32:36 -07:00
Xiang Li 83ce1051ff auth: make naming consistent 2016-06-07 10:54:50 -07:00
Katsuyuki Tateishi 8b75a33398 *: replace '-' with '--' for long options
A long option should have double dashes (cf. #4595),
so are error messages.
2016-06-06 12:25:45 +09:00
Hitoshi Mitake 94f22e8a07 *: rename RPCs and structs related to revoking
This commit renames RPCs and structs related to revoking.
1. UserRevoke -> UserRevokeRole
2. RoleRevoke -> RoleRevokePermission
2016-06-05 16:57:23 +09:00
Hitoshi Mitake c7a1423d45 *: support deleting a role in auth v3
This commit implements RoleDelete() RPC for supporting deleting a role
in auth v3. It also adds a new subcommand "role delete" to etcdctl.
2016-06-04 13:42:45 +09:00
Hitoshi Mitake 0cb1343109 *: support revoking a key from a role in auth v3
This commit implements RoleRevoke() RPC for supporting revoking a key
from a role in auth v3. It also adds a new subcommand "role revoke" to
etcdctl.
2016-06-04 13:42:45 +09:00
Hitoshi Mitake 957b07c408 *: support revoking a role from a user in auth v3
This commit implements UserRevoke() RPC for supporting revoking a role
from a user in auth v3. It also adds a new subcommand "user revoke" to
etcdctl.
2016-06-04 13:39:26 +09:00
Hitoshi Mitake 10ee69b44c *: support getting role in auth v3
This commit implements RoleGet() RPC of etcdserver and adds a new
subcommand "role get" to etcdctl v3. It will list up permissions that
are granted to a given role.

$ ETCDCTL_API=3 bin/etcdctl role get r1
Role r1
KV Read:
        b
        d
KV Write:
        a
        c
        d
2016-06-03 13:03:54 +09:00
Hitoshi Mitake 5609fdb9a8 *: support getting user in etcdctl v3
This commit adds a new subcommand "user get" to etcdctl v3. It will
list up roles that are granted to a given user.

Example:
$ ETCDCTL_API=3 bin/etcdctl user get u1
User: u1
Roles: r1 r2 r3

This commit also modifies the layout of InternalRaftRequest for
frequent update of auth related members.
2016-06-02 12:10:19 +09:00
Gyu-Ho Lee 240757729c etcdctl: make v3 as default README 2016-06-01 11:36:21 -07:00
Anthony Romano 2cd3a3bd59 etcdctl: improve error message on migration without v2 keys
Fixes #5478
2016-05-30 19:14:04 -07:00
Gyu-Ho Lee c43e59338f etcdctl/ctlv3: remove mvccpb.EXPIRE in mirror cmd 2016-05-29 15:11:29 -07:00
Gyu-Ho Lee 5cba7080bc etcdctl/ctlv3: protobuf write-out for member list
Fix https://github.com/coreos/etcd/issues/5297.
2016-05-25 22:23:57 -07:00
Gyu-Ho Lee 86591d64c5 etcdctl: doc member list, others protobuf output 2016-05-25 22:17:45 -07:00
Xiang Li 628a38d906 etcdctl: add migrate command into readme 2016-05-19 16:53:47 -07:00
Xiang Li 6f2e7875aa etcdctl: add migrate command
Migrate command accepts a datadir and an optional user-provided
transformer function that transform v2 keys to v2 keys.

Migrate command then builds a v3 backend state based on the existing
v2 keys and the output of the transformer function.
2016-05-19 12:17:15 -07:00
Hitoshi Mitake 6259318521 *: attach auth token as a gRPC credential
This commit adds a functionality of attaching an auth token to gRPC
connection as a per RPC credential.

For doing this, this commit lets clientv3.Client.Dial() create a
dedicated gRPC connection for doing authentication. With the dedicated
connection, the client calls Authenticate() RPC and obtain its
token. The token is attached to the main gRPC connection with
grpc.WithPerRPCCredentials().

This commit also adds a new option --username to etcdctl (v3). With
this option, etcdctl attaches its auth token to the main gRPC
connection (currently it is not used at all).
2016-05-17 13:26:12 +09:00
Anthony Romano 798718c49b etcdctl: verify snapshot hash on restore
Fixes #4097
2016-05-16 12:08:08 -07:00
Gyu-Ho Lee 3ec627d1a8 etcdctl/ctlv3: allow empty key
Fix https://github.com/coreos/etcd/issues/5323.
2016-05-13 11:29:58 -07:00
Anthony Romano 393725fe5f clientv3/concurrency: ctx-ize Leader(), Resign(), and Unlock() 2016-05-13 10:07:35 -07:00
Gyu-Ho Lee c538e0f9a9 etcdctl: update LICENSE header 2016-05-12 20:51:39 -07:00
Anthony Romano dcb3b7aecf *: scrub legacy ports from code and scripts 2016-05-11 13:46:30 -07:00
Anthony Romano db8f5771f1 doc: scrub legacy ports and TLS information for v3 2016-05-11 13:46:29 -07:00
Ajit Yagaty 23f9d72870 etcdctl: Add --wal-dir and --backup-wal-dir options to backup command.
If the WAL is stored in a separate directory then the backup command
would need a --wal-dir option to pick the path to the WAL directory.
The user might also want to store the backup of data and wal separately
for which --backup-wal-dir option is provided.
2016-05-10 18:38:56 -07:00
Gyu-Ho Lee 62a9209088 etcdctl/ctlv2: total-timeout for Sync
Fix https://github.com/coreos/etcd/issues/4897.
2016-05-10 14:20:05 -07:00
Gyu-Ho Lee 3e088b3b40 etcdctl/ctlv3: make 'table' printer configurable
Fix https://github.com/coreos/etcd/issues/5296.
2016-05-10 10:02:02 -07:00
Ajit Yagaty adc981c53d auth: Adding support for "auth disable" command.
Added support for the auth disable command in the server, added the
etcdctl command and a respective testcase.
2016-05-07 19:21:49 -07:00
Gyu-Ho Lee 01927cc26a *: remove v2 specific authentication doc 2016-04-27 11:30:51 -07:00
Rob Holland a00be40db2 etcdctl: Add a newline so that errors don't bleed into each other. 2016-04-27 14:25:57 +01:00
Anthony Romano b7ac758969 *: rename storage package to mvcc 2016-04-25 15:25:51 -07:00
Gyu-Ho Lee 3ad8e91e00 *: fix flag location, minor typo 2016-04-25 09:41:11 -07:00
Gyu-Ho Lee 53abaf86c6 etcdctl/ctlv3: close bolt.DB in snapshot status 2016-04-22 11:43:52 -07:00
Anthony Romano d2a58cbb0a etcdctl: print full json response for Get
Otherwise parsing get/txn output with json is somewhat complicated
because in some cases there's a json message and sometimes not.
Likewise, a get on an absent key has to return the current revision for
some algorithms to work.
2016-04-20 09:56:32 -07:00
Xiang Li bf9cccfc34 Merge pull request #5118 from ajityagaty/fsync_osx
fileutil: Sync on HFS/OSX needs to be handled differently.
2016-04-18 22:22:53 -07:00
Ajit Yagaty 8b6de5f85d fileutil: Sync on HFS/OSX needs to be handled differently.
A call file.Sync on OSX doesn't guarantee actual persistence on
physical drive media as the data can be cached in physical drive's
buffers. Hence calls to file.Sync need to be replaced with
fcntl(F_FULLFSYNC).
2016-04-18 21:49:04 -07:00
Gyu-Ho Lee 8a0fa5622e Merge pull request #5114 from gyuho/snapshot_test
*: add Snapshot e2e test
2016-04-18 09:27:07 -07:00
Ajit Yagaty 68dd22d93d etcdctlv3: Fix for typo in alarm command handling. 2016-04-17 19:31:39 -07:00
Gyu-Ho Lee a2afb513dd *: add snapshot e2e test 2016-04-16 13:27:10 -07:00
Amit Kumar Gupta c629a30f1f etcdctl: unset ETCDCTL_API env var properly 2016-04-15 15:43:00 -07:00
Gyu-Ho Lee a78ece4ac2 etcdctl: snapshot status error for non-existent file 2016-04-15 14:15:16 -07:00
Anthony Romano cd05ac4217 doc: document many etcdctl commands
documents defrag, compaction, lease, snapshot status, member, endpoint
2016-04-13 21:50:59 -07:00
Anthony Romano f07350735d etcdctl: respect --write-out=json for endpoint status command 2016-04-13 17:04:31 -07:00
Gyu-Ho Lee e9aa8ff235 Merge pull request #5071 from gyuho/member_api_change
*: Member api change
2016-04-13 16:45:10 -07:00
Anthony Romano 3dcfe79cc0 Merge pull request #5070 from heyitsanthony/member-doc
etcdctl: display required arguments for member commands in usage
2016-04-13 16:40:16 -07:00
Gyu-Ho Lee 2c6176b5f2 *: remove MemberLeader API in client side (fix examples) 2016-04-13 16:23:57 -07:00
Anthony Romano 90df7fd738 etcdctl: display required arguments for member commands in usage 2016-04-13 16:18:00 -07:00
Anthony Romano 22812badc2 Merge pull request #5069 from heyitsanthony/fix-snapshot-status-json
etcdctl: respect -write-out=json for snapshot status
2016-04-13 15:57:39 -07:00
Anthony Romano b90e30b28e etcdctl: respect -write-out=json for snapshot status 2016-04-13 13:37:32 -07:00
Anthony Romano a553ea8ba7 Merge pull request #5068 from heyitsanthony/lease-fixups
etcdctl: improve lease command documentation and exit codes
2016-04-13 13:20:06 -07:00
Anthony Romano 993f25f055 Merge pull request #5065 from heyitsanthony/errexit-defrag
etcdctl: return non-zero exit code if defrag fails on any endpoint
2016-04-13 13:19:43 -07:00
Anthony Romano 721ed6ba2b etcdctl: return non-zero exit code if defrag fails on any endpoint 2016-04-13 12:39:43 -07:00
Anthony Romano 855a5116a2 etcdctl: improve lease command documentation and exit codes 2016-04-13 12:38:21 -07:00
Gyu-Ho Lee 60548b85c4 *: add rev flag to get command 2016-04-13 11:32:29 -07:00
Xiang Li ae9b251d99 etcdctl: move endpoint-heath and status into endpoint command 2016-04-12 16:30:26 -07:00
Anthony Romano a12fd9cc92 etcdctl: print grant/revoke error instead of scanning roles for changes
Fixes #5045
2016-04-12 10:49:05 -07:00
mqliang ff311ba0a7 etcdctlv3: print db size and raft status in 'etcdctl status' command 2016-04-12 22:58:22 +08:00
Xiang Li b5292f6fce etcdctl: add snapshot status support 2016-04-11 22:55:47 -07:00
Anthony Romano 8c2225f251 Merge pull request #5038 from heyitsanthony/sshot-docs
doc: document etcdctl snapshot command
2016-04-11 16:21:09 -07:00
Anthony Romano e5a2bd58ec etcdctl: respect --write-out
Support got clobbered about a month ago.
2016-04-11 16:01:38 -07:00
Anthony Romano 6e8d01f956 doc: document etcdctl snapshot command 2016-04-11 15:58:20 -07:00
Anthony Romano be822b05d2 Merge pull request #5012 from heyitsanthony/snap-api
*: snapshot RPC
2016-04-11 13:00:18 -07:00
Anthony Romano e838c26f8a etcdctl: use snapshot RPC in snapshot command 2016-04-11 12:32:53 -07:00
Hitoshi Mitake 7ba2646d37 *: support granting a role to a user in v3 auth 2016-04-11 15:53:30 +09:00
Hitoshi Mitake 097cec8194 etcdctl: let some v3 auth related functions be private
They don't need to be public.
2016-04-11 13:01:19 +09:00
Hitoshi Mitake 02033b4c47 *: support granting key permission to role in v3 auth 2016-04-11 12:23:19 +09:00
Gyu-Ho Lee fb85da92e8 *: fix based on gosimple and unused 2016-04-07 23:16:37 -07:00
Anthony Romano dc17eaace7 *: rename Lease Create to Grant
Creating a lease through the client API interface union looked like
"c.Create(...)"-- the method name wasn't very descriptive.
2016-04-07 12:28:14 -07:00
Gyu-Ho Lee 6e6d64fb9b *: clean up unused vars, functions
With help from https://github.com/dominikh/go-unused.
IsNetTimeoutError seems useful, so moved to pkg/netutil.
2016-04-06 21:33:55 -07:00
Xiang Li c3bca3739f Merge pull request #4926 from mitake/auth-role-add
*: support adding role in auth v3
2016-04-04 18:44:16 -07:00
Hitoshi Mitake 2b17a3919c *: support adding role in auth v3 2016-04-05 09:28:17 +09:00
Gyu-Ho Lee 1543e7bd95 etcdctl: READMEv3 doc about prefix 2016-04-04 07:00:49 -07:00
Gyu-Ho Lee 9afae9e2c1 *: add del by prefix with e2e tests 2016-04-03 11:41:49 -07:00
Xiang Li 19136afc2b Merge pull request #4798 from mqliang/memberStatus
etcdctlv3: initial implementaton of 'etcdctl member status' command
2016-04-03 08:48:23 -07:00
mqliang d80af00785 etcdctlv3: implement the 'etcdctl status' command 2016-04-03 13:55:58 +08:00
Gyu-Ho Lee e8877ab180 etcdctl: print number of deleted keys 2016-04-02 20:54:37 -07:00
Hitoshi Mitake 73166b41e9 *: support changing password in v3 auth
This commit adds a functionality for updating password of existing
users.
2016-03-31 15:28:15 +09:00
Hitoshi Mitake 2ad9b5692f etcdctl: print messages for successful auth operations
This commit lets etcdctl v3 follow the manner of etcdctl v2.
2016-03-31 13:56:01 +09:00
Hitoshi Mitake d8888ded12 *: support deleting user in v3 auth
This commit adds a functionality of user deletion. It can be invoked
with the new user delete command.

Example usage:
$ ETCDCTL_API=3 etcdctl user delete usr1
2016-03-31 13:18:51 +09:00
Anthony Romano 2aca3252e8 etcdctl: alarm command 2016-03-30 13:33:52 -07:00
kayrus 720502b25f etcdctl: Handle ETCDCTL_USERNAME environment 2016-03-29 19:06:31 +02:00
Ajit Yagaty 2e3856740d etcdctl: Add aliases for command flags.
Add aliases to the flags that are supplied to the sub commands.
2016-03-28 20:57:34 -07:00
Xiang Li 87d9f06a45 *: combine etcdctl and etcdctlv3 2016-03-28 11:28:05 -07:00
Anthony Romano bd832e5b0a *: migrate Godeps to vendor/ 2016-03-22 17:10:28 -07:00
Gyu-Ho Lee 67c2384bdf *: replace '-' with '--' in doc
Fix https://github.com/coreos/etcd/issues/4595.
2016-03-21 11:12:43 -07:00
mqliang d8c315ab55 etcdctl: show leader/member information when run 'etcdctl member list' command
leader/follower information is very helpful for debugging. User must get this information through http endpoint
before this patch, which is inconvenient.
2016-03-16 13:48:37 +08:00
Xiang Li bab8f43cb0 Merge pull request #4726 from ajityagaty/mk_in_order
etcdctl: Add command to create in-order keys.
2016-03-13 10:15:42 -07:00
Ajit Yagaty ef0c8e5c18 etcdctl: Add an option to mk command to create in-order keys.
Adding a new option to the mk command to create in-order keys
under a given directory, identified by <key> argument. Optionally
TTL can also be set on the newly created in-order key.
2016-03-10 20:28:28 -08:00
Anthony Romano edafbe9555 etcdctl: clarify setdir purpose in help message
Fixes #4640
2016-03-09 14:38:57 -08:00
Anthony Romano 02d9aa481b etcdctl: accept user:pass format for add user
Otherwise needed an interactive terminal to create a user.
2016-03-04 13:29:06 -08:00
Xiang Li 6053480b75 Merge pull request #4580 from AdoHe/etcdctl_use_endpoints
etcdctl: use endpoints instead of endpoint flag
2016-02-24 19:01:42 -08:00
AdoHe d8a8116f9a etcdctl: use endpoints instead of endpoint flag 2016-02-24 21:49:50 -05:00
Anthony Romano c5b51946eb *: exported godoc fixups 2016-02-21 20:36:44 -08:00
Gyu-Ho Lee 658f2e53ba etcdctl: make doc on 'no-sync' clearer
For issues like https://github.com/coreos/etcd/issues/4496.
2016-02-11 19:52:03 -08:00
Josh Wood cb7ebe81a8 Merge pull request #4359 from joshix/kayrus-deprcpeers
etcdctl: Changed default "endpoint" servers order
2016-01-30 21:20:10 -08:00
kayrus 1b7b20f4f8 etcdctl: Changed default "endpoint" servers order
And added "DEPRECATED" note to a "peers" option (relates to d685135832)

Updated to amend commit.
2016-01-30 21:07:57 -08:00
Gyu-Ho Lee c8eebd0070 etcdctl: use os.Stdout, os.Stderr directly for cmd 2016-01-27 00:54:40 -08:00
Hitoshi Mitake cae0577619 etcdctl: add an option to ls for consistent result
Like the commit 11f49a0960, this commit adds a new option "--quorum"
to etcdctl ls command. It is required for obtaining a consistent
result.
2016-01-21 14:03:10 +09:00
Joe Haddad 476178fce0 etcdctl: add docs for configuration flags and env vars 2016-01-15 19:46:29 -05:00
Gyu-Ho Lee 054db2e3cf etcdctl, etcdctlv3: add help message for non-valid value arg
Unix commands interprets argument value of first character '-'
as a flag. And this won't be fixed in our upstream CLI libraries.
This adds help message to show users workarounds.

Addressing https://github.com/coreos/etcd/issues/2020.
2016-01-13 09:25:24 -08:00
Gyu-Ho Lee dd02ec6554 etcdctl: ignore value in updatedir command
Fixes coreos#4145.
client.KeysAPI ignores value if SetOptions.Dir is true.
2016-01-06 16:37:04 -08:00
Xiang Li 34abead33e etcdctl: fix syncWithPeerAPI by breaking the loop when there is no error 2015-12-30 11:06:42 -08:00
Anthony Romano 4477ef636e etcdctl: return exitcode 2 if can't connect to any peers 2015-12-28 23:04:34 -08:00
Xiang Li 2681137fe0 Merge pull request #4020 from xiang90/ctl_04
etcdctl: support etcd0.4
2015-12-21 12:55:03 -08:00
Xiang Li 541f2e5200 etcdctl: support basic operations with etcd 0.4.
For CoreOS users, they will get a updated version of etcdctl without updating
the etcd server version. And the users cannot really control this behavior.
We do not want to suddenly break them without enough communication.

So we still want the most basic opeartions like get, set, watch of etcdctl2 work
with etcd 0.4. This patches solve the incompability issue.
2015-12-21 11:59:13 -08:00
Anthony Romano 2974c4ec27 etcdctl: fill out ArgsUsage fields for help
USAGE in help now names positional arguments (e.g., "member remove <memberID>"
instead of "member remove [arguments...]")

Fixes #4021
2015-12-21 09:05:37 -08:00
Gyu-Ho Lee bccc602c8f etcdctl/command: fix shawdowed error variable
This fixes https://github.com/coreos/etcd/issues/3954.
2015-12-12 09:13:12 -08:00
Gyu-Ho Lee e8215cc577 etcdctl: remove duplicate exit line
`handleError` already exits with the exit code in arguments.
`os.Exit(1)` is never executed in this case.
2015-11-25 09:41:27 -08:00
Xiang Li e39206e084 etcdctl: cluster health exit with non-zero when cluster is unhealthy 2015-11-20 13:51:31 -08:00
Hitoshi Mitake 11f49a0960 etcdctl: a new option for quorum get
Current etcdctl seems to lack an option for specifying quorum flag for
GET. This commit adds the option.
2015-11-20 14:09:50 +09:00
Gyu-Ho Lee 81229dbea9 *: add missing package descriptions
This adds and updates package descriptions in etcd projects.
And also deletes some duplicate LICENSE statements.
2015-11-17 20:54:10 -08:00
mqliang b2d92dedae etcdctl:fix health check condition 2015-10-18 08:22:13 +08:00
Gyu-Ho Lee 1dab7e8084 etcdctl/command: mk command with PrevNoExist
This attempts to fix #3676. `PrevNoExist` checks if the key previously exists
and if so, it returns an error, which is how `mk` command is supposed to work.
The previous code ignores the previous key and overwrites with the later value.

/cc @yichengq
2015-10-15 09:05:17 -07:00
Yicheng Qin afd74dfeb7 Merge pull request #3611 from mitake/etcdctl-timeout
etcdctl: use a context with -total-timeout in simple commands
2015-10-14 16:13:34 -07:00
Yicheng Qin 9673eb625a pkg/transport: pass dial timeout to NewTransport
So we could set dial timeout for new transport, which makes it
customizable according to max RTT.
2015-10-11 10:09:25 -07:00
Hitoshi Mitake 33a0df3e33 etcdctl: use a context with -total-timeout in simple commands
Like the commit 8ebc933111, this commit lets simple etcdctl commands
use a context with timeout value passed via -total-timeout.

This commit doesn't change complex commands like watch,
cluster-health, and import because it is not obvious that using the
context in the commands is good or not.
2015-09-29 17:23:01 +09:00
Hitoshi Mitake 8ebc933111 etcdctl: use user specified timeout value for entire command execution
etcdctl should be capable to use a user specified timeout value for
total command execution, not only per request timeout. This commit
adds a new option --total-timeout to the command. The value passed via
this option is used as a timeout value of entire command execution.

Fixes coreos#3517
2015-09-28 10:31:46 +09:00
Jonathan Boulle 7848ac3979 *: add missing license headers 2015-09-15 14:09:01 -07:00
Dmitry Smirnov b2f4a5f587 *: fix spelling issues (codespell).
Signed-off-by: Dmitry Smirnov <onlyjob@member.fsf.org>
2015-09-11 10:22:29 +10:00
Xiang Li 322aab133d etcdctl: suggest endpoint over peer 2015-09-04 13:16:33 -07:00
Xiang Li 04539c6240 etcdctl: prepare for health endpoint change
We made a mistake on the health endpoint by returning a string "true".
We have to make the etcdctl works for the next version of etcd which
will correct the mistake on the server side.

It is too late to change the server side right now since we already
released a version of etcdctl that only understands "true".
2015-09-04 10:20:24 -07:00
Yicheng Qin 8e040efed9 etcdctl: log more about sync process
Users don't even know that etcdctl is doing sync and fails on sync
process. So we add more logs for sync process.
2015-09-02 16:10:25 -07:00
Yicheng Qin 423e3bbbd8 etcdctl/cluster_health: provide better message for empty client urls
It skips sync when init client, and prints out unreachable messagen and
points to notice when checking health of etcd members one by one.
2015-09-01 14:42:19 -07:00
Yicheng Qin c2caa4ae3b etcdctl/command: print more details about ErrNoEndpoint
This commit prints more details if getting ErrNoEndpoint when sync with
cluster. This helps users to know what happens.
2015-08-31 16:28:43 -07:00
Xiang Li 8d8033df55 etcdctl: suggest endpoint over peers flag 2015-08-27 18:52:17 -07:00
Xiang Li 044b23c3ca Merge pull request #3356 from xiang90/travis
*: test gofmt with -s and fix reported issues
2015-08-21 18:59:51 -07:00
Xiang Li 6b23a8131f *: test gofmt with -s and fix reported issues 2015-08-21 18:52:16 -07:00
Yicheng Qin 224755855d etcdctl/cluster_health: set health var when checked healthy
This was a typo.
2015-08-21 15:27:35 -07:00
Xiang Li b0303e948c Merge pull request #3323 from xiang90/cl_health
etcdctl: use health endpoint to greatly simplify health checking
2015-08-19 17:15:52 -07:00
Xiang Li 568d1c6783 etcdctl: use health endpoint to greatly simplify health checking 2015-08-19 11:47:08 -07:00
Yicheng Qin fab3feab66 etcdctl/role: reject non-canonical permission path
Non-canonical permission path is useless because the path received
by auth is always canonical, which is due to our ServeMux always
redirects request to canonical path().

This helps users to detect path permission setting error early.

Ref: http://godoc.org/net/http#ServeMux
2015-08-18 08:59:53 -07:00
Xiang Li 7e04a79fb4 etcdctl: print out better error information 2015-08-12 10:09:56 -07:00
Xiang Li e36c499d0f etcdctl: add per request timeout 2015-08-11 13:33:50 -07:00
Xiang Li 845c51fedd *: fix typos vaild->valid 2015-08-07 10:57:11 -07:00
Xiang Li 9527a97720 etcdctl: ls takes / as default key arg 2015-08-04 22:56:55 -07:00
Xiang Li ff5c3469c1 Merge pull request #3197 from xiang90/health
etcdctl: cluster-health supports forever flag
2015-08-03 20:48:06 -07:00
Xiang Li f7f00b0af6 etcdctl: cluster-health supports forever flag
cluster-health command supports checking the cluster health
forever.
2015-08-01 22:29:08 +08:00
Yicheng Qin 147885078c etcdctl: fix watch -after-index parsing
It uses -after-index incorrectly now:

```
$ ./bin/etcdctl --debug watch -after-index 31 foo
Cluster-Endpoints: http://localhost:2379, http://localhost:4001
cURL Command: curl -X GET
http://localhost:2379/v2/keys/foo?recursive=false&wait=true&waitIndex=33
```

After this PR:

```
$ ./bin/etcdctl --debug watch -after-index 31 foo
Cluster-Endpoints: http://localhost:2379, http://localhost:4001
cURL Command: curl -X GET
http://localhost:2379/v2/keys/foo?recursive=false&wait=true&waitIndex=32
```
2015-07-30 11:15:43 -07:00
Yicheng Qin f1aaa7a9e3 etcdctl: refactor the way to check cluster health
This method uses raft status exposed at /debug/varz to determine the
health of the cluster. It uses whether commit index increases to
determine the cluster health, and uses whether match index increases to
determine the member health.

This could fix the bug #2711 that fails to detect follower is unhealthy
because it doesn't rely on whether message in long-polling connection is sent.

This health check is stricter than the old one, and reflects the
situation that whether followers are healthy in the view of the leader. One
example is that if the follower is receiving the snapshot, it will turns
out to be unhealthy because it doesn't move forward.

`etcdctl cluster-health` will reflect the healthy view in the raft level,
while connectivity checks reflects the healthy view in transport level.
2015-07-29 17:06:55 -07:00
Xiang Li 448ca20cdc etcdctl: fix exec watch command
The previous flag parsing has a small issue. It uses
`recursive == true` and `after-index == 0` to determine
if user specifies the sub flags. This is incorrect since
user can specify `after-index = 0`. Then the flag parsing
would be confused.

This commit explicitly find the `--` in the remaining args
and determine the key and cmdArgs accordingly.
2015-07-23 13:13:15 +08:00
Yicheng Qin 604709cad7 etcdctl: update -peers to default to use schema
Change its default value from `127.0.0.1:4001,127.0.0.1:2379` to
`http://127.0.0.1:4001,http://127.0.0.1:2379`

Adding HTTP schema makes its format consistent with etcd's xxx-urls
flags.
2015-07-21 12:53:21 -07:00
Mohammad Samman 43437e21f9 etcdctl: added domain discovery flag
provided a domain, will look up SRV records for etcd endpoints

Fixes #2636
2015-07-21 12:53:21 -07:00
Xiang Li ee82ee05b4 etcdctl: support member update command 2015-07-21 12:53:20 -07:00
Xiang Li 9f9661f513 etcdctl: print out key and action when watching recursively 2015-07-21 12:53:20 -07:00
Xiang Li 87ef0f0b3e godep: remove go-etcd dependency 2015-07-21 12:53:20 -07:00
Xiang Li 071ad9f72b etcdctl: health use etcd/client 2015-07-21 12:53:20 -07:00
Xiang Li 0b1ddce889 etcdctl: import snap use etcd/client 2015-07-21 12:53:20 -07:00
Xiang Li adeb101e04 etcdctl: remove old stuff 2015-07-21 12:53:20 -07:00
Xiang Li 759c156e3e etcdctl: exec_watch use etcd/client 2015-07-21 12:53:20 -07:00
Xiang Li 5b01b3877f etcdctl: watch use etcd/client 2015-07-21 12:53:20 -07:00
Xiang Li b20c06348d etcdctl: ls use etcd/client 2015-07-21 12:53:19 -07:00
Xiang Li ae1669de26 etcdctl: updatedir use etcd/client 2015-07-21 12:53:19 -07:00
Xiang Li f12ae45c6a etcdctl: update use etcd/client 2015-07-21 12:53:19 -07:00
Xiang Li 58b19a7c1e etcdctl: rmdir use etcd/client 2015-07-21 12:53:19 -07:00
Xiang Li 9d7a8dd2b0 etcdctl: mk use etcd/client 2015-07-21 12:53:19 -07:00
Xiang Li 61befc7ce6 etcdctl: minor cleanup 2015-07-21 12:53:19 -07:00
Xiang Li e3fcc450cf etcdctl: make rm use etcd/client 2015-07-21 12:53:19 -07:00
Xiang Li 9d9c3a7180 etcdctl: make setdir/mkdir use etcd/client 2015-07-21 12:53:19 -07:00
Xiang Li db4b18aee3 etcdctl: make set command use etcd/client 2015-07-21 12:53:19 -07:00
Xiang Li e9478ba630 etcdctl: make get command use etcd/client 2015-07-21 12:53:19 -07:00
Xiang Li 61e9b99edb Merge pull request #2417 from kelseyhightower/improve-etcdctl-ls-command-help
etcdctl: update the ls subcommand help to match behavior
2015-07-09 11:33:19 -06:00
Barak Michener 64ec8af91b *: Rename `security` to `auth` 2015-06-15 18:18:50 -04:00
Xiang Li f59da0e453 *:fix point-in-time backup
Backup process should be able to read all WALs until io.EOF to
generate a point-in-time backup.

Our WAL file is append-only. And the backup process will lock all
files before start reading, which can prevent the gc routine from
removing any files in the middle.
2015-06-15 11:12:28 -07:00
Barak Michener a4d1a5a6e5 *: Add security/auth support to etcdctl and etcd/client
add godep for speakeasy and auth entry parsing
add security_user to client
add role to client
add role commands
add auth support to etcdclient and etcdctl(member/user)
add enable/disable to etcdctl
better error messages, read/write/readwrite
Bump go-etcd to include codec changes, add new dependency
verify the error for revoke/add if nothing changed, remove security-merging prefix
2015-06-10 16:58:10 -04:00
Xiang Li f0edf06b6d etcdctl: minor cleanup 2015-06-02 19:50:37 -07:00
Xiang Li 079e7c10a0 etcdctl: move format to format.go 2015-06-02 19:29:05 -07:00
Xiang Li 26682b663d etcdctl: cleanup etcdctl exit code 2015-06-02 19:01:41 -07:00
Yicheng Qin 3d8fe3b3ca etcdctl/cluster_health: improve output if failed to get leader stats
When failing to get leader stats, it said 'cluster is unhealthy' before.
This is confusing when it cannot get stats because advertised client urls
are set wrong and the cluster is healthy.
2015-05-14 18:52:10 -07:00
Brandon Philips 57270ec0b7 etcdctl: add extended as output format
extended wasn't documented in the help as one of the output formats, fix
this!
2015-04-21 10:22:58 -07:00
Jud White d0f1bf9f8e README.md: change setDir -> setdir 2015-04-18 05:33:32 -05:00
Xiang Li d3778b1286 etcdctl: backup tool should use the new layout 2015-04-14 11:49:54 -07:00
Xiang Li c66777f80f Merge pull request #2640 from xiang90/import
etcdctl: refactor message in import command
2015-04-07 15:09:34 -07:00
Xiang Li 8c0b01d35b etcdctl: refactor message in import command 2015-04-07 15:08:07 -07:00
Xiang Li 74fd2b0536 Merge pull request #2638 from xiang90/import
etcdctl: import hidden keys
2015-04-07 12:53:18 -07:00
Xiang Li 2c647409b9 etcdctl: import hidden keys 2015-04-07 12:41:05 -07:00
Alex Crawford d9ad6aa2a9 *: update to use IANA-assigned ports 2015-04-06 13:49:43 -07:00
Barak Michener ad7a12066f etcdctl: fix import typos 2015-03-31 16:41:35 -04:00
Xiang Li 1024f587e0 etcdctl: main routine of import command should wait for goroutine existing 2015-03-31 11:55:19 -07:00
Xiang Li 8ac565bc38 etcdct: adopt new client port by default
etcdserver uses both 4001 and 2379 for serving client requests by
default. etcdctl supports both ports by default.
2015-03-31 09:56:42 -07:00
Xiang Li 84cf0843bf etcdctl: add migratesnap command 2015-03-27 19:23:38 -07:00
Xiang Li 45032480f1 *: remove upgrading related stuff 2015-03-27 15:28:00 -07:00
Xiang Li b218fc67e4 etcdctl: mark unstarted member 2015-03-03 11:00:40 -08:00
Kelsey Hightower b15806e189 etcdctl: update the ls subcommand help to match behavior
Currently the `etcdctl ls` subcommand help output is a bit misleading.
It mentions that using the `--recursive` flag will output all keys and
values for a given path:

    --recursive  returns all values for key and child keys

This is inaccurate. The `--recursive` will only output the key names
under the given path. Fix the issue by updating the help string for
the `--recursive` flag.

    --recursive  returns all key names recursively for the given path

Fixes #2379.
2015-03-03 06:25:22 -08:00
Brian Waldon 3b41b77cd7 client: ClientConfig -> Config 2015-02-28 10:22:51 -08:00
Brian Waldon 74fe28c5e0 client: exchange ClientConfig for SyncableHTTPClient 2015-02-28 10:22:50 -08:00
Xiang Li 9b6fcfffb6 *: replace our own metrics with codahale/metrics 2015-02-28 10:11:53 -08:00
James Pharaoh 05ecdbc617 etcdtcl: fix etcdctl cluster-health ignores SSL settings
etcdctl reconnects to the leader, but was not picking up ssl settings in this
case, which causes it to show unhealthy when this is not the case.

Fixes #2373
2015-02-25 13:19:07 +01:00
Barak Michener 92dca0af0f *: remove shadowing of variables from etcd and add travis test
We've been bitten by this enough times that I wrote a tool so that
it never happens again.
2015-02-17 16:31:42 -05:00
Xiang Li f97a263a95 etcdctl: add default peerurl for upgrade subcmd 2015-02-10 15:13:12 -08:00
Xiang Li 7bbdad9068 etcdctl: support healthy checking 2015-02-09 14:35:24 -08:00
Yicheng Qin 599e821309 etcdctl/upgrade: use peer flags for peer transport 2015-02-04 21:49:42 -08:00
Barak Michener 37e8d608b3 add documentation link and describe the 404/500 errors better 2015-01-30 19:41:44 -05:00
Barak Michener c66176b538 etcdctl: give more helpful suggestions on removal 2015-01-30 19:23:19 -05:00
Yicheng Qin e966e565c4 etcdctl/backup_command: handle datadir with missed snapshot mark
This helps to recover from the data dir created in v2.0.0-rc1.
2015-01-29 13:32:59 -08:00
Yicheng Qin d0af96d558 etcdctl/backup_command: save snapshot mark in new wal 2015-01-29 12:35:39 -08:00
Brandon Philips 7167cd6ccd Merge pull request #2149 from vdemedes/patch-1
Update README.md
2015-01-27 16:09:20 -08:00
Xiang Li 4c33d12bf8 Merge pull request #2132 from xiang90/ctl
etcdctl: support upgrade
2015-01-27 14:18:16 -08:00
Jonathan Boulle f1ed69e883 *: switch to line comments for copyright
Build tags are not compatible with block comments.
Also adds copyright header to a few places it was missing.
2015-01-26 09:53:30 -08:00
Vadim b2acb12c8e Update README.md
Example output of `$ etcdctl exec-watch` command was wrong and showing non-existing ETCD_VALUE, ETCD_KEY, etc keys. Submitting a PR, which updates those examples with correct keys (ETCD_WATCH_VALUE, ETCD_WATCH_KEY, etc).
2015-01-25 14:10:08 +01:00
Xiang Li c658e9a3e9 etcdctl: support upgrade 2015-01-22 15:51:45 -08:00
Yicheng Qin 37dde76cd5 *: remove consistent-get related stuffs 2015-01-15 22:21:53 -08:00
Yicheng Qin 07a69430c1 *: move etcdserver/idutil -> pkg/idutil 2015-01-13 11:54:51 -08:00
Yicheng Qin 84f62f21ee wal: record and check snapshot 2015-01-06 16:27:40 -08:00
Yicheng Qin 05c921229e etcdserver: add id generator 2014-12-29 13:03:04 -08:00
José Luis Salvador Rufo 910198d117 etcdctl: add environment support to certs args 2014-12-16 16:18:36 +01:00
Xiang Li 53bf7e4b5e wal: rename openAtIndex -> open; OpenAtIndexUntilUsing -> openNotInUse 2014-12-14 19:33:06 -08:00
Xiang Li f538cba272 *: do not backup files still in use 2014-12-14 19:27:22 -08:00
Yicheng Qin 7e6e305c4f Merge branch 'log_interface'
Conflicts:
	raft/raft.go
2014-11-25 14:22:11 -08:00
Owen Smith dbb6a75e3f backup: Ensure dest snapshot dir always exists
Otherwise the SaveSnap operation fails
2014-11-25 16:57:18 +00:00
Owen Smith 9974bf0291 backup: Add fatal if dest snapshot failed
Errors are currently silently swallowed
2014-11-25 14:08:20 +00:00
Ben Darnell 0d680d0e6b Merge remote-tracking branch 'coreos/master' into merge
* coreos/master:
  rafthttp: fix import
  raft: should not decrease match and next when handling out of order msgAppResp
  Fix migration to allow snapshots to have the right IDs
  add snapshotted integration test
  fix test import loop
  fix import loop, add set to types, and fix comments
  etcdserver: autodetect v0.4 WALs and upgrade them to v0.5 automatically
  wal: add a bench for write entry
  rafthttp: add streaming server and client
  dep: use vendored imports in codegangsta/cli
  dep: bump golang.org/x/net/context

Conflicts:
	etcdserver/server.go
	etcdserver/server_test.go
	migrate/snapshot.go
2014-11-21 15:40:11 -05:00
Brian Waldon 9a728a127a dep: bump golang.org/x/net/context
Move from code.google.com/p/go.net/context to
golang.org/x/net/context before bumping to latest.
2014-11-20 10:19:12 -08:00
Ben Darnell 355ee4f393 raft: Integrate snapshots into the raft.Storage interface.
Compaction is now treated as an implementation detail of Storage
implementations; Node.Compact() and related functionality have been
removed. Ready.Snapshot is now used only for incoming snapshots.

A return value has been added to ApplyConfChange to allow applications
to track the node information that must be stored in the snapshot.

raftpb.Snapshot has been split into Snapshot and SnapshotMetadata, to
allow the full snapshot data to be read from disk only when needed.

raft.Storage has new methods Snapshot, ApplySnapshot, HardState, and
SetHardState. The Snapshot and HardState parameters have been removed
from RestartNode() and will now be loaded from Storage instead.
The only remaining difference between StartNode and RestartNode is that
the former bootstraps an initial list of Peers.
2014-11-19 16:40:26 -05:00
Xiang Li 78865aa7f7 Merge pull request #1657 from xiangli-cmu/backup
*: add ctl backup support
2014-11-07 13:30:54 -08:00
Xiang Li 0d541e6338 *: add ctl backup support 2014-11-07 13:27:44 -08:00
Brian Waldon 2d942e970b etcdctl: add --ca-file, --cert-file, --key-file flags 2014-11-06 12:50:38 -08:00
Brian Waldon f4ea274555 etcdctl: centralize getEndpoints logic 2014-11-06 10:54:59 -08:00
Jonathan Boulle f7434b55e5 *: add copyright header to remaining files 2014-11-03 23:29:15 -08:00
Brian Waldon f0760d6246 client: elevate context to caller of MembersAPI 2014-10-31 17:27:42 -07:00
Brian Waldon b47631b38f etcdctl: respect --no-sync in member subcommands 2014-10-31 17:25:05 -07:00
Brian Waldon 22b86684f0 etcdctl: sync before running member subcommands 2014-10-31 17:25:05 -07:00
Brian Waldon f6e8b677cf client: pass httpActionDo into NewMembersAPI 2014-10-31 17:25:05 -07:00
Brian Waldon f35130a0ed etcdctl: clean up formatting of member add 2014-10-31 15:37:08 -07:00
Brandon Philips 6b4485d1ae etcdctl: take a name and print out the initial cluster
To help the user lets print out the configuration that they will need to give
to their new member:

$ etcdctl member add infra4 http://localhost:7004
added member 9bf1b35fc7761a23 to cluster
ETCD_NAME="infra4"
ETCD_INITIAL_CLUSTER="node2=http://localhost:7002,node3=http://localhost:7003,infra4=http://localhost:7004,node1=http://localhost:7001"

This is a little weird because the API doesn't take a name so the user gives us
a name and we just pass it on through.
2014-10-31 15:05:23 -07:00
Brandon Philips 8f3be206ed etcdctl: add help on the members subcommands 2014-10-31 14:50:23 -07:00
Brian Waldon f0c3385cfc etcdctl: wire up --peers for member commands 2014-10-31 12:21:15 -07:00
Brian Waldon 8b8b3efdaa client: accept slice of endpoints 2014-10-31 12:21:15 -07:00
Brian Waldon dee912f2fd etcdctl: break out mustNewMembersAPI 2014-10-31 12:21:08 -07:00
Brian Waldon bc62b05c7f etcdctl: break out getPeersFlagValue 2014-10-31 12:21:00 -07:00
Brian Waldon 64a12e9341 Merge pull request #1511 from coreos/set-watch-consistency-to-strong
etcdctl: Set watch consistency to STRONG
2014-10-30 16:52:50 -07:00
Brian Waldon d36a3e18d2 etcdctl: remove SetConsistency call
This call to SetConsistency is explicitly setting the default
value, so it's really unnecessary.
2014-10-30 13:45:59 -07:00
Brian Waldon 6087e2b2f6 Merge pull request #1509 from bcwaldon/etcdctl-102
etcdctl: add --sort flag to ls command
2014-10-30 13:33:37 -07:00
micahhausler 2be3f870cc etcdctl: Set watch consistency to STRONG 2014-10-29 18:11:05 -07:00
Pierre Phaneuf 97597eca03 etcdctl: add --sort flag to ls command
This is a port of coreos/etcdctl#102
2014-10-29 17:45:11 -07:00
Brian Waldon 243886edc8 etcdctl: add -p to ls command
This is a port of coreos/etcdctl#96
2014-10-29 17:42:21 -07:00
Brian Waldon f6e242aa01 etcdctl: impl members commands 2014-10-29 15:09:23 -07:00
Brian Waldon 1539d5c49c etcdctl: update to meet go vet 2014-10-22 17:52:40 -07:00
Brian Waldon 69842b344d etcdctl: reflect build script location in README.md 2014-10-22 17:52:40 -07:00
Brian Waldon 52e08720b7 etcdctl: remove build indicator from README.md 2014-10-22 17:52:40 -07:00
Brian Waldon 29ef918808 etcdctl: import from external repo 2014-10-22 17:52:40 -07:00