google-templatescassandra

Add nodes to the Cassandra 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 database 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.

    Expanded configuration

  • 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 and add configuration for one or more additional nodes, by copying the configuration and metadata for an existing node and its corresponding data disk. Then updating the copied configuration to use a unique name for the new node(s) and data disk(s).

    To add a new Cassandra node to a Cassandra 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. Remember to replace the PROJECT_NAME plaeholder with your actual project too.

    NOTE: The code block below is an illustrative example and may differ in your specific deployment. You should always copy the code block from your deployment’s current configuration file.

          - metadata:
              dependsOn:
              - cassandra-multivm-node-0
              - cassandra-multivm-node-XX
          name: cassandra-multivm-software
          properties:
              failure:
              cardinality:
                  number: 1
                  path: status/failure
              parent: $(ref.cassandra-multivm-config.name)
              success:
              cardinality:
                  number: 3
                  path: status/success
              timeout: 480s
              waiter: software
          type: runtimeconfig.v1beta1.waiter
          - name: cassandra-multivm-node-XX
          properties:
              bootDiskType: pd-standard
              canIpForward: true
              disks:
              - autoDelete: true
              boot: true
              deviceName: cassandra-multivm-node-XX-boot
              initializeParams:
                  diskType: https://www.googleapis.com/compute/v1/projects/PROJECT_NAME/zones/us-central1-f/diskTypes/pd-standard
                  sourceImage: projects/PROJECT_NAME/global/images/cassandraimage
              type: PERSISTENT
              - autoDelete: true
              boot: false
              deviceName: cassandra-multivm-node-XX-data
              source: $(ref.cassandra-multivm-node-XX-data.selfLink)
              type: PERSISTENT
              ...
              networkInterfaces:
              - accessConfigs:
              - name: External NAT
                  type: ONE_TO_ONE_NAT
              network: https://www.googleapis.com/compute/v1/projects/PROJECT_NAME/global/networks/default
              serviceAccounts:
              - email: default
              scopes:
              - https://www.googleapis.com/auth/cloudruntimeconfig
              tags:
              items:
              - cassandra-multivm-node-XX
              zone: us-central1-f
          type: compute.v1.instance
          metadata:
              dependsOn:
              - cassandra-multivm-node-XX-data
          - name: cassandra-multivm-node-XX-data
          properties:
              sizeGb: 80B
              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
          - name: cassandra-multivm-node-XX-firewall
          properties:
              allowed:
              - IPProtocol: TCP
              ports:
              - 22
              network: https://www.googleapis.com/compute/v1/projects/PROJECT_NAME/global/networks/default
              ...
    
  • 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
    
Last modification September 5, 2018