You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Feb 12, 2021. It is now read-only.
Copy file name to clipboardExpand all lines: etcd/getting-started-with-etcd-manually.md
+36-27
Original file line number
Diff line number
Diff line change
@@ -1,10 +1,12 @@
1
-
# Setting up etcd v3 on Container Linux "by hand"
1
+
# Manual Configuration of etcd3 on Container Linux
2
2
3
-
The etcd v3 binary is not slated to ship with Container Linux. With this in mind, you might be wondering, how do I run the newest etcd on my Container Linux node? The short answer: systemd and rkt!
3
+
The etcd v3 binary is not slated to ship with Container Linux. With this in mind, you might be wondering, how do I run the newest etcd on my Container Linux node? The short answer: systemd and rkt.
4
4
5
-
**Before we begin** if you are able to use Container Linux Configs or ignition configs [to provision your Container Linux nodes][easier-setup], you should go that route. Only follow this guide if you *have* to setup etcd the 'hard' way.
5
+
f **Before we begin** if you are able to use Container Linux Configs [to provision your Container Linux nodes][easier-setup], you should go that route. Use this guide only if you must set up etcd the *hard* way.
6
6
7
-
This tutorial outlines how to setup the newest version of etcd on a Container Linux cluster using the `etcd-member` systemd service. This service spawns a rkt container which houses the etcd process.
7
+
This tutorial outlines how to set up the newest version of etcd on a Container Linux cluster using the `etcd-member` systemd service. This service spawns a rkt container which houses the etcd process.
8
+
9
+
It is expected that you have some familiarity with etcd operations before entering this guide and have at least skimmed the [etcd clustering guide][etcd-clustering] first.
8
10
9
11
We will deploy a simple 2 node etcd v3 cluster on two local Virtual Machines. This tutorial does not cover setting up TLS, however principles and commands in the [etcd clustering guide][etcd-clustering] carry over into this workflow.
10
12
@@ -13,7 +15,9 @@ We will deploy a simple 2 node etcd v3 cluster on two local Virtual Machines. Th
13
15
| 0 | 192.168.100.100 | my-etcd-0 |
14
16
| 1 | 192.168.100.101 | my-etcd-1 |
15
17
16
-
First, run `sudo systemctl edit etcd-member` and paste the following code into the editor:
18
+
These IP addresses are visible from within your two machines as well as on the host machine. Once the VMs are setup you should be able to run `ping 192.168.100.100` and `ping 192.168.100.101`, where those are the ip addresses of the VMs.
19
+
20
+
SSH into your first node and run `systemctl edit etcd-member` and paste the following code into the editor:
17
21
18
22
```ini
19
23
[Service]
@@ -29,6 +33,8 @@ Environment="ETCD_OPTS=\
29
33
--initial-cluster-state=\"new\""
30
34
```
31
35
36
+
This will create a systemd unit *override* and open the new file in `vi`. The file is empty to begin and *you* populate it with the above code. Paste the above code into the editor and `:wq` to save it.
37
+
32
38
Replace:
33
39
34
40
| Variable | value |
@@ -39,10 +45,12 @@ Replace:
39
45
|`my-etcd-1`| The other node's name. |
40
46
|`f7b787ea26e0c8d44033de08c2f80632`| The discovery token obtained from https://discovery.etcd.io/new?size=2 (generate your own!). |
41
47
42
-
*If you want a cluster of more than 2 nodes, make sure `size=#` where # is the number of nodes you want. Otherwise the extra ndoes will become proxies.*
48
+
> To create a cluster of more than 2 nodes, set `size=#`, where `#` is the number of nodes you wish to create. If not set, any extra nodes will become proxies.
43
49
44
-
1. Edit the file appropriately and save it. Run `systemctl daemon-reload`.
45
-
2. Do the same on the other node, swapping the names and ip-addresses appropriately. It should look like this:
50
+
1. Edit the service override.
51
+
2. Save the changes.
52
+
3. Run `systemctl daemon-reload`.
53
+
4. Do the same on the other node, swapping the names and ip-addresses appropriately. It should look something like this:
46
54
47
55
48
56
```ini
@@ -59,15 +67,17 @@ Environment="ETCD_OPTS=\
59
67
--initial-cluster-state=\"new\""
60
68
```
61
69
62
-
*If at any point you get confused about this configuration file, keep in mind that these arguments are the same as those passed to the etcd binary when starting a cluster. With that in mind, reference the [etcd clustering guide][etcd-clustering] for help and sanity-checks.*
70
+
Note that the arguments used in this configuration fileare the same as those passed to the etcd binary when starting a cluster. For more information on help and sanity checks, see the [etcd clustering guide][etcd-clustering].
63
71
64
72
## Verification
65
73
66
-
You can verify that the services have been configured by running `systemctl cat etcd-member`. This will print the service and it's override conf to the screen. You should see your changes on both nodes.
74
+
1. To verify that services have been configured, run `systemctl cat etcd-member` on the manually configured nodes. This will print the service and it's override conf to the screen. You should see the overrides on both nodes.
67
75
68
-
On both nodes run `systemctl enable etcd-member && systemctl start etcd-member`.
76
+
2. To enable the service on boot, run `systemctl enable etcd-member` on all nodes.
69
77
70
-
If this command hangs for a very long time, <Ctrl>+c to exit out and run `journalctl -xef`. If this outputs something like `rafthttp: request cluster ID mismatch (got 7db8ba5f405afa8d want 5030a2a4c52d7b21)` this means there is existing data on the nodes. Since we are starting completely new nodes we will wipe away the existing data and re-start the service. Run the following on both nodes:
78
+
3. To start the service, run `systemctl start etcd-member`. This command may take a while to complete becuase it is downloading a rkt container and setting up etcd.
79
+
80
+
If the last command hangs for a very long time (10+ minutes), press <Ctrl>+c on your keyboard to exit the commadn and run `journalctl -xef`. If this outputs something like `rafthttp: request cluster ID mismatch (got 7db8ba5f405afa8d want 5030a2a4c52d7b21)` this means there is existing data on the nodes. Since we are starting completely new nodes we will wipe away the existing data and re-start the service. Run the following on both nodes:
0 commit comments