Skip to content

Commit 230e3a3

Browse files
Atin MukherjeeJeff Darcy
Atin Mukherjee
authored and
Jeff Darcy
committed
Add ETCD bootstrapping details in GD2 Design
Change-Id: Ib09599b95c4faec00577998a048eb93f02509ed1 Signed-off-by: Atin Mukherjee <[email protected]> Reviewed-on: http://review.gluster.org/13671 Reviewed-by: Jeff Darcy <[email protected]> Tested-by: Jeff Darcy <[email protected]>
1 parent 799fca3 commit 230e3a3

File tree

3 files changed

+87
-4
lines changed

3 files changed

+87
-4
lines changed
+80
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
# ETCD Bootstrapping in GlusterD 2.0
2+
The main motive behind revamping legacy GlusterD's architecture and come up with [GlusterD 2.0](https://github.com/gluster/glusterfs-specs/blob/master/design/GlusterD2/GD2-Design.md) (Will be referred as GD2 from now on through out this document) is to take leverage of using tools which offer centralized store and as a no surprise [ETCD](https://github.com/coreos/etcd) came as one of the strong contender for it.
3+
4+
ETCD comes with rich set of APIs to use the centralized store in an effective manner. GD2 uses the same for adding/deleting members in the cluster, however for store management it uses [libkv](libkvgithub.com/docker/libkv/store) which provides an abstraction layer for the centralized store technologies like ETCD, CONSUL, ZooKeeper etc.
5+
6+
## ETCD Configuration
7+
ETCD can be configured and bootstrapped in three different ways, 1. static configuration, 2. ETCD discovery & 3. Service discovery. For more details please read [here](https://coreos.com/etcd/docs/latest/clustering.html).
8+
GD2 uses the static configuration approach where each GD2 instance sets itself to the initial-cluster list at the time of boot.
9+
10+
GD2 maintains/integrates ETCD in following ways:
11+
12+
### Internal
13+
14+
This is the default option where GD2 manages the ETCD's life cycle and brings up an ETCD instance when GlusterD comes up. If there is already an ETCD instance running from previous GlusterD session, then GD2 doesn't bring up another ETCD instance. On the following sections how GD2 arrives at a decision to which parameters need to be passed to the etcd binary will be discussed.
15+
16+
####ETCD Initialization
17+
When GD2 comes up it checks for a file `etcdenv.conf` in GD2's config folder, this file contains all the environment variable names and their respective values which were been given when a member was added. If this file is not present GD2 checks for a file called `proxy` in the same path and if the file is present then it reads the initial-cluster parameter from the same file and etcd instance is brought up with proxy mode with the following parameters:
18+
19+
-proxy on -listen-client-urls http://NodeIP:2379 -initial-cluster 'cluster list from proxy file'
20+
21+
otherwise a standalone ETCD instance with the following parameters:
22+
23+
-listen-client-urls http://NodeIP:2379 -advertise-client-urls http://NodeIP:2379 -listen-peer-urls http://NodeIP:2380 -initial-advertise-peer-urls http://NodeIP:2379 -initial-cluster http://NodeIP:2380
24+
25+
If `etcdenv.conf` file exists GD2 reads the content of the file and sets them into the environment which is a prerequisite for ETCD. Post setting the environment variables following parameters are passed on to etcd binary:
26+
27+
-listen-client-urls http://NodeIP:2379 -advertise-client-urls http://NodeIP:2379 -listen-peer-urls http://NodeIP:2380 -initial-advertise-peer-urls http://NodeIP:2379
28+
29+
#### Member addition
30+
When a new peer (**etcd server**) is been probed the following workflow is triggered:
31+
- GD2 on the node which receives the peer probe request initiates a RPC call to the new node to check the following:
32+
- op-version is compatible
33+
- Node is not part of another cluster
34+
- Node doesn't have any existing volumes
35+
- On failure of this validation, peer probe request fails.
36+
- On success GD2 on the originator issues an Add() etcd API to add the new member. The set of environment variables returned by Add() API is captured and sent over another RPC call to the new node and the same is set as environment variables and stored in `etcdenv.conf` in the configuration folder.
37+
38+
- etcd instance on the new node is restarted with the following parameters
39+
40+
-listen-client-urls http://NodeIP:2379 -advertise-client-urls http://NodeIP:2379 -listen-peer-urls
41+
http://NodeIP:2380 -initial-advertise-peer-urls http://NodeIP:2379
42+
43+
- Finally the originator node issues a Put() call through libkv interface to add the details into the centralized store
44+
45+
When a new peer (**etcd proxy/client**) is been probed the following workflow is triggered:
46+
- If a peer probe request has `Client` flag set to true GD2 considers the node to be acting as etcd proxy and initiates a RPC call to the new node to check the following:
47+
- op-version is compatible
48+
- Node is not part of another cluster
49+
- Node doesn't have any existing volumes
50+
- On failure of this validation, peer probe request fails
51+
- On success GD2 on the originator *does not* issue an Add() etcd API to add the new member but forms the initial-cluster list which comprises of the nodes acting as etcd server with the following form:
52+
53+
initial-cluster="http://ETCDServer1IP:2380, http://ETCDServer2IP:2380, ....."
54+
55+
- This initial-cluster list is then sent to the new node over a RPC call and the same is been stored into `proxy` file.
56+
57+
- running etcd instance of etcd is stopped, etcd configuration is deleted and then the new etcd instance is brought up with the following parameters
58+
59+
-proxy on -listen-client-urls http://NodeIP:2379 -initial-cluster 'cluster list from proxy file'
60+
- Finally the originator node issues a Put() call through libkv interface to add the details into the centralized store
61+
62+
####Member Deletion
63+
- Upon receiving a peer detach request GD2 on originator first validates whether the peer exists, if not the request fails.
64+
- A RPC call to the node which has to be deleted is sent and a set of validations are performed which are as follows:
65+
- Peer doesn't host a brick for a volume which has rest of the bricks in other nodes
66+
- On failure of this validation, peer detach request fails
67+
- On success GD2 on the originator issues an Remove() etcd API to delete the member
68+
- Finally the originator node issues a Delete() call through libkv interface to remove the details of the peer from the centralized store
69+
70+
71+
###External
72+
- GD2 will also going to have an option to integrate an existing running ETCD cluster. Design on this is yet to begin.
73+
74+
##Toggling between server & proxy and vice versa
75+
ETCD server can be converted into a ETCD proxy & vice versa. GD2 will provide a command interface to the admin/user to toggle them.
76+
77+
### Server to Proxy
78+
If a ETCD server needs to be converted to proxy, the originator GD2 instance shall remove the entry from the store and the node which has to become proxy shall restart its ETCD instance with proxy related parameters post cleaning up the existing ETCD configuration
79+
### Proxy to Server
80+
If a proxy ETCD has to be converted into server, the originator GD2 shall add the details into the store and the node which has to convert ETCD from proxy to server shall set the os environments, restart ETCD instance with the parameters used in peer probe flow in the remote node post removing the proxy directory from ETCD's configuration

design/GlusterD2/GD2-Design.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ GD2 will also be a native ReST server, exposing cluster management interfaces vi
3232

3333
The main management interface with GD2 will be a HTTP ReST interface. APIs will be provided for the management of peers, management of volumes, local-GlusterD management, monitoring (events) and long-running asynchronous operations.
3434

35-
More details on the ReST-API can be found at [[ReST-API]] (_note that this is still under active development_).
35+
More details on the ReST-API can be found [here](ReST-API) (_note that this is still under active development_).
3636

3737
### Gluster CLI
3838

@@ -60,6 +60,7 @@ The summary of the discussion is that,
6060

6161
The mechanisms of promotion and demotion of the nodes in the store cluster are still under discussion.
6262

63+
More on how ETCD bootsrapping is going to be achieved is [here](ETCD-bootstrapping.md)
6364

6465
## Transaction framework
6566

@@ -75,7 +76,7 @@ More details can be found at [[Transaction-framework]].
7576

7677
## RPC communication
7778

78-
GD2 is going to implement a new cross language RPC framework using [protobuf](https://github.com/google/protobuf). A PoC golang package has been already implemented [here](https://github.com/kshlm/pbrpc). This will be used in communication between GlusterD and GlusterD/Glusterfsd deamons. Clients to bricks and vice versa will still follow the old way of xdr based sun rpc implementation.
79+
GD2 is going to implement a new cross language RPC framework using [protobuf](https://github.com/google/protobuf). A PoC golang package has been already implemented [here](https://github.com/kshlm/pbrpc). This will be used in communication between GlusterD and GlusterD/Glusterfsd deamons. Clients to bricks and vice versa will still follow the old way of xdr based sun rpc implementation.
7980

8081
GD2 is going to have the RPC hierarchy in the following manner
8182
```

design/GlusterD2/ReST-API.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,16 @@ The _peers_ endpoint will be used to manage peers in the cluster. All _peers_ en
6363
- **Body**:
6464
- *addresses* : An array of strings. Gives a list of addresses by which the new host can be contacted. The addresses can be FQDNs, short-names or IP addresses. At least 1 address is required
6565
- *name* : A string, optional. The name to be used for the peer. This name can be used to refer to the peer in other commands. If not given, the first address in the addresses array will be used as the name.
66-
- Example :
66+
- *client* : A boolean, optional. It indicates its a proxy etcd given when its set to true
67+
- Example :
6768
```json
6869
{
6970
"addresses": [
7071
"host1name1",
7172
"host1name2"
7273
],
73-
"name": "host1"
74+
"name": "host1",
75+
"client":true
7476
}
7577
```
7678
- **Response** :

0 commit comments

Comments
 (0)