Modify replica counts for RethinkDB resources

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

  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. Run the helm upgrade command to apply the new values:

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

  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 which servers to decommission.

    3. 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
      
  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