This page describes how to create a read pool instance in an AlloyDB for PostgreSQL cluster.
Before you begin
- The Google Cloud project you are using must have been enabled to access AlloyDB.
- You must have one of these 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.
Create a read pool instance
Console
In the Google Cloud console, go to the Clusters page.
Click a cluster in the Resource Name column.
Go to the Instances in your cluster section, and click Add read pool.
Configure your read pool instance:
In the Read pool instance ID field, enter an ID for the read pool instance.
In the Node count field, enter a node count.
The number of nodes in a read pool instance determines the instance's overall computing capacity.
Select one of the following machine series:
- C4A (Google Axion-based machine series) (Preview)
- N2 (x86-based machine series). This is the default machine series.
Select a machine type.
- C4A supports 1, 4, 8, 16, 32, 48, 64, and 72 machine types or shapes.
- N2 supports 2, 4, 8, 16, 32, 64, 96, and 128 machine types or shapes.
For more information about using the C4A Axion-based machine series, including the 1 vCPU machine type, see Considerations when using the C4A Axion-based machine series.
- Optional: To connect your applications and clients over the public internet, click Enable Public IP in Public IP Connectivity. Enabling public IP might require additional configuration to ensure a secure connection. For more information, see Connect using public IP.
By default, private IP is always enabled. For more information, see Enable private services access.
Optional: To enable and use managed connection pooling, check the box Enable managed connection pool under Managed connection pool. For more information, see Configure managed connection pooling.
Choose your network security settings. To keep your data secure, we recommend that you use mTLS encryption using AlloyDB connectors or SSL encryption.
When you change your security settings, your instance is available for use, but existing, noncompliant connections are dropped.
Optional: Set custom flags to your instance. For each flag, follow these steps:
- Click Advanced Configuration Options.
- Click Add a database flag.
- Select a flag from the New database flag list.
- Provide a value for the flag.
- Click Done.
Click Add read pool.
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 create
command to create a read pool instance.
gcloud alloydb instances create INSTANCE_ID \
--instance-type=READ_POOL \
--cpu-count=CPU_COUNT \
--machine-type=MACHINE_TYPE \
--read-pool-node-count=NODE_COUNT \
--region=REGION_ID \
--cluster=CLUSTER_ID \
--project=PROJECT_ID
Replace the following:
INSTANCE_ID
: The ID of the instance you are creating. It must begin with a lowercase letter and can contain lowercase letters, numbers, and hyphens.CPU_COUNT
: The number of N2 vCPUs that you want for the instance. N2 is the default. Valid values include the following:2
: 2 vCPUs, 16 GB RAM4
: 4 vCPUs, 32 GB RAM8
: 8 vCPUs, 64 GB RAM16
: 16 vCPUs, 128 GB RAM32
: 32 vCPUs, 256 GB RAM64
: 64 vCPUs, 512 GB RAM96
: 96 vCPUs, 768 GB RAM128
: 128 vCPUs, 864 GB RAM
MACHINE_TYPE
: This parameter is optional when you deploy N2 machines. To deploy the C4A Axion-based machine series (Preview), or to migrate between C4A and N2 machines, choose this parameter with the following values.When you use
MACHINE_TYPE
andCPU_COUNT
together, the values inCPU_COUNT
andMACHINE_TYPE
must match, otherwise you get an error.For the C4A Axion-based machine series, choose the machine type with following values:
c4a-highmem-1
c4a-highmem-4-lssd
c4a-highmem-8-lssd
c4a-highmem-16-lssd
c4a-highmem-32-lssd
c4a-highmem-48-lssd
c4a-highmem-64-lssd
c4a-highmem-72-lssd
To deploy C4A with 4 vCPU and higher, use the suffix
lssd
, to enable ultra fast cache.For more information about using the C4A Axion-based machine series, including the 1 vCPU machine type, see Considerations when using the C4A Axion-based machine series.
For the N2 x86-based machine series, use the following values:
N2-highmem-2
N2-highmem-4
N2-highmem-8
N2-highmem-16
N2-highmem-32
N2-highmem-64
N2-highmem-96
N2-highmem-128
NODE_COUNT
: The number of nodes in the instance. Specify a number1
through20
, inclusive. Note that you cannot have more than 20 nodes across all read pool instances in a cluster.REGION_ID
: The region where you want the instance located.CLUSTER_ID
: The ID of the cluster where you want the instance placed.PROJECT_ID
: The ID of the project where the cluster is placed.
To create a read pool instance for a
Private Service Connect-enabled cluster, add the
--allowed-psc-projects
flag to set a comma separated list of project IDs or
[project numbers](/resource-manager/docs/creating-managing-projects#identifying_projects
that you want to allow access to the instance—for example,
my-project-1
, 12345
,my-project-n
.
gcloud alloydb instances create INSTANCE_ID \
--instance-type=READ_POOL \
--cpu-count=CPU_COUNT \
--region=REGION_ID \
--cluster=CLUSTER_ID \
--project=PROJECT_ID \
--allowed-psc-projects=ALLOWED_PROJECT_LIST
Replace the following:
ALLOWED_PROJECT
(Optional): The comma separated list of project IDs or project numbers that you want to allow access to the instance—for example,my-project-1
,12345
,my-project-n
. You must set a list of allowed projects or numbers, if your cluster is using Private Service Connect as the method of connecting to the instance.
To enable managed connection pooling in your read pool instance, add the
--enable-connection-pooling
flag to the
gcloud alpha alloydb instances create
command:
gcloud alpha alloydb instances create INSTANCE_ID \
--instance-type=READ_POOL \
--cpu-count=CPU_COUNT \
--region=REGION_ID \
--cluster=CLUSTER_ID \
--project=PROJECT_ID \
--enable-connection-pooling
To create a read pool instance for a public IP-enabled cluster, add the
--assign-inbound-public-ip=ASSIGN_IPV4
parameter.
gcloud alloydb instances create INSTANCE_ID \
--instance-type=READ_POOL \
--cpu-count=CPU_COUNT \
--region=REGION_ID \
--cluster=CLUSTER_ID \
--project=PROJECT_ID \
--assign-inbound-public-ip=ASSIGN_IPV4
Optionally, you can pass the comma separated list of CIDR blocks, such as
64.233.160.0/16
to the --authorized-external-networks
parameter to set
authorized external networks on your instance.