timescaledb-docker icon indicating copy to clipboard operation
timescaledb-docker copied to clipboard

timescaledb:2.8.1-pg14 The data is not stored at `/home/postgres/pgdata/data`

Open lionants02 opened this issue 3 years ago • 3 comments

I lost my data. Fortunately, there is no key information. timescale/timescaledb:2.8.1-pg14 The data is not stored at /home/postgres/pgdata/data But data is kept at /var/lib/postgresql/data

Might have to check again. But it's definitely not at /home/postgres/pgdata/data

My compose

version: "3.4"

services:
  homeward_timescale:
    image: "timescale/timescaledb:2.8.1-pg14"
    restart: always
    ports:
      - 10335:5432 
    volumes:
      - "/data/a_med_care/timescale:/home/postgres/pgdata/data:rw" #Data lost change to /var/lib/postgresql/data
    environment:
      POSTGRES_PASSWORD: OjpvYE2hBaBYdf79SR5CygAH8O683hxxxdymmypass
      TS_TUNE_MEMORY: 2GB
      TS_TUNE_NUM_CPUS: 4
      TS_TUNE_MAX_CONNS: 150
    healthcheck:
      test: ["CMD", "pg_isready", "-U", "postgres"]
      interval: 1m30s
      timeout: 10s
      retries: 3
      start_period: 60s
    deploy:
      resources:
        limits:
          cpus: '4'
          memory: 2100M

Good luck.

lionants02 avatar Nov 03 '22 23:11 lionants02

Why did you think data was stored in /home/postgresql? Is this documented somewhere?

svenklemm avatar Dec 23 '22 05:12 svenklemm

There is an explanation on this reference page. https://docs.timescale.com/install/latest/installation-docker/ image

Why did you think data was stored in /home/postgresql? Is this documented somewhere?

lionants02 avatar Dec 24 '22 07:12 lionants02

This happened to me too. I changed from an older version of timescaledb to timescaledb-ha:pg16-all and noticed all my data has now vanished.

I found in the logs the data dir is different than what I had set:

using nss-wrapper
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.

The database cluster will be initialized with locale "C.UTF-8".
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".

Data page checksums are disabled.

fixing permissions on existing directory /home/postgres/pgdata/data ... ok
creating subdirectories ... ok
selecting dynamic shared memory implementation ... posix
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting default time zone ... Etc/UTC
creating configuration files ... ok
running bootstrap script ... ok
performing post-bootstrap initialization ... ok
syncing data to disk ... ok


Success. You can now start the database server using:

    pg_ctl -D /home/postgres/pgdata/data -l logfile start

initdb: warning: enabling "trust" authentication for local connections

This is not obvious, as there are no volume examples on the main readme.md, nor does it mention that it's using a different directory to store data. But it does mention:

This image is based on the official Postgres docker image so the documentation for that image also applies here, including the environment variables one can set, extensibility, etc.

Which threw me off the path for a while.

Slyke avatar Mar 03 '24 07:03 Slyke