skip to Main Content

The postgresql.conf file found in /var/lib/postgresql/data is all commented (I checked)
like this:

enter image description here

but when I try to get some configurations using: SELECT current_setting('autovacuum')

enter image description here

why is that? Can I edit the file or there is another file on the TimescaleDB plugin?

2

Answers


  1. This is the regular behavior as every configuration has already a default. To override some specific behavior, you’ll need to mount your config file.

    If you’re just testing a configuration, you can join the container via bash:

    docker exec -it your-timescale-container bash
    

    Then, you can restart the service:

    service postgresql restart
    

    If you want to sync a configuration from your machine, use the following:

    To set the PostgreSQL configuration when using the TimescaleDB-HA Docker image, you can follow these steps:

    Create a new directory on your host machine to store the PostgreSQL configuration file. For example, you can create a directory named pg_conf in your home directory:

    mkdir ~/pg_conf
    

    Copy your postgresql.conf file to the pg_conf directory.

    Start the timescaledb-ha container and mount the pg_conf directory to the container. You can use the -v option to mount the directory as a volume. For example:

    docker run --name my-timescaledb-ha -v ~/pg_conf:/etc/postgresql/postgresql.conf.d -p 5432:5432 -e POSTGRES_PASSWORD=mysecretpassword timescale/timescaledb-ha
    

    This command will start a new TimescaleDB-HA container named my-timescaledb-ha and mount the pg_conf directory on the host machine to the /etc/postgresql/postgresql.conf.d directory inside the container.

    Your PostgreSQL configuration should now be applied inside the container. You can confirm this by checking the postgresql.conf file inside the container:

    docker exec -it my-timescaledb-ha cat /etc/postgresql/postgresql.conf.d/postgresql.conf
    

    This command will display the contents of the postgresql.conf file inside the container.

    That’s it! You can now start and stop the container as needed, and your PostgreSQL configuration will persist across container restarts.

    Login or Signup to reply.
  2. The PostgreSQL configuration file postgresql.conf contains default settings and user-defined settings for the PostgreSQL server. If a setting is commented out, it means that the default value for that particular setting is being used.

    Still, the fact that is commented is strange, check it thoroughly.

    In your case, all the lines in the postgresql.conf file are commented, which means PostgreSQL is using the default settings for all configurations. The default value for autovacuum is true, so even if it’s commented out in the postgresql.conf file, the server will still have autovacuum enabled by default.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search