Redrock Postgres Documentation
Home Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Back to homepage

Network Attached Tablespace

Redrock Postgres supports network attached tablespaces. Based on this capability, Redrock Postgres can deploy database computing and storage separately.

Planning

Prepare the computing server and storage server environments. The recommended environment configurations are as follows:

  • Computing servers should use high processor and memory configurations.
  • The storage server should use the storage device with high I/O throughput, and the storage space must meet the data storage requirements.
  • Use high-bandwidth and low-latency networks between computing servers and storage servers.

If you need to create multiple network tablespaces on the database server, you need to prepare multiple storage servers.

Deploying Compute Server

To deploy a compute server, perform the following steps:

  1. Install the software package by referring to Redrock Postgres Installation Guide.
  2. Stop the server, if it’s running.
  3. Perform the backup, using any convenient file-system-backup tool such as tar or cpio (not pg_dump or pg_dumpall).
  4. Start the server.

Deploying Storage Server

To deploy the storage server, perform the following steps:

  1. Install the software package by referring to Redrock Postgres Installation Guide.
  2. Stop the server, if it’s running.
  3. Remove all existing files and subdirectories under the instance data directory.
  4. Restore the database files from your file system backup. Be sure that they are restored with the right ownership (the database system user, not root!) and with the right permissions.
  5. Set the listening address and port in postgresql.conf and create a storage.signal file in the instance data directory. Modify pg_hba.conf to allow connections from the compute server.
  6. Start the server.

Create a Network Attached Database

Log in to the computing server, connect to the postgres database in the database service as the database superuser, and create a network attached database. The following is a simple configuration example:

CREATE DATABASE netdb STORAGE remote LOCATION
  'host=192.168.1.50 port=5432 user=postgres password=pgpass';
In Redrock Postgres, creating a database creates a default tablespace in the database, and the newly created database in the example above produces a default network tablespace.

Create a Network Attached Tablespace

Use a database superuser to connect to the newly created database netdb in the database service to create a network attached tablespace. The following is a simple example of a configuration that creates two network attached tablespaces using two additional storage servers:

CREATE TABLESPACE netts1 STORAGE remote LOCATION
  'host=192.168.1.51 port=5432 user=postgres password=pgpass';
CREATE TABLESPACE netts2 STORAGE remote LOCATION
  'host=192.168.1.52 port=5432 user=postgres password=pgpass';

You can then use these network attached tablespaces to create tables and indexes.