Created
September 23, 2016 14:55
-
-
Save analytik/88115adad24ba7b0ab4e7a2f9d7dd3dc to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| r.db("rethinkdb").table("table_config") | |
| .hasFields('db', 'name') | |
| .concatMap(doc => [{ | |
| db: doc('db'), | |
| table: doc('name'), | |
| shards: doc('shards').count(), | |
| replicas: doc('shards').nth(0)('replicas').count(), | |
| }]) | |
| // this part is dumb - assuming you have 4 main servers, | |
| // and that ONLY tables with 5 total replicas have 5 replicas | |
| .filter(doc => doc('replicas').lt(5)) | |
| .forEach(doc => r.db(doc('db')).reconfigure({ | |
| shards: doc('shards'), | |
| replicas: {'main': doc('replicas'), 'ro': 1}, | |
| primary_replica_tag: 'main' | |
| })) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment