pixie
pixie

Reputation: 517

OpenShift Postgresql

I have in OpenShift a Postgresql service created from a persistent Postgresql image. The database has two replicas (two pods in openshift).

Now, I want to create a table and that table to be visible in both of the replicas. However, I can create it while connecting to one instance (one pod) of the Postgresql service. When I am connecting to the other instance (the other pod), the table I created is not there.

Could you please give me an idea how can I persist the table among all the replicas of the database? This should be possible, right? Or are the replicas actually two different databases?

Thanks :)

Upvotes: 0

Views: 1375

Answers (2)

luciddreamz
luciddreamz

Reputation: 2093

As Graham mentioned, PostgreSQL should not be scaled using the default PostgreSQL template. That being said, the image is capable of scaling/replication if configured properly. There is actually a separate "proof of concept" template provided by Red Hat to deploy the default PostgreSQL image with replication.

Check out the template and corresponding readme here: https://github.com/sclorg/postgresql-container/tree/master/examples/replica

Upvotes: 1

Graham Dumpleton
Graham Dumpleton

Reputation: 58523

You can't simply create multiple replicas of a typical PostgreSQL image and expect it to work.

You will need to look up what is being down on scaled PostgreSQL instances. One company doing that is Crunchy. See:

Upvotes: 1

Related Questions