Start, stop, or restart instances

This page describes how to start, stop, or restart the primary instance and a read pool instance. You can also restart a secondary instance and a node in a read pool of an AlloyDB cluster.

The start, stop, or restart operations don't change the inbound public IP or the Private Services Connect URI of the instance.

Before you begin

  • The Google Cloud project you are using must be enabled to access AlloyDB.

  • You must have one of the following IAM roles in the Google Cloud project you are using:

    • (roles/alloydb.admin) (the AlloyDB Admin predefined IAM role)
    • (roles/owner) (the Owner basic IAM role)
    • (roles/editor) (the Editor basic IAM role)

    If you don't have any of these roles, contact your Organization Administrator to request access.

  • The AlloyDB cluster is in READY state.

Activation policy

When you start or stop instance, the activation policy must be set to indicate the operation you are performing. The activation policy indicates if the instance is activated to accept connection requests.

Activation policy options are:

  • ALWAYS - The instance is always up and running.
  • NEVER- The instance is inactive and isn't accepting connections.

To start your instance, set your activation policy to ALWAYS. To stop your instance and avoid instance charges, set your activation policy to NEVER.

Stop an instance

You can manually stop a primary or read pool instance when needed. When you stop an instance, it remains stopped, and doesn't respond to application connections, until you start it again. You can't stop a secondary instance.

Stopping an instance temporarily halts automatic updates. The data stored in the cluster is unaffected and any backup configuration for the cluster remains active.

Stopped instances don't incur any compute charges associated with the instance. If public IP is enabled on the instance, then you incur idle static external IP charges.

To stop an instance:

Console

  1. In the Google Cloud console, go to the Clusters page.

    Go to Clusters

  2. Click a cluster in the Resource Name column.

  3. In the Overview page that opens, go to the Instances in your cluster section and view the details about your instance.

  4. In Stop database instance?, click Stop.

The activation policy of the instance is set to NEVER and the instance is stopped.

gcloud

To use the gcloud CLI, you can install and initialize the Google Cloud CLI, or you can use Cloud Shell.

Use the gcloud alloydb instances update command to stop an instance.

gcloud alloydb instances update INSTANCE_ID \
 --region=REGION_ID \
 --cluster=CLUSTER_ID \
 --activation-policy=NEVER
 ```
Replace the following:
  • INSTANCE_ID: The ID of the instance.
  • REGION_ID: The instance's region ID.
  • CLUSTER_ID: The ID of the instance's cluster.

Start an instance

When you start the instance, AlloyDB applies the latest minor version for the database. As starting an instance isn't a maintenance activity, any maintenance deny periods configured for the instance are ignored.

To start a stopped instance:

Console

  1. In the Google Cloud console, go to the Clusters page.

    Go to Clusters

  2. Click a cluster in the Resource Name column.

  3. In the Overview page that opens, go to the Instances in your cluster section and view the details about your instance.

  4. In Start database instance?, click Start.

The activation policy of the instance is set to ALWAYS and the instance is started.

gcloud

To use the gcloud CLI, you can install and initialize the Google Cloud CLI, or you can use Cloud Shell.

Use the gcloud alloydb instances update command to start an instance.

gcloud alloydb instances update INSTANCE_ID \
 --region=REGION_ID \
 --cluster=CLUSTER_ID \
 --activation-policy=ALWAYS
 ```
Replace the following:
  • INSTANCE_ID: The ID of the instance.
  • REGION_ID: The instance's region ID.
  • CLUSTER_ID: The ID of the instance's cluster.

Restart an instance

When you initiate a restart of an instance, it disrupts all connections that are available on the instance. After the instance restarts, and it's ready to accept new connections. Restarting an instance doesn't change the private IP address of the instance.

Restart a primary,secondary, or read pool instance

Console

  1. In the Google Cloud console, go to the Clusters page.

    Go to Clusters

  2. Click a cluster in the Resource Name column.
  3. In the Overview page, go to the Instances in your cluster section, choose the primary or a read pool instance, and click Restart.

gcloud

To use the gcloud CLI, you can install and initialize the Google Cloud CLI, or you can use Cloud Shell.

Restart the instance:

gcloud alloydb instances restart INSTANCE_ID \
    --cluster=CLUSTER_ID \
    --region=REGION_ID \
    --project=PROJECT_ID \
    [--async]
    
  • INSTANCE_ID: the ID of the instance.
  • CLUSTER_ID: the ID of the cluster where the instance is available.
  • REGION_ID: the region where the instance is placed.
  • PROJECT_ID: the ID of the project where the cluster is placed.
  • async: an optional flag to return immediately, without waiting for the operation in progress to complete.

Restart specific nodes of a read pool

You can use the gcloud CLI to restart one or more nodes of a read pool.

The following command shows how you can restart a node of a read pool:

gcloud alloydb instances restart INSTANCE_ID \
    --cluster=CLUSTER_ID \
    --region=REGION_ID \
    --node-ids=NODE_ID \
    
  • INSTANCE_ID: the ID of the readpool instance.
  • CLUSTER_ID: the ID of the cluster where the instance is available.
  • NODE_ID: the ID of the node that needs a restart, for example-j71a-read-pool-054b8861-2ln8.
  • PROJECT_ID: the ID of the project where the cluster is placed.
  • --async: an optional flag to return immediately, without waiting for the operation in progress to complete.

The following example shows how you can restart multiple nodes:

gcloud alloydb instances restart INSTANCE_ID \
    --cluster=CLUSTER_ID \
    --region=REGION_ID \
    --node-ids=NODE_ID1,NODE_ID2 \
    
  • INSTANCE_ID: the ID of the readpool instance.
  • CLUSTER_ID: the ID of the cluster where the instance is available.
  • NODE_ID1,NODE_ID2: the list of nodes that need a restart.
  • PROJECT_ID: the ID of the project where the cluster is placed.
  • --async: an optional flag to return immediately, without waiting for the operation in progress to complete.

What's next