Sign inSign up

xiangma0510/spilo-13

By xiangma0510

•Updated about 5 years ago

Offical images version 2.0-p7 from registry.opensource.zalan.do/acid

Image
0

271

xiangma0510/spilo-13 repository overview

⁠Spilo: HA PostgreSQL Clusters with Docker

Spilo⁠ is a Docker image that provides PostgreSQL and Patroni bundled together. Patroni is a template for PostgreSQL HA. Multiple Spilos can create a resilient High Available PostgreSQL cluster. For this, you'll need to start all participating Spilos with identical etcd addresses and cluster names.

Spilo's name derives from სპილო [spiːlɒ], the Georgian word for "elephant."

⁠Quick reference

⁠How to use this image

You can find the source from incubator/patroni⁠

⁠Installing the Chart

To install the chart with the release name my-release:

$ helm repo add incubator https://charts.helm.sh/incubator
$ helm repo update
$ helm install --name my-patroni incubator/patroni

To install the chart with randomly generated passwords:

$ helm install --name my-patroni incubator/patroni \
  --set credentials.superuser="$(< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c32)",credentials.admin="$(< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c32)",credentials.standby="$(< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c32)"

Connecting to PostgreSQL Your access point is a cluster IP. In order to access it spin up another pod:

$ kubectl run -i --tty --rm psql --image=postgres --restart=Never -- bash -il

Then, from inside the pod, connect to PostgreSQL:

$ psql -U admin -h my-patroni.default.svc.cluster.local postgres
<admin password from values.yaml>
postgres=>

Alternatively, a YAML file that specifies the values for the parameters can be provided while installing the chart. For example,

$ helm install --name my-patroni -f values.yaml incubator/patroni

⁠Cleanup

To remove the spawned pods you can run a simple helm delete .

Helm will however preserve created persistent volume claims, to also remove them execute the commands below.

$ release=<release-name>
$ helm delete $release
$ kubectl delete pvc -l release=$release

⁠Internals

Patroni is responsible for electing a PostgreSQL master pod by leveraging the DCS of your choice. After election it adds a spilo-role=master label to the elected master and set the label to spilo-role=replica for all replicas. Simultaneously it will update the -patroni endpoint to let the service route traffic to the elected master.

$ kubectl get pods -l spilo-role -L spilo-role
NAME           READY     STATUS    RESTARTS   AGE       SPILO-ROLE
my-patroni-0   1/1       Running   0          9m        replica
my-patroni-1   1/1       Running   0          9m        master
my-patroni-2   1/1       Running   0          8m        replica
my-patroni-3   1/1       Running   0          8m        replica
my-patroni-4   1/1       Running   0          8m        replica

Tag summary

Content type

Image

Digest

Size

248.9 MB

Last updated

about 5 years ago

docker pull xiangma0510/spilo-13:2.0-p6