-
Notifications
You must be signed in to change notification settings - Fork 1k
Added option to create streaming standby cluster. #804
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
Conversation
Hi all, |
@ermajn, does this PR support promoting of the standby cluster using the operator? (Similar to this: patroni/patroni#1096) If not are you planning to add the same? |
Thanks @ermajn for this PR and sorry it took so long to give first feedback. I see one problem with the new required I tend to ignore S3 when streaming host and port are set. If it's incomplete take Three more minor requests:
|
@ermajn, is this PR still active? If not, I can raise a new one based on these changes. |
@senthilcodr yes its active, let me finish all requested task... |
Hi, |
Sure. Unfortunately, my main complaint from last summer is still not addressed: Backwards compatibility. The |
Hello, yes requirement is still there. It would be great if we can include it. |
@FxKu this one is old but it seems to be required. I have added now backward compatibility, it falls back to "s3_wal" when standby_method is not specified. Is there anything more needed in order to merge this PR? |
@ermajn I resolved the conflicts. I'm still not a fan of the At first, I wasn't sure about the |
c.logger.Infof(msg, description.StandbyHost) | ||
|
||
result = append(result, v1.EnvVar{Name: "STANDBY_HOST", Value: description.StandbyHost}) | ||
result = append(result, v1.EnvVar{Name: "STANDBY_PORT", Value: description.StandbyPort}) |
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.
I think STANDBY_PORT can be omitted when it's not set. Patroni will default to 5432.
if description.StandbyMethod == "s3_wal" || description.StandbyMethod == "gs_wal" { | ||
if description.S3WalPath != "" { | ||
// standby with S3, find out the bucket to setup standby | ||
msg := "Standby from S3 bucket using custom parsed S3WalPath from the manifest %s " | ||
c.logger.Infof(msg, description.S3WalPath) | ||
|
||
result = append(result, v1.EnvVar{ | ||
Name: "STANDBY_WALE_S3_PREFIX", | ||
Value: description.S3WalPath, | ||
}) | ||
} else if description.GSWalPath != "" { | ||
msg := "Standby from GS bucket using custom parsed GSWalPath from the manifest %s " | ||
c.logger.Infof(msg, description.GSWalPath) | ||
|
||
envs := []v1.EnvVar{ | ||
{ | ||
Name: "STANDBY_WALE_GS_PREFIX", | ||
Value: description.GSWalPath, | ||
}, | ||
{ | ||
Name: "STANDBY_GOOGLE_APPLICATION_CREDENTIALS", | ||
Value: c.OpConfig.GCPCredentials, | ||
}, | ||
} | ||
result = append(result, envs...) | ||
} | ||
result = append(result, v1.EnvVar{Name: "STANDBY_METHOD", Value: "STANDBY_WITH_WALE"}) | ||
result = append(result, v1.EnvVar{Name: "STANDBY_WAL_BUCKET_SCOPE_PREFIX", Value: ""}) |
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.
sorry, my conflict resolving messed up indentation in this part
* **standby_secret_name** | ||
Specify secret name that is used to look-up for a password that | ||
is need to connect to primary host. Password should be under `password` key | ||
of a secret. This is *required* be specified when using `streaming_host` standby method. |
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.
It is not required so define it, since you default to the old behavior in the code.
s3_wal_path: "s3://path/to/bucket/containing/wal/of/source/cluster/" | ||
s3_wal_path: "s3://path/to/bucket/containing/wal/of/source/cluster/" # Make this a standby cluster and provide the s3 bucket path of source cluster for continuous streaming. | ||
standby_method: "s3_wal" # s3_wal or streaming_host; | ||
# standby_host: "" |
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.
would be nice to provide a reasonable example here? Same for the user docs.
After this, there are two options of standby cluster:
streaming_host
, ands3_wal
.In case of streaming_host option, standby will connect to primary (specified in manifest) and do clone based on basebackup. For that a small refernce to basebackup script in spilo needs to be fixed (zalando/spilo#404).
Also, secret with credentials for standby user are handled manualy in this case. I'm not sure about implementation under #507, but this is minimalistic implementation that basically passes required ENVs to spilo, and it actualy works.