Skip to content
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

Add tags to replicas to support many replicas #48

Closed
jberkus opened this issue Sep 22, 2015 · 12 comments
Closed

Add tags to replicas to support many replicas #48

jberkus opened this issue Sep 22, 2015 · 12 comments

Comments

@jberkus
Copy link
Contributor

jberkus commented Sep 22, 2015

Replicas should have the following attributes available. This would be added as tags within the replica description, both in the API and in the SIS. If the tags are absent, default behavior remains the same; in the config, the tags below are set to True or False:

nofailover: this replica should not be a candidate for automatic failover. Used for ephemeral replicas, and multi-replica setups where there are a few designated failover targets. If the tag is missing, the replica is assumed to be a failover target.

noloadbalance: this replica should not be part of any load-balancing, if HAProxy autoconfig is being used.

clonefrom: take basebackups from this replica instead of from the master. If multiple CloneFrom replicals are available, one is randomly chosen for new basebackups. If cloning using WALE or other archival backup, this tag is ignored.

replicatefrom: not true or false, but the IP address/hostname of another replica. Used to support cascading replication.

@kmoppel
Copy link
Contributor

kmoppel commented Oct 7, 2015

Also an "environment" tag should be there to distinguishing between release/live environments etc.
Even better would be the possibility to add "custom" user defined tags, with no meaning to patroni. Those tags should be persisted and easily inspectable via (future) patroni-cli for example.

@valgog
Copy link
Member

valgog commented Oct 7, 2015

@kmoppel you are now introducing the idea of tags for the whole cluster. Until now the tags suggested by Josh are tagging instances in the cluster.

@jberkus
Copy link
Contributor Author

jberkus commented Oct 7, 2015

The only global tag I'm proposing to add will be:

disabled: if this tag is set for the cluster, no auto-failover will take place. This tag is meant for disabling auto-failover during manual failover and similar expected downtime. It should always be set with a TTL.

@jberkus
Copy link
Contributor Author

jberkus commented Oct 7, 2015

I don't think I agree with the idea of an "environment" tag. In what way is that not simply part of the "scope"?

As for user-defined custom tags, nothing keeps patroni-cli from adding any tags it wants. I haven't conceived of any I need yet though.

@kmoppel
Copy link
Contributor

kmoppel commented Oct 8, 2015

@valgog yes, exactly for the whole cluster. @jberkus ok yes, the "environment" concept could be an user defined concept (tag) also - keeping mandatory parts from operational requirements only might be a good line to keep as patroni grows in features.
But custom tags in general would be very useful in my opinion - marking environments, applications using some cluster, criticality level, being part of a sharded cluster etc, will definitely help large setups.

@jberkus
Copy link
Contributor Author

jberkus commented Oct 8, 2015

@kmoppel Certianly you could easily add a self.custom_tags dictionary to init.py, and then an optional config setting called "custom_tags" which takes a list to the patroni config file. However, what good would this do you? Pretty much the only thing you could do with the custom tags is pass them along to create_replica scripts; there's no place else in patroni we would read them. So what's the point?

If you want custom tags just for the CLI, that's really a completely different feature.

@kmoppel
Copy link
Contributor

kmoppel commented Oct 9, 2015

Exactly, just for the CLI (or any reader), no point for the slaves or init scripts or any other operational stuff. Idea would be to just persist some values in etcd/zookeeper, so that for example our "database discovery service" could give users more hints about the nature and purpose of found database clusters. These tags could be changed/added at any moment, not on cluster creation, so maybe it deserves a separate issue indeed.

@jberkus
Copy link
Contributor Author

jberkus commented Oct 9, 2015

@kmoppel I welcome your contributions to patroni-cli, once I have the initial prototype up.

@alexeyklyukin
Copy link
Contributor

The nofailover tag, along with some general code to support tags in the DCS and the API, is implemented in #80

@jberkus
Copy link
Contributor Author

jberkus commented Oct 28, 2015

Great! Will test ...

CyberDem0n pushed a commit that referenced this issue Mar 30, 2016
According to #48 'clonefrom'
tag should be boolean and it should be used to mark node as a suitable
for creation of a new replica from. If there are more then one such node
in the cluster (with tag clonefrom=true), one of them will be chosed
randomly.
@feikesteenbergen
Copy link
Contributor

It seems we still need to implement:

noloadbalance

Are there any negative (or positive) test results?

@CyberDem0n
Copy link
Collaborator

noloadbalance is implemented in #185

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants