Read-only replicas enable you to perform read-only queries against the replica and reduce the load on the primary server. It is also a good way to optimize query response times across different geographical locations, because the replica can be placed in different regions or even different cloud providers.

Before you begin, make sure you have:

  • Created a service in your Managed Service for TimescaleDB account.
  • Installed Aiven Client.
  1. In the Aiven client, connect to your Managed Service for TimescaleDB service.

  2. Switch to the project that contains the TimescaleDB service you want to create a read-only replica for:

    avn project switch <PROJECT>
  3. List the services in the project, and make a note of the service that you want to create a read-only replica for. It is listed under theSERVICE_NAME column in the output:

    avn service list
  4. Get the details of the service that you want to fork:

    avn service get <SERVICE_NAME>
  5. Create a read-only replica:

    avn service create <NAME_OF_REPLICA> --project <PROJECT_ID>\
    -t pg --plan <PLAN_TYPE> --cloud timescale-aws-us-east-1\
    -c pg_read_replica=true\
    -c service_to_fork_from=<NAME_OF_SERVICE_TO_FORK>\
    -c pg_version=11 -c variant=timescale

To create a fork named replica-fork for a service named timescaledb with these parameters:

  • PROJECT_ID: fork-project
  • CLOUD_NAME: timescale-aws-us-east-1
  • PLAN_TYPE: timescale-basic-100-compute-optimized
avn service create replica-fork --project fork-project\
-t pg --plan timescale-basic-100-compute-optimized\
--cloud timescale-aws-us-east-1 -c pg_read_replica=true\
-c service_to_fork_from=timescaledb -c\
pg_version=11 -c variant=timescale

You can switch to project-fork and view the newly created replica-fork using:

avn service list

Found an issue on this page?

Report an issue!