---
title: "Gateway HUB - How to recreate Postgress database in one of the nodes"
description: "Recreating the Postgres database on a faulty Gateway HUB node involves stopping the Hub, copying data from a healthy node, and restarting services. The process includes tarballing database files, manual Postgres start and stop, and finally restarting the Hub normally."
url: "https://docs.itrsgroup.com/docs/faq/geneos/7799327093789-gateway-hub-how-to-recreate-postgress-database-in-one-of-the-nodes/index.html"
---
## The steps to follow in order to restore data on the faulty node

1. Stop the Hub on all nodes:

    - If systemd is managing the Hub:

    ```shell
    sudo systemctl mask hub-orchestration
    sudo systemctl stop hub-orchestration
    ```

    - or run `/opt/hub/current/bin/hub.sh stop` on each node

2. Ensure that the Hub is stopped on each node. First run `/opt/hub/latest/bin/hub.sh status` then check that Postgres is effectively stopped: `ps -edf|grep postgres:`

3. On one healthy node, make a tarball of `/opt/hub/postgres` and a tarball of `/opt/hub/pgwal` and copy across to node

4. On the faulty node, rename /opt/hub/postgres to `/opt/hub/postgres.<timestamp>` and `/opt/hub/pgwal` to `/opt/hub/pgwal.<timestamp>.`

5. On the faulty node, unzip the tarballs copied from healthy node so that you end up with `/opt/hub/postgres` and `/opt/hub/pgwal`

6. On the faulty node, start Postgres manually by running `/opt/hub/latest/services/postgres-timescale-12.6-1.7.4/start.sh` and wait until you see the following in the logs:

    ```log
    LOG:  database system is ready to accept connections
    LOG:  TimescaleDB background worker launcher connected to shared catalogs
    ```

7. On the faulty node, stop Postgres using a Ctrl-C

8. Restart the Hub normally using `hubctl` or systemd.


