-
Notifications
You must be signed in to change notification settings - Fork 535
Add Postgresql statefulsets with master/slave replication on OpenShift. #4599
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -42,6 +42,7 @@ | |
| "selector": { | ||
| "name": "iqss-dataverse-postgresql" | ||
| }, | ||
| "clusterIP": "None", | ||
| "ports": [ | ||
| { | ||
| "name": "database", | ||
|
|
@@ -150,6 +151,10 @@ | |
| } | ||
| ], | ||
| "env": [ | ||
| { | ||
| "name": "POSTGRES_SERVER", | ||
| "value": "dataverse-postgresql-0" | ||
| }, | ||
| { | ||
| "name": "POSTGRES_SERVICE_HOST", | ||
| "value": "dataverse-postgresql-service" | ||
|
|
@@ -222,15 +227,17 @@ | |
| } | ||
| }, | ||
| { | ||
| "kind": "DeploymentConfig", | ||
| "apiVersion": "v1", | ||
| "kind": "StatefulSet", | ||
| "apiVersion": "apps/v1beta1", | ||
| "metadata": { | ||
| "name": "dataverse-postgresql", | ||
| "annotations": { | ||
| "template.alpha.openshift.io/wait-for-ready": "true" | ||
| } | ||
| }, | ||
| "spec": { | ||
| "serviceName" : "dataverse-postgresql-service", | ||
| "replicas" : 1, | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @danmcp raised the question of whether running a setup with only a master and no slaves would have any side effects. I think there would be no side effects and it would be similar to just running a single instance Postgres setup. Our code is based off this example, which states:
I dug in a little more to the image to see what is happening: To me, the above settings look innocuous. For further context, here is the master-binary: https://github.com/sclorg/postgresql-container/blob/master/src/root/usr/bin/run-postgresql-master And that environment variable is called in this common script, which just copies the first file above into the main config settings: https://github.com/sclorg/postgresql-container/blob/b737ad26db4f8769e775ca165284f62c7f2a66db/src/root/usr/share/container-scripts/postgresql/common.sh
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @patrickdillon thanks, I just moved this to QA. |
||
| "template": { | ||
| "metadata": { | ||
| "labels": { | ||
|
|
@@ -241,7 +248,10 @@ | |
| "containers": [ | ||
| { | ||
| "name": "centos-postgresql-94-centos7", | ||
| "image": "centos-postgresql-94-centos7", | ||
| "image": "centos/postgresql-94-centos7", | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. By using |
||
| "command": [ | ||
| "sh", "-c", "echo 'Setting up Postgres Master/Slave replication...'; [[ `hostname` =~ -([0-9]+)$ ]] || exit 1; ordinal=${BASH_REMATCH[1]}; if [[ $ordinal -eq 0 ]]; then run-postgresql-master; else run-postgresql-slave; fi;" | ||
| ], | ||
| "ports": [ | ||
| { | ||
| "containerPort": 5432, | ||
|
|
@@ -253,10 +263,34 @@ | |
| "name": "POSTGRESQL_USER", | ||
| "value": "dvnapp" | ||
| }, | ||
| { | ||
| "name": "POSTGRESQL_MASTER_USER", | ||
| "value": "master" | ||
| }, | ||
| { | ||
| "name": "POSTGRESQL_PASSWORD", | ||
| "value": "secret" | ||
| }, | ||
| { | ||
| "name": "POSTGRESQL_MASTER_PASSWORD", | ||
| "value": "master" | ||
| }, | ||
| { | ||
| "name": "POSTGRESQL_MASTER_SERVICE_NAME", | ||
| "value": "dataverse-postgresql-service" | ||
| }, | ||
| { | ||
| "name": "POSTGRESQL_MASTER_IP", | ||
| "value": "dataverse-postgresql-0.dataverse-postgresql-service" | ||
| }, | ||
| { | ||
| "name": "postgresql_master_addr", | ||
| "value": "dataverse-postgresql-0.dataverse-postgresql-service" | ||
| }, | ||
| { | ||
| "name": "master_fqdn", | ||
| "value": "dataverse-postgresql-0.dataverse-postgresql-service" | ||
| }, | ||
| { | ||
| "name": "POSTGRESQL_DATABASE", | ||
| "value": "dvndb" | ||
|
|
@@ -281,6 +315,7 @@ | |
| ] | ||
| } | ||
| }, | ||
|
|
||
| "strategy": { | ||
| "type": "Rolling", | ||
| "rollingParams": { | ||
|
|
@@ -300,17 +335,19 @@ | |
| ], | ||
| "from": { | ||
| "kind": "ImageStreamTag", | ||
| "name": "centos-postgresql-94-centos7:latest" | ||
| "name": "centos/postgresql-94-centos7:latest" | ||
| } | ||
| } | ||
| }, | ||
| { | ||
| "type": "ConfigChange" | ||
| } | ||
| ], | ||
| "replicas": 1, | ||
| "selector": { | ||
| "name": "iqss-dataverse-postgresql" | ||
| "name": "iqss-dataverse-postgresql", | ||
| "matchLabels" : { | ||
| "name" : "iqss-dataverse-postgresql" | ||
| } | ||
| } | ||
| } | ||
| }, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does
v1beta1require a beta version of minishift? Or can I just use the most recent regular release of minishift?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Regular release is fine. I was running on v1.14
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, great. Thanks.