Set up multi-node on self-hosted TimescaleDB

Create multi-node databases in seconds with Timescale Cloud

Timescale Cloud saves you the manual work associated with setting up and maintaining a multi-node instance of TimescaleDB. You can create, configure and deploy your multi-node instance in just a few clicks. To test it out yourself, start a free Timescale Cloud trial and select “multi-node” when creating your service.

To set up multi-node on a self-hosted TimescaleDB instance, you need:

  • A PostgreSQL instance to act as an access node (AN)
  • One or more PostgreSQL instances to act as data nodes (DN)
  • TimescaleDB installed and set up on all nodes
  • Access to a superuser role, such as postgres, on all nodes

The access and data nodes must begin as individual TimescaleDB instances. They should be hosts with a running PostgreSQL server and a loaded TimescaleDB extension. For more information about installing self-hosted TimescaleDB instances, see the installation instructions. Additionally, you can configure high availability with multi-node to increase redundancy and resilience.

The multi-node TimescaleDB architecture consists of an access node (AN) which stores metadata for the distributed hypertable and performs query planning across the cluster, and a set of data nodes (DNs) which store subsets of the distributed hypertable dataset and execute queries locally. For more information about the multi-node architecture, see about multi-node.

If you intend to use continuous aggregates in your multi-node environment, check the additional considerations in the continuous aggregates section.

Set up multi-node on self-hosted TimescaleDB

When you have installed TimescaleDB on the access node and as many data nodes as you require, you can set up multi-node and create a distributed hypertable.

note

Before you begin, make sure you have considered what partitioning method you want to use for your multi-node cluster. For more information about multi-node and architecture, see the About multi-node section.

Setting up multi-node on self-hosted TimescaleDB

  1. On the access node (AN), run this command and provide the hostname of the first data node (DN1) you want to add:

    1. SELECT add_data_node('dn1', 'dn1.example.com')
  2. Repeat for all other data nodes:

    1. SELECT add_data_node('dn2', 'dn2.example.com')
    2. SELECT add_data_node('dn3', 'dn3.example.com')
  3. On the access node, create the distributed hypertable with your chosen partitioning. In this example, the distributed hypertable is called example, and it is partitioned on time and location:

    1. SELECT create_distributed_hypertable('example', 'time', 'location');
  4. Insert some data into the hypertable. For example:

    1. INSERT INTO example VALUES ('2020-12-14 13:45', 1, '1.2.3.4');

When you have set up your multi-node installation, you can configure your cluster. For more information, see the configuration section.