- About MogDB Stack
- Quick Start
- Installation
- Tutorial
- Architecture
- References
- Client
- mgo
- mgo create
- mgo create mgorole
- mgo create mgouser
- mgo create cluster
- mgo show
- mgo show k8s
- mgo show mgorole
- mgo show mgouser
- mgo show cluster
- mgo show restore
- mgo delete
- mgo delete mgorole
- mgo delete mgouser
- mgo delete cluster
- mgo delete backup
- mgo delete k8s
- mgo scale
- mgo scaledown
- mgo switch
- mgo update
- mgo update mgorole
- mgo update mgouser
- mgo update cluster
- mgo version
- mgo addk8s
- mgo localk8s
- mgo backup
- mgo backup detail
- mgo restore
- mgo minio
- mgo minio object
- mgo minio object ls
- mgo minio object stat
- mgo minio object getf
- Server
- Client
- FAQ
- Release Note
Scale Out or In a MogDB Cluster
Before scaling out or in a cluster, make sure that a MogDB cluster has been installed correctly based on Create a MogDB Cluster.
There are two methods of creating a MogDB cluster, including mgo and manifest. You can choose one method on demand.
You are recommended to use mgo to create a cluster.
mgo Client
Scaling Out a MogDB Cluster
You can use the following command to scale out a cluster, such as cluster1. For details, see mgo scale.
mgo scale cluster1
Scaling In a MogDB Cluster
To scale in a MogDB cluster, you must provide the target of the instances to be scaled in. You can perform this operation using the following mgo scaledown command to perform this operation.
mgo scaledown cluster1 --query
Output:
PODNAME STATUS NODE
cluster1-rtwdz Running mogdb-k8s-002
After determining the instances to be scaled in, you can run the following command:
mgo scaledown cluster1 --target=cluster1-rtwdz
manifest
The procedure of scaling in or out a cluster using manifest is the same as that using mgo.
1. Modify manifest
Make sure that .metadata.name
and .metadata.namespace
content is consistent before and after cluster creation. You can modify .spec.replicas
to a value you expect.
apiVersion: mogdb.enmotech.io/v1
kind: MogdbCluster
...
spec:
replicas: 3
...
2. Update a Cluster
The following command updates an existing cluster.
kubectl apply -f mogdb-cluster.yaml
Output:
mogdbcluster.mogdb.enmotech.io/cluster1 configured
3. Check the Update
The following command checks whether a MogDB node is running properly.
kubectl get pod,svc -n mogdb-operator-system --selector="mogdb.enmotech.io/cluster=cluster1"
Output:
NAME READY STATUS RESTARTS AGE
pod/cluster1-nduk8 2/2 Running 0 45m
pod/cluster1-wnev6 2/2 Running 0 45m
pod/cluster1-xwnkx 2/2 Running 0 71s
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
service/cluster1-svc-master NodePort 10.96.158.193 <none> 5432:30013/TCP 44m
service/cluster1-svc-replicas NodePort 10.110.121.108 <none> 5432:30012/TCP 44m
pod/cluster1-xwnkx
indicates the newly added node.