Create an asynchronous read pool instance in Kubernetes

To increase read throughput and availability of your database cluster, you can create an asynchronous read pool instance of your database instance. A read pool instance provides a read-only clone of your database instance ensuring data access even if your database instance becomes unavailable.

You can define the read pool instance configuration in the database instance's manifest file. Each read pool instance requires creating a unique manifest file. You can create up to 20 read pool instances.

Each read pool instance occupies the same amount of storage as the instance it replicates.

Create an asynchronous read pool instance

You can create any number of read pool instances in your database cluster. To create an AlloyDB Omni asynchronous read pool instance, complete the following steps:

  1. Create the database instance manifest to define the read pool instance type:

    apiVersion: alloydbomni.dbadmin.goog/v1
    kind: DBInstance
    metadata:
      name: READ_POOL_INSTANCE_NAME
      namespace: NAMESPACE
    spec:
      instanceType: ReadPool
      nodeCount: READ_POOL_INSTANCE_SIZE
      dbcParent:
        name: DB_CLUSTER_NAME
    

    Replace the following:

    • READ_POOL_INSTANCE_NAME: a name for this resource—for example, read-pool-instance-1.

    • NAMESPACE: the namespace of the database cluster.

    • DB_CLUSTER_NAME: the name of the database cluster to which the instance belongs.

    • READ_POOL_INSTANCE_SIZE: the number of nodes in a read pool instance. This determines the instance's overall computing capacity. You can have a maximum of 20 nodes per read pool instance.

  2. Apply the manifest.

Verify instance status

To verify the availability of the read pool instance, run the following command:

  kubectl get dbinstance -n NAMESPACE READ_POOL_INSTANCE_NAME -o jsonpath='{.status.conditions[?(@.type=="Available")].status}'

The response true indicates that the read pool instance can serve queries, but might not be replicating data from your database instance.

To verify the streaming status of the read pool instance, run the following command:

  kubectl get dbinstance -n NAMESPACE READ_POOL_INSTANCE_NAME -o jsonpath='{.status.conditions[?(@.type=="Streaming")].status}'

The response true indicates that the read pool instance is connected to your database instance and actively streaming changes.

When your database instance is unreachable, the read pool instance continues to serve the queries. In this case, the availability status will be true while the streaming status will be false.

After you set up the read pool instance, all inserts, updates, and deletions to rows in your instance become readable on your read pool instance.