Modify replica counts for RethinkDB resources¶
Note
The procedure outlined herein is not necessary if you are using the MSR Operator to install and manage your MSR deployment.
Unlike other MSR resources, modifications to RethinkDB resources require that
you scale the RethinkDB tables. Cluster scaling occurs when you alter the
replicaCount
value in the ha.yaml
file.
Add replicas to RethinkDB¶
Adjust the
replicaCount
value by creating or editing an existingha.yaml
file:Note
Refer to ha-yaml-sample for the full configuration example.
rethinkdb: cluster: replicaCount: <desired-replica-count>
Run the helm upgrade command to apply the new values:
helm upgrade msrofficial/msr –-version 1.0.0 -f ha.yaml
Monitor the addition of the RethinkDB replicas to ensure that each one has a
Running
status prior to scaling the RethinkDB tables in the cluster:kubectl get pods -l="app.kubernetes.io/component=cluster","app.kubernetes.io/name=rethinkdb"
Example output:
NAME READY STATUS RESTARTS AGE msr-rethinkdb-cluster-0 1/1 Running 0 3h19m msr-rethinkdb-cluster-1 1/1 Running 0 110s msr-rethinkdb-cluster-2 1/1 Running 0 83s
Scale the RethinkDB tables within the cluster to use the newly added replicas:
kubectl exec -it deploy/msr-api -- msr db scale
Remove replicas from RethinkDB¶
The replica removal procedure offers an example of how to scale down from three servers to one server.
Decommission the RethinkDB servers that you want to remove:
Obtain a current list of RethinkDB servers:
kubectl exec deploy/msr-api -- msr rethinkdb list
Example output:
NAME ID TAGS CACHE (MB) msr_rethinkdb_cluster_1 fa5d11f0-d47f-4a8f-895f-246271212204 default 100 msr_rethinkdb_cluster_0 b81cca8a-6584-4b9a-9c97-e9f3c86b24fd default 100 msr_rethinkdb_cluster_2 d6d29977-6ab6-4815-ab24-25519ab3339f default 100
Determine which servers to decommission.
Run msr rethinkdb decommission on the servers you want to decommission.
Note
The number of replicas will scale down from the highest number to the lowest. Thus, as the scale down in the example is from three servers to one server, the two servers with the highest numbers should be targeted for decommission.
kubectl exec deploy/msr-api -- msr rethinkdb decommission msr_rethinkdb_cluster_2 msr_rethinkdb_cluster_1
Scale down the RethinkDB tables within the cluster:
kubectl exec -it deploy/msr-api -- msr db scale
Adjust the
replicaCount
value by creating or editing an existingha.yaml
file.nginx: replicaCount: 1
Apply the new
replicaCount
values:helm upgrade msrofficial/msr –-version 1.0.0 -f ha.yaml
Monitor the removal of the cluster pods to ensure their termination:
kubectl get pods -l="app.kubernetes.io/component=cluster","app.kubernetes.io/name=rethinkdb"
Example output:
NAME READY STATUS RESTARTS AGE msr-rethinkdb-cluster-0 1/1 Running 0 3h19m msr-rethinkdb-cluster-1 1/1 Running 0 1h22m msr-rethinkdb-cluster-2 0/1 Terminating 0 1h22m