Skip to content

Commit

Permalink
doc: update for etcdv3 backend
Browse files Browse the repository at this point in the history
Update doc for etcdv3 backend.

Update examples to use etcdv3 instead of etcd (aka etcdv2) api.
  • Loading branch information
sgotti committed Jan 8, 2018
1 parent e84ff2c commit b88a557
Show file tree
Hide file tree
Showing 13 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Anyway it's quite easy to reset a cluster from scratch keeping the current maste
## Requirements

* PostgreSQL 10 or 9 (9.4, 9.5, 9.6)
* etcd >= 2.0 or consul >=0.6
* etcd >= 2.0 or consul >= 0.6


## build
Expand Down
6 changes: 3 additions & 3 deletions doc/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Stolon is composed of 3 main components

Every keeper MUST have a different UID that can be manually provided (`--uid` option) or will be generated. After the first start the keeper id (provided or generated) is saved inside the keeper data directory.

Every keeper MUST have a persistent data directory (no ephemeral volumes like k8s `emptyDir`) or you'll lose your data if all the keepers are stoppped at the same time (since at restart no valid standby to failover will be available).
Every keeper MUST have a persistent data directory (no ephemeral volumes like k8s `emptyDir`) or you'll lose your data if all the keepers are stopped at the same time (since at restart no valid standby to failover will be available).

If you're providing the keeper's uid in the command line don't start a new keeper with the same id if you're providing a different data directory (empty or populated) since you're changing data out of the stolon control causing possible data loss or strange behaviors.

Expand All @@ -27,7 +27,7 @@ Sentinels and proxies don't need a local data directory but only use the store (

#### Store

Currently the store can be etcd or consul, we leverage their features to achieve consistent and persistent cluster data.
Currently the store can be etcd (using v2 or v3 api) or consul, we leverage their features to achieve consistent and persistent cluster data.

The store should be high available (at least three nodes).

Expand All @@ -39,7 +39,7 @@ In addition, the stolon-proxy, if not able to talk with the store, to avoid send


##### Handling permanent loss of the store.
ed up

If you have permanently lost your store you can create a new one BUT don't restore its contents (at least the stolon ones) from a backup since the backed up data could be older than the current real state and this could cause different problems. For example if you restore a stolon cluster data where the elected master was different than the current one, you can end up with this old master becoming the new master.

The cleaner way is to reinitialize the stolon cluster using the `existing` `initMode` (see [Cluster Initialization](initialization.md)).
Expand Down
12 changes: 6 additions & 6 deletions doc/simplecluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

These are the steps to setup and test a simple cluster.

This example assumes a running etcd or consul server on localhost
This example assumes a running etcd 3.x server on localhost. We'll use the etcd v3 api to store stolon data inside etcd.

Note: under ubuntu the `initdb` command is not provided in the path. You should updated the exported `PATH` env variable or provide the `--pg-bin-path` command line option to the `stolon-keeper` command.

Expand All @@ -11,7 +11,7 @@ Note: under ubuntu the `initdb` command is not provided in the path. You should
The first step is to initialize a cluster with a cluster specification. For now we'll just initialize a cluster without providing a cluster specification but using a default one that will just start with an empty database cluster.

```
./bin/stolonctl --cluster-name stolon-cluster --store-backend=etcd init
./bin/stolonctl --cluster-name stolon-cluster --store-backend=etcdv3 init
```

If you want to automate this step you can just pass an initial cluster specification to the sentinels with the `--initial-cluster-spec` option.
Expand All @@ -20,7 +20,7 @@ If you want to automate this step you can just pass an initial cluster specifica

The sentinel will become the sentinels leader for the cluster named `stolon-cluster`.
```
./bin/stolon-sentinel --cluster-name stolon-cluster --store-backend=etcd
./bin/stolon-sentinel --cluster-name stolon-cluster --store-backend=etcdv3
```

```
Expand All @@ -32,7 +32,7 @@ sentinel leadership acquired
### Launch first keeper

```
./bin/stolon-keeper --cluster-name stolon-cluster --store-backend=etcd --uid postgres0 --data-dir data/postgres0 --pg-su-password=supassword --pg-repl-username=repluser --pg-repl-password=replpassword
./bin/stolon-keeper --cluster-name stolon-cluster --store-backend=etcdv3 --uid postgres0 --data-dir data/postgres0 --pg-su-password=supassword --pg-repl-username=repluser --pg-repl-password=replpassword
```

This will start a stolon keeper with id `postgres0` listening by default on localhost:5431, it will setup and initialize a postgres instance inside `data/postgres0/postgres/`
Expand Down Expand Up @@ -78,7 +78,7 @@ db initialized db=2a87ea79 keeper=postgres0
Now we can start the proxy

```
./bin/stolon-proxy --cluster-name stolon-cluster --store-backend=etcd --port 25432
./bin/stolon-proxy --cluster-name stolon-cluster --store-backend=etcdv3 --port 25432
```

```
Expand Down Expand Up @@ -119,7 +119,7 @@ postgres=# select * from test;
### Start another keeper:

```
./bin/stolon-keeper --cluster-name stolon-cluster --store-backend=etcd --uid postgres1 --data-dir data/postgres1 --pg-su-password=supassword --pg-repl-username=repluser --pg-repl-password=replpassword --pg-port 5435
./bin/stolon-keeper --cluster-name stolon-cluster --store-backend=etcdv3 --uid postgres1 --data-dir data/postgres1 --pg-su-password=supassword --pg-repl-username=repluser --pg-repl-password=replpassword --pg-port 5435
```

This instance will start replicating from the master (postgres0)
Expand Down
2 changes: 1 addition & 1 deletion examples/docker/Dockerfile-Keeper
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM postgres:9.6.1

ENV STKEEPER_CLUSTER_NAME=stolon-cluster \
STKEEPER_STORE_BACKEND=etcd \
STKEEPER_STORE_BACKEND=etcdv3 \
STKEEPER_STORE_ENDPOINTS=http://localhost:2379 \
STKEEPER_DATA_DIR=/data/postgres

Expand Down
2 changes: 1 addition & 1 deletion examples/docker/Dockerfile-Proxy
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM postgres:9.6.1

ENV STPROXY_CLUSTER_NAME=stolon-cluster \
STPROXY_STORE_BACKEND=etcd \
STPROXY_STORE_BACKEND=etcdv3 \
STPROXY_STORE_ENDPOINTS=http://localhost:2379 \
STPROXY_LISTEN_ADDRESS=0.0.0.0 \
STPROXY_PORT=25432
Expand Down
2 changes: 1 addition & 1 deletion examples/docker/Dockerfile-Sentinel
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM postgres:9.6.1

ENV STSENTINEL_CLUSTER_NAME=stolon-cluster \
STSENTINEL_STORE_BACKEND=etcd \
STSENTINEL_STORE_BACKEND=etcdv3 \
STSENTINEL_STORE_ENDPOINTS=http://localhost:2379 \
STSENTINEL_INITIAL_CLUSTER_SPEC=/etc/stolon/init-spec.json

Expand Down
2 changes: 1 addition & 1 deletion examples/kubernetes/rc/stolon-keeper0.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ spec:
# TODO(sgotti) Get cluster name from "stoloncluster" label using a downward volume api instead of duplicating the name here?
value: "kube-stolon"
- name: STKEEPER_STORE_BACKEND
value: "etcd" # Or consul
value: "etcdv3" # Or: etcdv2, consul
- name: STKEEPER_STORE_ENDPOINTS
value: "http://192.168.122.1:2379"
- name: STKEEPER_PG_REPL_USERNAME
Expand Down
2 changes: 1 addition & 1 deletion examples/kubernetes/rc/stolon-keeper1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ spec:
# TODO(sgotti) Get cluster name from "stoloncluster" label using a downward volume api instead of duplicating the name here?
value: "kube-stolon"
- name: STKEEPER_STORE_BACKEND
value: "etcd" # Or consul
value: "etcdv3" # Or: etcdv2, consul
- name: STKEEPER_STORE_ENDPOINTS
value: "http://192.168.122.1:2379"
- name: STKEEPER_PG_REPL_USERNAME
Expand Down
2 changes: 1 addition & 1 deletion examples/kubernetes/rc/stolon-proxy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ spec:
# TODO(sgotti) Get cluster name from "stoloncluster" label using a downward volume api instead of duplicating the name here
value: "kube-stolon"
- name: STPROXY_STORE_BACKEND
value: "etcd" # Or consul
value: "etcdv3" # Or: etcdv2, consul
- name: STPROXY_STORE_ENDPOINTS
value: "http://192.168.122.1:2379"
- name: STPROXY_LISTEN_ADDRESS
Expand Down
2 changes: 1 addition & 1 deletion examples/kubernetes/rc/stolon-sentinel.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ spec:
- name: STSENTINEL_CLUSTER_NAME
value: "kube-stolon"
- name: STSENTINEL_STORE_BACKEND
value: "etcd" # Or consul
value: "etcdv3" # Or: etcdv2, consul
- name: STSENTINEL_STORE_ENDPOINTS
value: "http://192.168.122.1:2379"
## Uncomment this to enable debug logs
Expand Down
2 changes: 1 addition & 1 deletion examples/kubernetes/statefulset/stolon-keeper.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ spec:
# TODO(sgotti) Get cluster name from "stoloncluster" label using a downward volume api instead of duplicating the name here
value: "kube-stolon"
- name: STKEEPER_STORE_BACKEND
value: "etcd" # Or consul
value: "etcdv3" # Or: etcdv2, consul
- name: STKEEPER_STORE_ENDPOINTS
value: "http://192.168.122.1:2379"
- name: STKEEPER_PG_REPL_USERNAME
Expand Down
2 changes: 1 addition & 1 deletion examples/kubernetes/statefulset/stolon-proxy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ spec:
# TODO(sgotti) Get cluster name from "stoloncluster" label using a downward volume api instead of duplicating the name here
value: "kube-stolon"
- name: STPROXY_STORE_BACKEND
value: "etcd" # Or consul
value: "etcdv3" # Or: etcdv2, consul
- name: STPROXY_STORE_ENDPOINTS
value: "http://192.168.122.1:2379"
- name: STPROXY_LISTEN_ADDRESS
Expand Down
2 changes: 1 addition & 1 deletion examples/kubernetes/statefulset/stolon-sentinel.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ spec:
- name: STSENTINEL_CLUSTER_NAME
value: "kube-stolon"
- name: STSENTINEL_STORE_BACKEND
value: "etcd" # Or consul
value: "etcdv3" # Or: etcdv2, consul
- name: STSENTINEL_STORE_ENDPOINTS
value: "http://192.168.122.1:2379"
## Uncomment this to enable debug logs
Expand Down

0 comments on commit b88a557

Please sign in to comment.