You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 14 Next »

Introduction

As part of the HA (High Availability) investigation, the decision was made to focus on the use of certain tools in testing and implementation.

As a database HA solution for Postgres, the Patroni project was chosen. Patroni's solution involves a primary-replica structure for replication. Writes and reads are made to the primary and the data is streamed asynchronously to the replicas. The primary is referred to as the leader in the documentation and this database instance becomes leader by way of a leader election. The elected leader holds a lock. All other instances see this and assume a role as a secondary. If the leader node dies, a new election is done and a new leader is selected. This process is extremely quick.

For backup and restore a tool called Velero was chosen. Velero is a widely used and comprehensive tool for backup of Kubernetes resources, including persistent volumes. The CLI provided by Velero is easy to use and adopts a good amount of the syntax used by kubectl.

The remainder of this document will show a deployment of a 5 pod Patroni cluster inside a Kubernetes environment. The database cluster will then be backed-up, destroyed and then restored - in that order.

Notes

  • This demonstration assumes that you have a running Kubernetes cluster and a helm repo (The name used in this case for the repo is "local").
  • A tool called "minio" is used to simulate connection to AWS. In a real world situation, minio would not be needed because a Kubernetes cluster would be backed by cloud provider storage.

Running minio

Firstly, we will install minio on the machine you are using with Docker. This command pulls the minio image and creates the container with a volume called "data" mapped to the /data directory.

docker run --name minio -p 9000:9000 -v data:/data minio/minio server /data

The output should be similar to the below. Pay particular attention to the credentials and the address of the web ui.

Navigate to the web ui and enter in the credentials.

Once the credentials are entered, you can create an S3 bucket called "kubedemo"

That is all the setup required for minio

  • No labels