Add nodes to the cluster
IMPORTANT: These steps assume that you have already installed the Google Cloud SDK and you are signed in to the Google Cloud Platform through the gcloud command-line client. If this is not the case, please refer to the Google Cloud SDK documentation for instructions on how to install and use the command-line client.
To add nodes to the cluster, follow these steps:
-
Log in to the Google Cloud Console.
-
Browse to the Deployment Manager and select the deployment to which you wish to add nodes.
-
In the deployment overview, review the deployment properties and click to view the “Expanded Config” deployment configuration file.
-
Copy or download the contents of the “Expanded Config” file to the server with the Google Cloud SDK as expanded-config.yaml.
-
Edit the file using a text editor and add configuration for one or more additional nodes, by copying the configuration and metadata for an existing node and its corresponding data disk and then updating the copied configuration to use a unique name for the new node(s) and data disk(s).
For example, to add a new MongoDB node to a MongoDB cluster, here is an abridged example of the configuration and metadata that you would update to add a new node and data disk. To create a unique name for the new node, you would typically replace the XX placeholder in the node name with a number.
NOTE: The code block below is an illustrative example for MongoDB and will differ in your specific deployment. You should always copy the code block from your deployment’s actual configuration file.
- metadata: dependsOn: - mongodb-multivm-2-node-XX-data - mongodb-multivm-2-node-0 name: mongodb-multivm-2-node-XX properties: bootDiskType: pd-standard canIpForward: true disks: - autoDelete: true boot: true deviceName: mongodb-multivm-2-node-XX-boot initializeParams: diskType: https://www.googleapis.com/compute/v1/projects/PROJECT-NAME/zones/us-central1-f/diskTypes/pd-standard sourceImage: projects/bitnami-launchpad/global/images/bitnami-mongodb-3-4-7-0-linux-debian-8-x86-64-nami type: PERSISTENT - autoDelete: true boot: false deviceName: mongodb-multivm-2-node-XX-data source: $(ref.mongodb-multivm-2-node-XX-data.selfLink) type: PERSISTENT machineType: https://www.googleapis.com/compute/v1/projects/PROJECT-NAME/zones/us-central1-f/machineTypes/n1-standard-1 metadata: ... networkInterfaces: - accessConfigs: - name: External NAT type: ONE_TO_ONE_NAT network: https://www.googleapis.com/compute/v1/projects/PROJECT-NAME/global/networks/default subnetwork: https://www.googleapis.com/compute/v1/projects/PROJECT-NAME/regions/us-central1/subnetworks/default serviceAccounts: - email: default scopes: - https://www.googleapis.com/auth/cloudruntimeconfig tags: items: - mongodb-multivm-2-node-XX zone: us-central1-f type: compute.v1.instance - name: mongodb-multivm-2-node-XX-data properties: sizeGb: 10 type: https://www.googleapis.com/compute/v1/projects/PROJECT-NAME/zones/us-central1-f/diskTypes/pd-standard zone: us-central1-f type: compute.v1.disk
-
Preview the updated deployment with the command below. Replace the DEPLOYMENT-ID placeholder in the command below with the correct name of your deployment.
$ gcloud deployment-manager deployments update DEPLOYMENT-ID --config expanded-config.yaml --preview
-
Once you have verified that the deployment preview is correct, confirm the deployment and initialize the new node(s):
$ gcloud deployment-manager deployments update DEPLOYMENT-ID