Modify replica counts for RethinkDB resources

Unlike other MSR resources, modifications to RethinkDB resources require that you scale the RethinkDB tables. The scaling of the cluster occurs when you alter the replicaCount value in the ha.yaml file.

Add replicas to RethinkDB

  1. Adjust the replicaCount value by creating or editing an existing ha.yaml file:

    Note

    Refer to The ha.yaml file sample for the full configuration example.

    rethinkdb:
    cluster:
       replicaCount: <desired-replica-count>
    
  2. To apply the new values, run helm upgrade:

    helm upgrade msrofficial/msr –-version 1.0.0 -f ha.yaml
    
  3. Monitor the addition of the RethinkDB replicas to ensure that each replica has the Running status before you continue.

    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
    
  4. Use the MSR CLI to 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

As an example, the replica removal procedure illustrates how to scale down from three servers to one server.

  1. Decommission the RethinkDB servers that you want to remove:

    1. 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
      
    2. Determine the servers to decommission. Be aware that the number of replicas will scale down from the highest number to the lowest.

    3. Run msr rethinkdb decommission on the servers to be decommissioned. 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
      
  2. Scale down the RethinkDB tables within the cluster:

    kubectl exec -it deploy/msr-api -- msr db scale
    
  3. Adjust the replicaCount value by creating or editing an existing ha.yaml file.

    nginx:
      replicaCount: 1
    
  4. Apply the new replicaCount values:

    helm upgrade msrofficial/msr –-version 1.0.0 -f ha.yaml
    
  5. 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