Commit Graph

410 Commits (819f5cf32fd6918a2a1b06d6bce58ce7aeb91c48)

Author SHA1 Message Date
fanmin shi 80ab321f9d etcdmain: whitelist etcd binary flags 2017-02-15 09:51:50 -08:00
Manjunath A Kumatagi 9767098331 etcdmain: ppc64le platform support 2017-01-26 21:08:07 -08:00
Anthony Romano dfb2ed07db etcdmain: add gateway and grpc-proxy commands to etcd help 2017-01-20 15:54:13 -08:00
Xiang Li a630735c29 Merge pull request #7170 from vimalk78/make-v2-endpoint-optional-#7100
embed/etcd.go: make v2 endpoint optional. fixes #7100
2017-01-20 11:14:20 -08:00
Vimal Kumar f80914fba2 embed/etcd.go: make v2 endpoint optional. fixes #7100 2017-01-20 11:49:52 +05:30
Anthony Romano 8c0282ab24 grpcproxy, etcdmain, integration: add close channel to kv proxy
ccache launches goroutines that need to be explicitly stopped.

Fixes #7158
2017-01-18 11:51:16 -08:00
Xiang Li c5a9d54835 etcdserver: increase snapshot to 100,000
Keep more wal entries in memory for fast follower recovery.
10,000 was a too small number that triggers quite a few snapshots.
ZK proves that 100,000 is a reasonable number for even old less prowerful
machines.

Eventually we should provide both count and max memory (for large entries).
2017-01-13 18:05:25 -08:00
Anthony Romano 9b5eb1ae5a grpcproxy, etcdmain, integration: return done channel with WatchServer
Makes it possible to synchronously close the watch server.

Fixes #7078
2016-12-30 12:09:48 -08:00
Xiang Li e63059ec31 Merge pull request #7030 from crandles/grpc-histograms
etcdmain: add '--metrics' option
2016-12-28 12:03:53 -08:00
crandl201 36b2d3f5eb etcdmain: add --metrics flag for exposing histogram metrics
this adds a new flag, --metrics, that can be used to enable extensive (histogram) metrics.

Fixes #7024
2016-12-28 13:04:52 -05:00
Gyu-Ho Lee e58287f026 embed: only override default advertised client URL if the client listen URL is 0.0.0.0 2016-12-16 18:31:04 -08:00
Dongsu Park 5e351956b9 vendor: bump go-systemd to v14 to avoid build error
Bump go-systemd to v14 (48702e0d, 2016-11-14).
Also adjust caller of daemon.SdNotify() to avoid build error, which can
be seen especially when running "go get github.com/coreos/etcd".
2016-12-01 13:26:46 +01:00
Gyu-Ho Lee ff96769b55
etcdmain: handle TLS in grpc-proxy listener 2016-11-21 10:39:34 -08:00
Gyu-Ho Lee a39509ee5b etcdmain: add '/metrics' HTTP/1 path to grpc-proxy 2016-11-18 19:40:06 -08:00
Gyu-Ho Lee 6ffd7e3ed1 etcdmain: configurable 'etcd' binary log-output
Fix https://github.com/coreos/etcd/issues/5449.
2016-11-03 14:18:12 -07:00
Xiang Li 9e9bbb829e Merge pull request #6289 from purpleidea/feat/move-readynotify
embed: Move the ReadyNotify() call to a more sane place
2016-08-29 20:06:17 -07:00
James Shubin 9aee3f01cd embed: Move the ReadyNotify() call to a better place
When using the embed functionality, you can't call the Server.Stop()
function until StartEtcd returns, which can block until there is a call
to Server.Stop() in error situations. Since we have a catch-22, the
ReadyNotify() can be called manually by the user if they wish to wait
for the server startup, or in parallel with a timeout if they wish to
cancel it after some time.

Chzz pointed out that this is also more consistent with the
etcdserver.Start() behaviour too.

purpleidea pointed out that this is actually more correct too, because
we can now register the stop interrupt handler before we block on
startup.
2016-08-29 22:45:41 -04:00
Anthony Romano 2cc245e8bf etcdmain: report default advertise detection / fallback 2016-08-15 14:08:09 -07:00
sharat 2b5a5c77cf etcdserver: Error handling for invalid empty raft cluster
TODO implemented for GetClusterFromRemotePeers should not return nil
error with an invalid empty cluster

#6137
2016-08-10 19:23:19 +05:30
Anthony Romano ab4ac828f3 etcdmain: check TLS on gateway SRV records 2016-08-03 22:28:03 -07:00
Anthony Romano d6b22323a8 etcdmain: disable grpc tracing by default 2016-07-25 14:23:36 -07:00
Dongsu Park 624187d25f etcdmain: correctly check return values from SdNotify()
SdNotify() now returns 2 values, sent and err. So startEtcdOrProxyV2()
needs to check the 2 return values correctly. As the 2 values are
independent of each other, error checking needs to be slightly updated
too.

SdNotifyNoSocket, which was previously provided by go-systemd, does not
exist any more. In that case (false, nil) will be returned instead.
2016-07-21 09:19:07 +02:00
Xiang Li c7c5cd324b etcdmian: gateway supports dns srv discovery 2016-07-18 21:53:24 -07:00
Xiang Li e1892e264d grpcproxy: add auth 2016-07-18 14:26:22 -07:00
Xiang Li fd24340903 grpcproxy: add maintenance proxy 2016-07-18 13:31:03 -07:00
Xiang Li 3f74e9db0d *: add lease proxy 2016-07-18 12:06:59 -07:00
Xiang Li bdfbd26e94 *: add cluster proxy 2016-07-16 12:15:32 -07:00
Xiang Li 5f3aa43899 grpcproxy: initial watch proxy 2016-07-15 14:30:45 -07:00
Xiang Li 3d109be3b4 Merge pull request #3621 from yichengq/usage-stderr
etcdmain: print usage in stderr when flag.Parse fail
2016-07-13 16:56:26 -07:00
Anthony Romano f4f33ea767 etcdmain, embed: export Config and StartEtcd into embed/
Lets programs embed etcd.

Fixes #5430
2016-07-13 10:40:03 -07:00
smallfish e6d15b966c etcdserver/api/v2http, Documentation: fix debug pprof index miss / in end 2016-07-08 10:21:05 +08:00
davygeek 8c96d2573f *: fixed some warning 2016-06-30 23:13:46 +08:00
Xiang Li 6d8c647db8 *: initial implementation of grpc-proxy 2016-06-29 12:06:04 -07:00
Xiang Li 9b4dc92fdc Merge pull request #5761 from xiang90/proxy_v2
*: make it clear that proxy only supports v2 api now
2016-06-23 12:35:04 -07:00
Xiang Li 755d192ff7 *: make it clear that proxy only supports v2 api now 2016-06-23 12:06:42 -07:00
Gyu-Ho Lee 6557ef7cd8 *: copy all exported members in tls.Config
Without this, go vet complains

assignment copies lock value to n: crypto/tls.Config contains sync.Once
contains sync.Mutex
2016-06-22 12:04:08 -07:00
Xiang Li 8ea6be38ba *: remove old flag support
These legacy flags support are here only because we do not want
CoreOS updates to break people.

Now people will be aware of that they switch to etcd3. Do not need
to support 0.x flags any more.
2016-06-17 14:51:45 -07:00
Xiang Li d68664841c *: make auto-compaction-retention non-experimental 2016-06-17 10:04:31 -07:00
Xiang Li 5a7b7f7595 main: add grpc-gateway support
Now etcd can serve HTTP json request at /v3alpha/
2016-06-14 17:09:06 -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
Gyu-Ho Lee ef44f71da9 *: update LICENSE header 2016-05-12 20:51:48 -07:00
Gyu-Ho Lee 9a6daefb3e etcdmain: add retry-delay flag 2016-05-12 17:03:00 -07:00
Anthony Romano dcb3b7aecf *: scrub legacy ports from code and scripts 2016-05-11 13:46:30 -07:00
Xiang Li aaefd52afa Merge pull request #5092 from xiang90/etcdlet
*: gateway initial commit
2016-05-11 10:36:02 -07:00
Xiang Li a300be92dc *: initial support for gatway
etcd gatway is a simple l4 gateway that forwards tcp connections to
the given endpoints.
2016-05-11 09:44:50 -07:00
Anthony Romano 8c4958dd60 etcdmain: notify systemd when etcd is ready to accept requests
Fixes #5151
2016-05-10 13:36:46 -07:00
Xiang Li 00398ec98d *: move sample config file to root directory 2016-05-09 21:36:09 -07:00
Ajit Yagaty 8bc5ab9f8d etcd: Configuration file for etcd server.
Added a new command line option to etcd server to read in a YAML
based configuration file. I've also added an example configuration
file with comments and a set of test cases.
2016-05-09 18:17:27 -07:00
Gyu-Ho Lee 56dd991b4e etcdmain: add auto-tls flag to help.go 2016-05-03 12:40:02 -07:00
Xiang Li 973ad5aa7c *: support auto tls on client side 2016-05-02 16:17:49 -07:00
Xiang Li 434f2c356d etcdserver: do not serve requests before finish the first internal proposal 2016-04-27 15:46:31 -07:00
Gyu-Ho Lee 3ad8e91e00 *: fix flag location, minor typo 2016-04-25 09:41:11 -07:00
Gyu-Ho Lee fa61bf86d7 etcdmain: add quota-backend-bytes to help.go 2016-04-21 13:05:54 -07:00
Xiang Li 66d2ae7a39 proxy: move http related thing to httpproxy 2016-04-13 21:09:26 -07:00
Gyu-Ho Lee 9108af9046 *: clean up from go vet, misspell 2016-04-10 23:16:56 -07:00
Anthony Romano c4caa65c51 etcdmain: start on unsupported arch when ETCD_UNSUPPORTED_ARCH is set 2016-04-10 19:36:04 -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 2c50eb240e *: mv etcdhttp into api pkg 2016-04-04 16:31:35 -07:00
Anthony Romano 9b2c963179 etcdserver: configurable backend size quota
Configurable with the flag --experimental-quota-backend-bytes and
through ServerConfig.QuotaBackendBytes.

Fixes #4894
2016-03-29 18:39:25 -07:00
Gyu-Ho Lee 92f4aced25 etcdmain: add peer-auto-tls doc 2016-03-29 09:40:57 -07:00
Xiang Li a120ca16c0 etcdctlv3: accept evn for global configuration flags 2016-03-25 14:23:32 -07:00
Xiang Li 6285455f85 etcdmain: warn on contradictory TLS settings 2016-03-24 10:21:47 -07:00
Xiang Li 5ee3729738 etcdmain: etcd should fail to start when https is enabled but tls config is not given 2016-03-24 09:57:25 -07:00
Xiang Li 70a9391378 *: enable v3 by default 2016-03-23 17:01:36 -07:00
Xiang Li 900a61b023 *: http and https on the same port 2016-03-23 10:28:38 -07:00
Anthony Romano bd832e5b0a *: migrate Godeps to vendor/ 2016-03-22 17:10:28 -07:00
Gyu-Ho Lee 2364d71ea2 etcdmain: fix shadowed variables 2016-03-21 21:55:06 -07:00
Gyu-Ho Lee cdb7cfd74b etcdmain: fix blocking m.Server closure 2016-03-21 16:39:20 -07:00
Xiang Li 7c3432a79f Godep: add cmux dependency 2016-03-21 14:33:37 -07:00
Xiang Li d3809abe42 *: gRPC + HTTP on the same port
We use cmux to do this since we want to do http+https on the same
port in the near future too.
2016-03-21 14:29:25 -07:00
Anthony Romano 3fed78ae7b Merge pull request #4484 from heyitsanthony/auto-tls
automatic peer TLS
2016-03-21 12:59:29 -07:00
Anthony Romano e9b2bd751d etcdmain: add --peer-auto-tls option
Lets the peer generate its own (unsigned) certs.
2016-03-21 11:38:23 -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
Anthony Romano 5f304b4dee *: build phony etcd server binary for unsupported architectures
We don't qualify etcdserver for anything other than amd64, so don't
build binaries that are untested and might be unreliable.
2016-03-08 13:12:11 -08:00
Xiang Li d265fe000c *: support time based auto compaction.
Fix https://github.com/coreos/etcd/issues/3906.

We will have extensive doc to talk about what is compaction
and what is auto compaction soon.
2016-02-25 16:02:03 -08:00
Anthony Romano c5b51946eb *: exported godoc fixups 2016-02-21 20:36:44 -08:00
Anthony Romano 20461ab11a *: fix many typos 2016-01-31 21:42:39 -08:00
Anthony Romano 4634874d99 etcdmain, integration, v3rpc: consolidate grpc server setup 2016-01-29 16:38:11 -08:00
Anthony Romano 563850bcc1 etcdmain: support v3 tls 2016-01-29 16:38:11 -08:00
Xiang Li 36cc8446c7 *: finish member api implementation 2016-01-26 18:09:14 -08:00
Anthony Romano 2e157530a0 etcdhttp, lease, v3api: forward keepalives to leader
keepalives don't go through raft so let follower peers announce
keepalives to the leader through the peer http handler
2016-01-22 12:40:40 -08:00
Xiang Li f3daa9f677 etcdmain: proxy should only lookup srv if there is no existing cluster file 2016-01-14 11:23:36 -08:00
Hitoshi Mitake 588f655b4e etcdmain: add an option for pprof
This commit adds a new option for activating profiling based on pprof
in etcd process.
 - -enable-pprof: boolean type option which activates profiling

For example, if a client URL is http://localhost:12379, users and
developers access heap profiler with this URL:
http://localhost:12379/debug/pprof/heap
2016-01-13 16:12:26 +09:00
Anthony Romano 811fbc5672 etcdmain: support keep alive listeners on limit listener connections
Fixes #4171
2016-01-08 10:11:31 -08:00
Xiang Li 99bee2fd29 Merge pull request #4162 from xiang90/lease
*: add support for lease create and revoke
2016-01-07 16:58:59 -08:00
Xiang Li d9ca929a33 *: add support for lease create and revoke
Basic support for lease operations like create and revoke.
We still need to:
1. attach keys to leases in KV implmentation if lease field is set
2. leader periodically removes expired leases
3. leader serves keepAlive requests and follower forwards keepAlive
requests to leader.
2016-01-07 16:39:39 -08:00
Xiang Li 1f97f2dc36 etcdmain: tls listener MUST be at the outer layer of all listeners
go HTTP library uses type assertion to determine if a connection
is a TLS connection. If we wrapper TLS Listener with any customized
Listener that can create customized Conn, HTTPs will be broken.

This commit fixes the issue.
2016-01-07 10:26:49 -08:00
Gyu-Ho Lee 366e7a879f *: fill in WatchResponse.Header
Related to coreos#3848.
2016-01-06 15:12:53 -08:00
Xiang Li 4bcd7587e2 etcdmain: fix incomplete proxy config file
etcd might generate incomplete proxy config file after a power failure.
It is because we use ioutil.WriteFile. And iotuile.WriteFile does
not call Sync before closing the file.
2015-12-21 16:15:00 -08:00
Gyu-Ho Lee c48b0a5e18 etcdmain: fix shadowed variables
Fix for https://github.com/coreos/etcd/issues/3954.
2015-12-12 09:38:26 -08:00
Yiqiao Pu ddc4f8bd45 etcdmain: Add max-snapshots and max-wals to help
Based on the configuration doc, seems these two flags are missing
in the help. So add them and the descriptions are from config.go in
the same directory.

Signed-off-by: Yiqiao Pu <ypu@redhat.com>
2015-11-19 11:58:00 +08:00
Xiang Li 9e4a003fb0 etcdmain: fix unstoppable startEtcd function
We should wrap the blocking function with a closure. And first
creates a go routine to execute the function. Or the inner function
blocks before creating the go routine.
2015-11-17 09:04:00 -08:00
Gyu-Ho Lee 12b4a122ce etcdmain: minor typo, make descriptions consistent
This fixes some typos and make help.go and config.go flag descriptions
consistent with each other.
2015-11-10 13:00:08 -08:00
Gyu-Ho Lee 5eb57c2aee etcdmain: more description for init cluster token
This adds more description to initial-cluster-token from
https://github.com/coreos/etcd/issues/3690 to help.go.
2015-11-10 09:40:08 -08:00
Xiang Li 08f0d94019 Merge pull request #3809 from xiang90/rpc_kv
*: refactor kv rpc implementation
2015-11-04 19:05:48 -08:00
Yicheng Qin 3d15526c35 Merge pull request #3796 from yichengq/fix-get-version
etcdserver: not reuse connections for peer transport
2015-11-04 11:39:14 -08:00
Xiang Li c37bd2385a *: refactor kv rpc implementation 2015-11-04 11:36:17 -08:00
Yicheng Qin 4ccbcb91c8 rafthttp: add functions to create listener and roundTripper
This moves the code to create listener and roundTripper for raft communication
to the same place, and use explicit functions to build them. This prevents
possible development errors in the future.
2015-11-04 11:12:46 -08:00
Xiang Li 1a3f7f7fa4 *: rename etcd service to kv service in gRPC 2015-11-04 10:05:49 -08:00
Xiang Li 10de2e6dbe *: serve watch service
Implement watch service and hook it up
with grpc server in etcdmain.
2015-11-03 15:58:34 -08:00
Xiang Li fe165de1d1 Merge pull request #3794 from yichengq/fix-proxy-term
etcdmain: fix parsing discovery error
2015-11-02 17:33:47 -08:00
Yicheng Qin 9757dcd3a2 etcdmain: fix parsing discovery error
The discovery error is wrapped into a struct now, and cannot be compared
to predefined errors. Correct the comparison behavior to fix the
problem.
2015-11-02 17:23:06 -08:00
Gyu-Ho Lee 821c071f3f etcdmain: fix package description for godoc.org
This fixes package description for etcdmain that wasn't compatible with
godoc.org, by deleting the extra blank lines between comment and package name.
2015-10-29 12:28:52 -07:00
Xiang Li ab4892ade2 Merge pull request #3749 from gyuho/etcdmain_flags_20151025
etcdmain: make flags and formats idential
2015-10-26 20:54:37 -07:00
Gyu-Ho Lee 52782cf8ee etcdmain: make flags and formats idential
This makes flagsline and config.go identical in its flag description and some
punctuation conventions.
2015-10-25 06:31:37 -07:00
Yicheng Qin 207c92b627 rafthttp: build transport inside pkg instead of passed-in
rafthttp has different requirements for connections created by the
transport for different usage, and this is hard to achieve when giving
one http.RoundTripper. Pass into pkg the data needed to build transport
now, and let rafthttp build its own transports.
2015-10-11 21:42:37 -07:00
Xiang Li 51043830d4 etcdmain: print out error and suggestion for fixing notify issue 2015-10-02 13:39:41 -07:00
Yicheng Qin 7ba352d9ca etcdmain: print usage in stderr when flag.Parse fail
This fits the requirement of stderr.

I still let `etcd --version` and `etcd --help` print out to stdout
because when users ask explicitly for version/help docs, they expect to see
the doc in stdout.

Ref:
http://www.jstorimer.com/blogs/workingwithcode/7766119-when-to-use-stderr-instead-of-stdout
2015-09-30 14:19:39 -07:00
Yicheng Qin 49d262185d Merge pull request #3590 from yichengq/discovery-log
etcdmain: improve log when join discovery fails
2015-09-29 08:02:18 -07:00
Yicheng Qin 939aa96a34 etcdmain: improve log when join discovery fails
Before this PR, the log is

```
2015/09/1 13:18:31 etcdmain: client: etcd cluster is unavailable or
misconfigured
```

It is quite hard for people to understand what happens.

Now we print out the exact reason for the failure, and explains the way
to handle it.
2015-09-28 23:23:50 -07:00
Yicheng Qin dc9a75df1c etcdmain: exit after print out ErrDuplicateID
etcd should exit after printing log for unhandlable error.
2015-09-25 14:10:50 -07:00
Xiang Li 9de7f24301 Merge pull request #3554 from mitake/reconfig-doc
doc: add a description of -strict-reconfig-check
2015-09-24 08:07:32 -07:00
Hitoshi Mitake 78791f81a6 doc: add a description of -strict-reconfig-check 2015-09-24 11:44:55 +09:00
Xiang Li 3b70bf87c3 etcdmain: better logging when user forget to set initial flags 2015-09-21 10:43:26 -07:00
Xiang Li 662b4966d0 Merge pull request #3510 from xiang90/v3_raft
etcdmain: support gRPC addr flag
2015-09-12 22:58:08 -07:00
Xiang Li a0cfcf2dd7 etcdmain: support gRPC addr flag 2015-09-12 22:52:51 -07:00
Hitoshi Mitake 6974fc63ed etcdserver: avoid deadlock caused by adding members with wrong peer URLs
Current membership changing functionality of etcd seems to have a
problem which can cause deadlock.

How to produce:
 1. construct N node cluster
 2. add N new nodes with etcdctl member add, without starting the new members

What happens:
After finishing add N nodes, a total number of the cluster becomes 2 *
N and a quorum number of the cluster becomes N + 1. It means
membership change requires at least N + 1 nodes because Raft treats
membership information in its log like other ordinal log append
requests.

Assume the peer URLs of the added nodes are wrong because of miss
operation or bugs in wrapping program which launch etcd. In such a
case, both of adding and removing members are impossible because the
quorum isn't preserved. Of course ordinal requests cannot be
served. The cluster would seem to be deadlock.

Of course, the best practice of adding new nodes is adding one node
and let the node start one by one. However, the effect of this problem
is so serious. I think preventing the problem forcibly would be
valuable.

Solution:
This patch lets etcd forbid adding a new node if the operation changes
quorum and the number of changed quorum is larger than a number of
running nodes. If etcd is launched with a newly added option
-strict-reconfig-check, the checking logic is activated. If the option
isn't passed, default behavior of reconfig is kept.

Fixes https://github.com/coreos/etcd/issues/3477
2015-09-13 09:31:53 +09: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
Raoof Mohammed 2de1c36061 etcdmain: Proxy doesnt specify - listening on http or https
etcdmain: Proxy doesnt specify - listening on http or https

Fixes #3464
2015-09-08 17:19:23 -04:00
Xiang Li 7957677cf2 etcdmain: proxy does not need to belong to the discovered cluster 2015-09-01 11:24:02 -07:00
Xiang Li d94e712d91 *: support wal dir 2015-09-01 09:54:27 -07:00
Yicheng Qin 58455a2ae4 etcdmain: check error before assigning peer transport
Or it may panic when new transport fails, e.g., TLS info is invalid.
2015-08-25 22:04:26 -07:00
Yicheng Qin 2ac9a329ab etcdmain: stop setting GOMAXPROCS explicitly
We always want to use GOMAXPROCS() as the way go parses it. When in go1.4, we
want to expose GOMAXPROCS value, so we set GOMAXPROCS explicitly as the
way go 1.4 does and print it out.

But it becomes a problem when go 1.5 changes the way to set GOMAXPROCS.

Fix the problem by stop setting GOMAXPROCS and get its value directly.

Due to this change, it sets default GOMAXPROCS to the
number of CPUs available when compiling in go 1.5, which matches how go 1.5 works:
https://docs.google.com/document/d/1At2Ls5_fhJQ59kDK2DFVhFu3g5mATSXqqV5QrxinasI/edit

This is a behavior change in etcd 2.2.
2015-08-25 13:38:16 -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
Xiang Li 92634356c1 *: use limitedListener from golang 2015-08-20 20:02:35 -07:00
Xiang Li 6b77c146ec etcdmain: print out version information on startup 2015-08-20 14:50:16 -07:00
Yicheng Qin 927d5f3d26 Merge pull request #3301 from yichengq/ca-file
etcdmain: update -ca-file description
2015-08-17 23:36:33 -07:00
Yicheng Qin c0747a7b8b etcdmain: update -ca-file description
so people could deprecate old flags and use new flags much easier.
2015-08-17 22:36:04 -07:00
Yicheng Qin ffae601af5 etcdmain: calculate dial timeout for peer transport
This helps peer communication in globally-deployed cluster.
2015-08-17 16:52:53 -07:00
Yicheng Qin c3d4d11402 etcdhttp: adjust request timeout based on config
It uses heartbeat interval and election timeout to estimate the
expected request timeout.

This PR helps etcd survive under high roundtrip-time environment,
e.g., globally-deployed cluster.
2015-08-12 09:22:59 -07:00
Xiang Li a718329ad3 Merge pull request #3248 from xiang90/v3
initial v3 demo
2015-08-10 13:59:03 -07:00
Xiang Li 6c58333969 etcdmain: use default formatter
The default formatter would use syslog style when running
under init system, and would use pretty format otherwise.
2015-08-10 13:38:22 -07:00
Xiang Li c1e0b19f9f *: better flag 2015-08-10 09:53:17 -07:00
Xiang Li f004b4dac7 *: etcdserver supports v3 demo 2015-08-08 05:58:29 -07:00
Xiang Li 1b572ae2dd etcdmain: fix path printing 2015-08-06 15:53:24 -07:00
Xiang Li 7314310aed Merge pull request #3233 from xiang90/srv_discovery
better dns discovery error and doc
2015-08-06 14:35:22 -07:00
Yicheng Qin 2c2249dadc Merge pull request #3219 from yichengq/limit-listener
etcdmain: stop accepting client conns when it reachs limit
2015-08-06 12:17:49 -07:00
Yicheng Qin 97923ca3fc etcdmain: close client conns when it exceeds limit
This solves the problem that etcd may fatal because its critical path
cannot get file descriptor resource when the number of clients is too
big. The PR lets the client listener close client connections
immediately after they are accepted when
the file descriptor usage in the process reaches some pre-set limit, so
it ensures that the internal critical path could always get file
descriptor when it needs.

When there are tons to clients connecting to the server, the original
behavior is like this:

```
2015/08/4 16:42:08 etcdserver: cannot monitor file descriptor usage
(open /proc/self/fd: too many open files)
2015/08/4 16:42:33 etcdserver: failed to purge snap file open
default2.etcd/member/snap: too many open files
[halted]
```

Current behavior is like this:

```
2015/08/6 19:05:25 transport: accept error: closing connection,
exceed file descriptor usage limitation (fd limit=874)
2015/08/6 19:05:25 transport: accept error: closing connection,
exceed file descriptor usage limitation (fd limit=874)
2015/08/6 19:05:26 transport: accept error: closing connection,
exceed file descriptor usage limitation (fd limit=874)
2015/08/6 19:05:27 transport: accept error: closing connection,
exceed file descriptor usage limitation (fd limit=874)
2015/08/6 19:05:28 transport: accept error: closing connection,
exceed file descriptor usage limitation (fd limit=874)
2015/08/6 19:05:28 etcdserver: 80% of the file descriptor limit is
used [used = 873, limit = 1024]
```

It is available at linux system today because pkg/runtime only has linux
support.
2015-08-06 12:03:20 -07:00
Xiang Li 203e0f178b etcdmian: better error for srv discovery failure 2015-08-06 11:38:53 -07:00
Xiang Li 0cbac56fa2 etcdmain: support sdnotify for readiness 2015-07-31 13:33:18 +08:00
Yicheng Qin 6b8b507312 Merge pull request #3176 from yichengq/reject-high-election
etcdmain: reject unreasonably high values of -election-timeout
2015-07-28 10:33:58 -07:00
Yicheng Qin ec214030d0 etcdmain: reject unreasonably high values of -election-timeout
This helps users to detect setting problem early.
2015-07-28 10:07:57 -07:00
Yicheng Qin 5e3dc31e6f Merge pull request #3150 from gouyang/master
pkg/mflag: add modified flag package
2015-07-24 15:26:07 -07:00
Guohua Ouyang c9769ee966 etcdmain: Don't print flags when flag parse error
At present it prints the whole usage and flags, which cause the exact
error message is hidden two screens above.

Fixes #3141

Signed-off-by: Guohua Ouyang <gouyang@redhat.com>
2015-07-24 21:29:21 +08:00
Xiang Li 6be02ff5ec etcdmian: fix initialization confilct
Fix #3142

Ignore flags if etcd is already initialized.
2015-07-21 12:53:21 -07:00
Yicheng Qin 24db661401 etcdmain: warn when listening on HTTP if TLS is set
If the user sets TLS info, this implies that he wants to listen on TLS.
If etcd finds that urls to listen is still HTTP schema, it prints out
warning to notify user about possible wrong setting.
2015-07-21 12:53:21 -07:00
Xiang Li dc3f7f5d90 *: detect duplicate name for discovery bootstrap 2015-07-21 12:53:20 -07:00
Shun Yanaura d7276d6ace etcdmain: emend configuration error message
etcd shows an odd message on configuration error like this (partially):
```
... discovery or bootstrap flags are setChoose one of ...
                                      ^^^^^^^^^
```
This commit fixes the message format problem.
2015-07-14 14:42:49 +09:00
Xiang Li dedabddcb3 etcdmain: proxy ignores discovery if it is initialized 2015-07-10 12:52:24 -07:00
Michal Witkowski 7bca757d09 *: add metrics to `store` and `proxy`. 2015-07-07 16:01:51 +01:00
Xiang Li cbe00e4415 Merge pull request #2967 from webner/feature/proxy-config
proxy: added endpoint refresh and timeout configuration values
2015-07-03 11:51:15 -07:00
Yicheng Qin 36c5fd6265 etcdmain: fix the check in fallback-to-proxy case
advertise-client-urls has to be set if listen-client-urls is set when
fallbacking to proxy, which breaks the behavior. Loosen the check to fix
it.
2015-06-23 13:08:56 -07:00
Wolfgang Ebner 1264dbe24d proxy: added endpoint refresh and timeout configuration values
the default dial timeout was set to 30 seconds this made the proxy a pain to use
in failure scenarios.

fixes 2862
2015-06-13 09:42:18 +02:00
Xiang Li 6c8b32d316 etcdmain: exit if discovery fails
Fix #2919

If discovery fails, etcd will hang there and does nothing. This
commit fixes the problem.
2015-06-11 15:45:00 -07:00
Xiang Li 3e706c745c Merge pull request #2953 from yichengq/etcdmain-plog
etcdmain: var log -> plog
2015-06-11 15:30:18 -07:00
Yicheng Qin 1764837783 etcdmain: clean up plog.Printf
Put it into different log levels.
2015-06-11 10:24:02 -07:00
Yicheng Qin cf7c83b304 etcdmain: fix that advertise-client-urls is required in proxy mode
etcd proxy doesn't need to set advertise-client-urls because the flag is
not used.
2015-06-10 16:22:32 -07:00
Yicheng Qin 5a9c2851a7 etcdmain: var log -> plog
So the variable name doesn't mess up with standard package name.
2015-06-10 16:19:06 -07:00
Yicheng Qin 0589afe605 etcdmain: increase maxIdleConnsPerHost in proxy transport
This PR set maxIdleConnsPerHost to 128 to let proxy handle 128 concurrent
requests in long term smoothly.
If the number of concurrent requests is bigger than this value,
proxy needs to create one new connection when handling each request in
the delta, which is bad because the creation consumes resource and may
eat up your ephemeral port.
2015-06-01 16:19:36 -07:00
Alex Altair 6f8c36c2ab etcdmain: use double-dash in message flag 2015-05-28 13:09:44 -07:00
Xiang Li 7875de7d2f etcdmian: remove main prefix in logging
We are using new log pkg, which adds the prefix for us.
2015-05-27 10:01:22 -07:00
Prashanth Balasubramanian 1e15b05e4c etcdmain: explicitly set gomaxprocs and log its value 2015-05-27 09:53:05 -07:00
Yicheng Qin a6a649f1c3 etcdserver: stop exposing Cluster struct
After this PR, only cluster's interface Cluster is exposed, which makes
code much cleaner. And it avoids external packages to rely on cluster
struct in the future.
2015-05-13 10:01:25 -07:00
Yicheng Qin 032db5e396 *: extract types.Cluster from etcdserver.Cluster
The PR extracts types.Cluster from etcdserver.Cluster. types.Cluster
is used for flag parsing and etcdserver config.

There is no need to expose etcdserver.Cluster public, which contains
lots of etcdserver internal details and methods. This is the first step
for it.
2015-05-12 14:53:11 -07:00
Xiang Li 91cbf47a2a etcdmain: better error msg when detected duplicate id in discovery 2015-05-11 17:34:44 -07:00
Mohammad Samman 3914defd8a version: added more version information
added more version information output to aid debugging
print etcd Version, Git SHA, Go runtime version, OS
and architecture

Fixes #2560
2015-05-09 03:21:10 +00:00
Yicheng Qin 3f90394fbb etcdmain: advertise-client-urls must be set if listen-client-urls is set
Before this PR, people can set listen-client-urls without setting
advertise-client-urls, and leaves advertise-client-urls as default
localhost value. The client libraries which sync the cluster info
fetch wrong advertise-client-urls and cannot connect to the cluster.
This PR avoids this case and provides better UX.

On the other hand, this change is safe because people always want to set
advertise-client-urls if listen-client-urls is set. The default localhost
advertise url cannot be accessed from the outside, and should always be
set except that etcd is bootstrapped with no flag.
2015-04-29 09:52:15 -07:00
Barak Michener ad8e3ea5dc etcdmain: fix logging flag documentation 2015-04-28 16:31:19 -04:00
Barak Michener b369cf037a etcdmain: New Logging Package
use capnslog

Vendor capnslog and set the flags in etcd main

remove package prefix from etcdmain
2015-04-28 15:42:32 -04:00
Yicheng Qin 1811701427 Revert "etcdserver: fix cluster fallback recovery"
This reverts commit cff005777a.

Conflicts:
	etcdserver/server.go
2015-04-19 11:34:33 -07:00
Yicheng Qin 852213879b Merge pull request #2633 from yichengq/deprecate
etcdmain: deprecate --ca-file and --peer-ca-file
2015-04-09 10:22:30 -07:00
Yicheng Qin 2f7b9a2232 etcdmain: deprecate --ca-file and --peer-ca-file
1. Print out DEPRECATE warning when running and configuration doc.
2. Use new flags for security example.
2015-04-09 10:14:32 -07:00
Xiang Li a3892221ee *: stop using resolved tcp addr
We start to resolve host into tcp addrs since we generate
tcp based initial-cluster during srv discovery. However it
creates problems around tls and cluster verification. The
srv discovery only needs to use resolved the tcp addr to
find the local node. It does not have to resolve everything
and use the resolved addrs.

This fixes #2488 and #2226
2015-04-09 07:01:48 -07:00
Alex Crawford d9ad6aa2a9 *: update to use IANA-assigned ports 2015-04-06 13:49:43 -07:00
Yicheng Qin 0ac05e310e etcdmain: print error when non-flag args remain 2015-03-23 11:23:47 -07:00
Yicheng Qin 125a033c72 Merge pull request #2534 from philips/initial-cluster-name
etcdmain: let user provide a name w/o initial-cluster update
2015-03-18 18:55:58 -07:00
Brandon Philips ea72f2637c etcdmain: let user provide a name w/o initial-cluster update
Currently this doesn't work if a user wants to try out a single machine
cluster but change the name for whatever reason. This is because the
name is always "default" and the

```
./bin/etcd -name 'baz'
```

This solves our problem on CoreOS where the default is `ETCD_NAME=%m`.
2015-03-18 17:24:52 -07:00
Brandon Philips 408cfc4f28 Documentation: fixup grammar around the unsafe flags 2015-03-18 16:39:45 -07:00
Xiang Li 1ab68902a9 etcdmain: identify data dir type 2015-03-17 16:10:58 -07:00
Kelsey Hightower 9c74f98b97 Merge pull request #2502 from kelseyhightower/trusted-ca-and-client-auth
etcd: server SSL and client cert auth configuration is more explicit
2015-03-14 09:40:53 -07:00
Kelsey Hightower 8dd8b1cdc2 etcd: server SSL and client cert auth configuration is more explicit
etcd does not provide enough flexibility to configure server SSL and
client authentication separately. When configuring server SSL the
`--ca-file` flag is required to trust self-signed SSL certificates
used to service client requests.

The `--ca-file` has the side effect of enabling client cert
authentication. This can be surprising for those looking to simply
secure communication between an etcd server and client.

Resolve this issue by introducing four new flags:

    --client-cert-auth
    --peer-client-cert-auth
    --trusted-ca-file
    --peer-trusted-ca-file

These new flags will allow etcd to support a more explicit SSL
configuration for both etcd clients and peers.

Example usage:

Start etcd with server SSL and no client cert authentication:

    etcd -name etcd0 \
    --advertise-client-urls https://etcd0.example.com:2379 \
    --cert-file etcd0.example.com.crt \
    --key-file etcd0.example.com.key \
    --trusted-ca-file ca.crt

Start etcd with server SSL and enable client cert authentication:

    etcd -name etcd0 \
    --advertise-client-urls https://etcd0.example.com:2379 \
    --cert-file etcd0.example.com.crt \
    --key-file etcd0.example.com.key \
    --trusted-ca-file ca.crt \
    --client-cert-auth

Start etcd with server SSL and client cert authentication for both
peer and client endpoints:

    etcd -name etcd0 \
    --advertise-client-urls https://etcd0.example.com:2379 \
    --cert-file etcd0.example.com.crt \
    --key-file etcd0.example.com.key \
    --trusted-ca-file ca.crt \
    --client-cert-auth \
    --peer-cert-file etcd0.example.com.crt \
    --peer-key-file etcd0.example.com.key \
    --peer-trusted-ca-file ca.crt \
    --peer-client-cert-auth

This change is backwards compatible with etcd versions 2.0.0+. The
current behavior of the `--ca-file` flag is preserved.

Fixes #2499.
2015-03-12 23:09:54 -07:00
Xiang Li ed8c3534e9 etcdmain: verify heartbeat and election flag 2015-03-12 17:45:49 -07:00
kmeaw 00a22891ee pkg/flags: Add support for IPv6 addresses
Support IPv6 address for ETCD_ADDR and ETCD_PEER_ADDR

pkg/flags: Support IPv6 address for ETCD_ADDR and ETCD_PEER_ADDR

pkg/flags: tests for IPv6 addr and bind-addr flags

pkg/flags: IPAddressPort.Host: do not enclose IPv6 address in square brackets

pkg/flags: set default bind address to [::] instead of 0.0.0.0

pkg/flags: we don't need fmt any more

also, one minor fix: net.JoinHostPort takes string as a port value

pkg/flags: fix ipv6 tests

pkg/flags: test both IPv4 and IPv6 addresses in TestIPAddressPortString

etcdmain: test: use [::] instead of 0.0.0.0
2015-03-12 11:30:53 +03:00
Yicheng Qin 2c94e2d771 *: make dial timeout configurable
Dial timeout is set shorter because
1. etcd is supposed to work in good environment, and the new value is long
enough
2. shorter dial timeout makes dial fail faster, which is good for
performance
2015-02-28 11:18:59 -08:00
Xiang Li a776064a8b etcdmain: fix godeps on osx 2015-02-28 11:16:41 -08:00
Xiang Li 7bf615aee0 *: drop old metrics pkg 2015-02-28 11:16:41 -08:00
Xiang Li 2e078582f9 etcdmain: expose runtime metrics 2015-02-28 10:11:53 -08:00
Yicheng Qin cff005777a etcdserver: fix cluster fallback recovery
Cluster and transport may recover to old states when new node joins
the cluster. Record cluster last modified index to avoid this.
2015-02-20 14:30:00 -08:00
Xiang Li c5ca1218f3 etcdserver: GetClusterFromPeers -> GetClusterFromRemotePeers 2015-02-13 19:05:29 -08:00
Fabian Reinartz 8bf795dc3c etcdmain/osutil: shutdown gracefully, interrupt handling
The functionality in pkg/osutil ensures that all interrupt handlers finish
and the process kills itself with the proper signal.
Test for interrupt handling added.
The server shutsdown gracefully by stopping on interrupt (Issue #2277.)
2015-02-13 10:28:53 +01:00
Barak Michener fade9b6065 etcdserver: Refactor 2.0.1 directory rename into a proper migration
fix all instances

fix detection test
2015-02-12 11:53:19 -05:00
Yicheng Qin 57dd8c18cc etcdmain: infer bind addr from addr in v1 flagset 2015-02-10 09:42:10 -08:00
Yicheng Qin 92b329fdb9 etcdmain: use symlink instead of link for v0.4 files
link doesn't support directory.
2015-02-03 10:59:43 -08:00
Yicheng Qin afb14a3e7a Merge pull request #2210 from yichengq/316
etcdmain: use /member subdir to save member data
2015-02-02 17:06:30 -08:00
Yicheng Qin ce1d7a9fa9 etcdmain: use /member subdir to save member data 2015-02-02 17:01:19 -08:00
Xiang Li fbabcedcc9 etcd: fix proxy
1. move proxy datadir to /proxy subdir.
2. delay update proxy's cluster after validation.
2015-02-02 14:58:45 -08:00
Xiang Li ae9f54c132 etcd: fix proxy updating 2015-01-30 16:56:41 -08:00
Xiang Li dc7374c488 etcd: persist proxy cluster to disk 2015-01-30 15:18:26 -08:00
Yicheng Qin ec5a6e8beb migrate: support start desired version 2015-01-30 00:35:53 -08:00