CrunchyData / crunchy-containers

Containers for Managing PostgreSQL on Kubernetes by Crunchy Data
https://www.crunchydata.com/
Apache License 2.0
1.01k stars 328 forks source link

TimescaleDB in the 5.0 Operator #1405

Closed kevinlmadison closed 2 years ago

kevinlmadison commented 2 years ago

I'm trying to launch a postgres cluster to use as a timescale db for prometheus. Following this: Crunchydata TimescaleDB Docs But I'm seeing the following when I run that first command:

psql (13.4 (Ubuntu 13.4-1.pgdg20.04+1))
SSL connection (protocol: TLSv1.3, cipher: TLS_AES_256_GCM_SHA384, bits: 256, compression: off)
Type "help" for help.

timescale=# CREATE EXTENSION timescaledb;
FATAL:  extension "timescaledb" must be preloaded
HINT:  Please preload the timescaledb library via shared_preload_libraries.

This can be done by editing the config file at: /pgdata/pg13/postgresql.conf
and adding 'timescaledb' to the list in the shared_preload_libraries config.
    # Modify postgresql.conf:
    shared_preload_libraries = 'timescaledb'

Another way to do this, if not preloading other libraries, is with the command:
    echo "shared_preload_libraries = 'timescaledb'" >> /pgdata/pg13/postgresql.conf 

(Will require a database restart.)

If you REALLY know what you are doing and would like to load the library without preloading, you can disable this check with: 
    SET timescaledb.allow_install_without_preload = 'on';
SSL connection has been closed unexpectedly
The connection to the server was lost. Attempting reset: Succeeded.
SSL connection (protocol: TLSv1.3, cipher: TLS_AES_256_GCM_SHA384, bits: 256, compression: off)

Is there away to preload that extension in the pgcluster custom resource? Do I need to make my own docker image using the crunchy postgres image as a base? I'm not really sure how I need to go about doing this.

Thank you for any help or advice.

kevinlmadison commented 2 years ago

So I found this issue Other TSDB Issue and was able to use the patroni dynamic config to get the libs preloaded but now I'm stuck where that issue leaves off.

kevinlmadison commented 2 years ago

Got this working with this:

  patroni:
    dynamicConfiguration:
      postgresql:
        parameters:
          shared_preload_libraries: timescaledb
          timescaledb.license: apache
kevinlmadison commented 2 years ago

Here are the docs on this, found them after the fact. https://access.crunchydata.com/documentation/postgres-operator/5.0.4/guides/extension-management/