Commit Graph

208 Commits

Author SHA1 Message Date
Armon Dadgar f25566931f consul: Make sessionTimersLock a plain mutex 2014-12-12 19:17:35 -08:00
Atin Malaviya b623af776b Consul Session TTLs
The design of the session TTLs is based on the Google Chubby approach
(http://research.google.com/archive/chubby-osdi06.pdf). The Session
struct has an additional TTL field now. This attaches an implicit
heartbeat based failure detector. Tracking of heartbeats is done by
the current leader and not persisted via the Raft log. The implication
of this is during a leader failover, we do not retain the last
heartbeat times.

Similar to Chubby, the TTL represents a lower-bound. Consul promises
not to terminate a session before the TTL has expired, but is allowed
to extend the expiration past it. This enables us to reset the TTL on
a leader failover. The TTL is also extended when the client does a
heartbeat. Like Chubby, this means a TTL is extended on creation,
heartbeat or failover.

Additionally, because we must account for time requests are in transit
and the relative rates of clocks on the clients and servers, Consul
will take the conservative approach of internally multiplying the TTL
by 2x. This helps to compensate for network latency and clock skew
without violating the contract.

Reference: https://docs.google.com/document/d/1Y5-pahLkUaA7Kz4SBU_mehKiyt9yaaUGcBTMZR7lToY/edit?usp=sharing
2014-12-07 12:38:22 -05:00
Ryan Uber 295f876923 command/agent: fix up gossip encryption indicator 2014-11-19 16:35:37 -08:00
Ryan Uber 96376212ff consul: use rpc layer only for key management functions, add rpc commands 2014-11-19 16:30:21 -08:00
Atin Malaviya 2bd0e8c745 consul.Config() helper to generate the tlsutil.Config{} struct, 30 second keepalive, use keepalive for HTTP and HTTPS 2014-11-18 17:56:48 -05:00
Atin Malaviya b4424a1a50 Moved TLS Config stuff to tlsutil package 2014-11-18 11:03:36 -05:00
Armon Dadgar 0ea385579a consul: Ensure FSM stores data in the data dir 2014-10-15 14:57:59 -07:00
Armon Dadgar 88b53702f1 consul: Reduce mmap size on 32bit 2014-10-15 11:32:40 -07:00
Armon Dadgar b1cf52db01 consul: expose UserEvent from Serf 2014-08-26 18:50:03 -07:00
Armon Dadgar 8153537e86 consul: Support management tokens 2014-08-18 15:46:23 -07:00
Armon Dadgar 61b80e912c consul: Use Etag for policy caching 2014-08-18 15:46:22 -07:00
Armon Dadgar bd124a8da3 consul: Pulling in ACLs 2014-08-18 15:46:21 -07:00
Armon Dadgar ea31f37dd6 consul: Adding ACL endpoint 2014-08-18 15:46:21 -07:00
Armon Dadgar ebae394863 consul: ACL setting passthrough 2014-08-18 15:46:20 -07:00
Armon Dadgar bf26a9160f consul: Defer serf handler until initialized. Fixes #254. 2014-07-22 09:36:58 -04:00
Armon Dadgar 020802f7a5 Merge pull request #233 from nelhage/tls-no-subjname
Restore the 0.2 TLS verification behavior.
2014-07-01 13:41:00 -07:00
Nelson Elhage 0a2476b20e Restore the 0.2 TLS verification behavior.
Namely, don't check the DNS names in TLS certificates when connecting to
other servers.

As of golang 1.3, crypto/tls no longer natively supports doing partial
verification (verifying the cert issuer but not the hostname), so we
have to disable verification entirely and then do the issuer
verification ourselves. Fortunately, crypto/x509 makes this relatively
straightforward.

If the "server_name" configuration option is passed, we preserve the
existing behavior of checking that server name everywhere.

No option is provided to retain the current behavior of checking the
remote certificate against the local node name, since that behavior
seems clearly buggy and unintentional, and I have difficulty imagining
it is actually being used anywhere. It would be relatively
straightforward to restore if desired, however.
2014-06-28 13:32:42 -07:00
Armon Dadgar 80b86c9ee9 Rename Expect to BootstrapExpect. Fixes #223. 2014-06-19 17:08:55 -07:00
Robert Xu fff6546c75 Minor cleanup to logic and testsuite.
Signed-off-by: Robert Xu <robxu9@gmail.com>
2014-06-18 18:47:05 -04:00
Robert Xu a2fea2ce55 Utilise new raft.SetPeers() method, move expect logic to leader.go.
This way, we don't use EnableSingleMode, nor cause chaos adding peers.

Signed-off-by: Robert Xu <robxu9@gmail.com>
2014-06-18 12:03:30 -04:00
Robert Xu 31c392813c Add expect bootstrap '-expect=n' mode.
This allows for us to automatically bootstrap a cluster of nodes after
'n' number of server nodes join. All servers must have the same 'n' set, or
they will fail to join the cluster; all servers will not join the peer set
until they hit 'n' server nodes.

If the raft commit index is not empty, '-expect=n' does nothing because it
thinks you've already bootstrapped.

Signed-off-by: Robert Xu <robxu9@gmail.com>
2014-06-16 17:40:33 -04:00
Armon Dadgar ea054b8847 consul: Start RPC before Raft, wait to accept connecitons 2014-06-11 10:17:58 -07:00
Armon Dadgar 1812eedad9 consul: start RPC after fully initialized. Fixes #160 2014-06-11 09:46:44 -07:00
Armon Dadgar 2e18774c02 consul: Avoid network for server RPC. Fixes #148. 2014-06-10 19:12:36 -07:00
Armon Dadgar b5bd20634a consul: Gossip the build using Serf 2014-06-06 15:36:40 -07:00
Armon Dadgar f9766541e1 Merge pull request #173 from hashicorp/f-agent-self
Add `/v1/agent/self` and return local agent config
2014-05-29 11:18:19 -07:00
Armon Dadgar 319ab05b8c consul: Provide logger to yamux 2014-05-28 16:32:25 -07:00
Armon Dadgar 74452a5ae0 consul: Add new protocol version for yamux 2014-05-28 16:32:24 -07:00
Armon Dadgar 313f79913e consul: Pass protocol version for leader forwarding 2014-05-28 16:32:24 -07:00
Armon Dadgar 345efd74e4 consul: remove explicit leave, use reconciliation 2014-05-28 16:32:24 -07:00
Armon Dadgar 589105eee4 consul: Store the protocol version for a server 2014-05-28 16:32:24 -07:00
Armon Dadgar a79c3d2103 consul: Pool client connections, support for yamux connections 2014-05-28 16:32:24 -07:00
William Tisäter a028c3ae93 Add `/v1/agent/self` and return local agent config 2014-05-27 01:15:33 +02:00
Armon Dadgar 5fa10c912e Support rejoin after leave. Fixes #110. 2014-05-21 12:32:24 -07:00
Armon Dadgar e58e9bceb0 consul: First pass at Session RPC endpoints 2014-05-20 16:25:29 -07:00
Armon Dadgar f8898dce6e consul: Disable conflict resolution. See #97. 2014-05-16 14:11:53 -07:00
Armon Dadgar 2d8b1f5b6f consul: Avoid name conflict on WAN ring. Fixes #158. 2014-05-16 14:07:53 -07:00
Armon Dadgar c54f53eaf7 consul: Remove RPC client tracking. Fixes #149. 2014-05-14 17:34:24 -07:00
Armon Dadgar 5c34e01d17 consul: Fixing for upstream API changes 2014-05-01 18:11:36 -07:00
Armon Dadgar d045335ca0 consul: Rename Misc RPC to Internal 2014-04-30 23:43:59 -04:00
Armon Dadgar 702fe3afda consul: Adding Misc RPC endpoint 2014-04-30 23:43:58 -04:00
Armon Dadgar ece6849cac consul: Expose runtime stats for debugging 2014-04-29 10:55:42 -07:00
Armon Dadgar c1ae3d78ef consul: Increase DB size on 64bit systems. Fixes #81. 2014-04-28 17:07:59 -07:00
Armon Dadgar d581af7692 consul: Clear peer set on leave. Fixes #69 2014-04-23 11:39:45 -07:00
Armon Dadgar 25e4e526ae consul: Update to use raft-mdb package 2014-04-19 13:31:56 -07:00
Armon Dadgar 37ad00d66d consul: Ensure Raft also uses TLS connections 2014-04-07 15:06:59 -07:00
Armon Dadgar cb100af7b8 consul: Enable incoming TLS connections to server 2014-04-07 15:06:59 -07:00
Armon Dadgar f3a3492edc consul: Server initializes pool with TLS settings 2014-04-07 15:06:59 -07:00
Armon Dadgar a55ebaa353 consul: Adding KVS RPC endpoint 2014-03-31 14:15:49 -07:00
Armon Dadgar 3c911b3145 consul: Should not clear the peer set 2014-03-25 14:57:00 -07:00
Armon Dadgar 4b6dc60169 consul: Set maximum raft log size to 128MB 2014-03-25 13:29:15 -07:00
Armon Dadgar 18c3bbcb21 consul: Add tags for consul protocol versions 2014-03-09 15:46:03 -07:00
Armon Dadgar 6fba03db8f consul: Adding protocol version numbers 2014-03-09 15:18:36 -07:00
Armon Dadgar eb9f2a50bd consul: Peg Serf proto version to 3 2014-03-05 15:32:59 -08:00
Armon Dadgar ba2df6cb9c consul: Passthrough the Serf Stats() 2014-02-23 18:08:58 -08:00
Armon Dadgar 11369ca9ad consul: Adding Stats() method to get various debugging information 2014-02-23 16:37:33 -08:00
Armon Dadgar f65ba3c365 consul: Increase network timeout value 2014-02-22 11:13:59 -08:00
Armon Dadgar 974d227b94 consul: Reduce the number of raft snapshots we keep 2014-02-22 10:57:22 -08:00
Armon Dadgar 6c597008f4 If not in bootstrap mode, clear the raft peerset 2014-02-21 15:21:27 -08:00
Armon Dadgar 6142460b29 consul: Only add ourself to the peerset if we are in bootstrap mode 2014-02-20 16:27:14 -08:00
Armon Dadgar b31a0510eb consul: Do not replay events on serf join 2014-02-20 16:27:03 -08:00
Armon Dadgar 7294305df9 consul: Adding telemetry 2014-02-20 15:16:26 -08:00
Armon Dadgar ba765b193f consul: ConnPool multiplexes a single connection instead of using multiple 2014-02-05 16:19:05 -08:00
Armon Dadgar 8b1c78dc00 consul: Cleanup the FSM, running out of file handles 2014-02-05 11:00:10 -08:00
Armon Dadgar 255e224ac8 consul: Log state store errors 2014-02-03 15:21:56 -08:00
Armon Dadgar 1ecdeae1b6 consul: Update for serf 0.4 2014-01-30 13:13:29 -08:00
Armon Dadgar 334c2137ef Preventing multiple nodes in bootstrap mode from adding each other as Raft peers 2014-01-20 13:56:29 -10:00
Armon Dadgar 3e6787511e change isConsulServer to parse flags 2014-01-20 13:39:07 -10:00
Armon Dadgar 2030b2288d Simplify Raft peer adds using only reconciliation 2014-01-10 12:55:55 -08:00
Armon Dadgar c5e2004be9 Log cleanup 2014-01-10 11:06:11 -08:00
Armon Dadgar 9d96ce1107 First pass at Serf reconciliation 2014-01-09 15:49:09 -08:00
Armon Dadgar a82a606221 Retain reference to RPC endpoints 2014-01-09 15:30:36 -08:00
Armon Dadgar 5bb4a5306b Cleanup 2014-01-09 11:33:23 -08:00
Armon Dadgar 000dbedc06 Testing the health endpoints 2014-01-08 14:23:52 -08:00
Armon Dadgar 3c3da212d7 Allow for more cached connections 2013-12-31 17:43:56 -08:00
Armon Dadgar ce79f27364 Adding support for advertise address 2013-12-31 16:45:13 -08:00
Armon Dadgar a88bef821a Guard against a bad advertise address 2013-12-31 14:00:25 -08:00
Armon Dadgar 8fee0cd50a Changing the Join interfaces to match Serf 2013-12-30 12:20:17 -08:00
Armon Dadgar 69ed0ec184 Adding a bootstrap flag to allow single server raft 2013-12-24 16:48:07 -08:00
Armon Dadgar 088def3935 Do not leave raft pool if we are the only member 2013-12-24 12:36:50 -08:00
Armon Dadgar 851c4c8ed1 More HTTP endpoints 2013-12-23 16:20:51 -08:00
Armon Dadgar 995a60ea0b Setup logging for Raft properly 2013-12-23 15:30:45 -08:00
Armon Dadgar b03d1b55b3 Ensure local server is always a raft peer 2013-12-23 11:50:58 -08:00
Armon Dadgar 32c822db1b Adding time based reaping to ConnPool 2013-12-19 15:42:17 -08:00
Armon Dadgar 90f8f075dc Server also implements ConsulRPC interface 2013-12-19 15:18:25 -08:00
Armon Dadgar 644ce2fcf7 Refactor ensurePath to util 2013-12-19 14:18:55 -08:00
Armon Dadgar 9c8af31036 Guard against accessing slices that may have contents changed 2013-12-18 16:40:32 -08:00
Armon Dadgar c5aada3298 Switch Raft from SQLite to MDB 2013-12-18 16:23:17 -08:00
Armon Dadgar 4cfe5179ba Track remote consul servers 2013-12-11 16:24:34 -08:00
Armon Dadgar 94865a40ac consul: starting work on some RPC layers 2013-12-11 14:04:44 -08:00
Armon Dadgar ac9d2a81ff consul: working on fsm state 2013-12-10 17:00:48 -08:00
Armon Dadgar 662a1d9af7 consul: Adding method to force remove failed nodes 2013-12-10 14:42:29 -08:00
Armon Dadgar 0725906cab consul: Adding LANMembers and WANMembers 2013-12-10 13:17:54 -08:00
Armon Dadgar 761197575c consul: Adding tons of shit, leave test 2013-12-09 16:05:15 -08:00
Armon Dadgar 2d7af79662 consul: store the peerstore 2013-12-09 15:29:01 -08:00
Armon Dadgar 08152dc66b consul: Leave does a RemovePeer RPC call 2013-12-09 15:01:42 -08:00
Armon Dadgar 03bd66c8fa consul: Adding Raft rpc endpoint 2013-12-09 14:49:07 -08:00
Armon Dadgar b7bafb6bd8 consul: gossip role includes rpc addr 2013-12-09 14:30:16 -08:00
Armon Dadgar 6e9d7dc0fd consul: RaftLayer does not use ConnPool 2013-12-09 14:25:59 -08:00
Armon Dadgar a5d001034e consul: close raft transport before layer 2013-12-09 14:20:56 -08:00
Armon Dadgar 7f4adceae8 consul: sharing the RPC layer between Consul/Raft 2013-12-09 13:13:40 -08:00
Armon Dadgar fc595ce9ee consul: Adding leave function 2013-12-09 12:10:27 -08:00
Armon Dadgar 205941ffcf consul: adding connection pool 2013-12-09 12:09:57 -08:00
Armon Dadgar af9176bca0 consul: Add+test JoinLAN/JoinWAN 2013-12-06 17:18:09 -08:00
Armon Dadgar 72e93a7432 consul: refactor into more files 2013-12-06 16:54:33 -08:00
Armon Dadgar 0bf9a8fb1c consul: Basic RPC framework 2013-12-06 16:35:13 -08:00
Armon Dadgar 9b8433f787 consul: Rename to LAN/WAN instead of Local/Remote 2013-12-06 16:05:26 -08:00
Armon Dadgar 94ff23d2a4 consul: adding basic skeleton 2013-12-06 15:43:07 -08:00