timescaledb-docker: Using docker timescale/timescaledb image, 'CREATE EXTENSION IF NOT EXISTS timescaledb CASCADE;' fails as it is not preloaded

Seems prebuilt images are misconfigured, trying to create the timescaledb extension fails because the premade docker images do not have the library preloaded in their config.

Error: 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: /var/lib/postgresql/data/pgdata/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'" >> /var/lib/postgresql/data/pgdata/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';
SQLState:  XX000
ErrorCode: 0
Error: An I/O error occurred while sending to the backend.
SQLState:  08006
ErrorCode: 0

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 31 (10 by maintainers)

Most upvoted comments

I’m totally new to TimescaleDB but trying to run the Docker version seems to end the same way as described above:

docker run --rm --name timescaledb2 -p 5432:5432 -e POSTGRES_PASSWORD=password timescale/timescaledb:latest-pg12
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 "en_US.utf8".
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 /var/lib/postgresql/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 ... UTC
creating configuration files ... ok
running bootstrap script ... ok
performing post-bootstrap initialization ... sh: locale: not found
2020-06-05 18:24:06.914 UTC [29] WARNING:  no usable system locales were found
ok
syncing data to disk ... initdb: warning: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the option -A, or
--auth-local and --auth-host, the next time you run initdb.
ok


Success. You can now start the database server using:

    pg_ctl -D /var/lib/postgresql/data -l logfile start

waiting for server to start....2020-06-05 18:24:07.490 UTC [34] LOG:  starting PostgreSQL 12.3 on x86_64-pc-linux-musl, compiled by gcc (Alpine 9.2.0) 9.2.0, 64-bit
2020-06-05 18:24:07.493 UTC [34] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2020-06-05 18:24:07.516 UTC [35] LOG:  database system was shut down at 2020-06-05 18:24:07 UTC
2020-06-05 18:24:07.521 UTC [34] LOG:  database system is ready to accept connections
2020-06-05 18:24:07.523 UTC [41] LOG:  TimescaleDB background worker launcher connected to shared catalogs
 done
server started

/usr/local/bin/docker-entrypoint.sh: sourcing /docker-entrypoint-initdb.d/000_install_timescaledb.sh
2020-06-05 18:24:07.844 UTC [45] WARNING:  
	WELCOME TO
	 _____ _                               _     ____________  
	|_   _(_)                             | |    |  _  \ ___ \ 
	  | |  _ _ __ ___   ___  ___  ___ __ _| | ___| | | | |_/ / 
	  | | | |  _ ` _ \ / _ \/ __|/ __/ _` | |/ _ \ | | | ___ \ 
	  | | | | | | | | |  __/\__ \ (_| (_| | |  __/ |/ /| |_/ /
	  |_| |_|_| |_| |_|\___||___/\___\__,_|_|\___|___/ \____/
	               Running version 1.7.1
	For more information on TimescaleDB, please visit the following links:
	
	 1. Getting started: https://docs.timescale.com/getting-started
	 2. API reference documentation: https://docs.timescale.com/api
	 3. How TimescaleDB is designed: https://docs.timescale.com/introduction/architecture
	
	Note: TimescaleDB collects anonymous reports to better understand and assist our users.
	For more information and how to disable, please see our docs https://docs.timescaledb.com/using-timescaledb/telemetry.
	
2020-06-05 18:24:07.844 UTC [45] CONTEXT:  PL/pgSQL function inline_code_block line 23 at RAISE
WARNING:  
WELCOME TO
 _____ _                               _     ____________  
|_   _(_)                             | |    |  _  \ ___ \ 
  | |  _ _ __ ___   ___  ___  ___ __ _| | ___| | | | |_/ / 
  | | | |  _ ` _ \ / _ \/ __|/ __/ _` | |/ _ \ | | | ___ \ 
  | | | | | | | | |  __/\__ \ (_| (_| | |  __/ |/ /| |_/ /
  |_| |_|_| |_| |_|\___||___/\___\__,_|_|\___|___/ \____/
               Running version 1.7.1
For more information on TimescaleDB, please visit the following links:

 1. Getting started: https://docs.timescale.com/getting-started
 2. API reference documentation: https://docs.timescale.com/api
 3. How TimescaleDB is designed: https://docs.timescale.com/introduction/architecture

Note: TimescaleDB collects anonymous reports to better understand and assist our users.
For more information and how to disable, please see our docs https://docs.timescaledb.com/using-timescaledb/telemetry.

CREATE EXTENSION
2020-06-05 18:24:08.138 UTC [48] WARNING:  
	WELCOME TO
	 _____ _                               _     ____________  
	|_   _(_)                             | |    |  _  \ ___ \ 
	  | |  _ _ __ ___   ___  ___  ___ __ _| | ___| | | | |_/ / 
	  | | | |  _ ` _ \ / _ \/ __|/ __/ _` | |/ _ \ | | | ___ \ 
	  | | | | | | | | |  __/\__ \ (_| (_| | |  __/ |/ /| |_/ /
	  |_| |_|_| |_| |_|\___||___/\___\__,_|_|\___|___/ \____/
	               Running version 1.7.1
	For more information on TimescaleDB, please visit the following links:
	
	 1. Getting started: https://docs.timescale.com/getting-started
	 2. API reference documentation: https://docs.timescale.com/api
	 3. How TimescaleDB is designed: https://docs.timescale.com/introduction/architecture
	
	Note: TimescaleDB collects anonymous reports to better understand and assist our users.
	For more information and how to disable, please see our docs https://docs.timescaledb.com/using-timescaledb/telemetry.
	
2020-06-05 18:24:08.138 UTC [48] CONTEXT:  PL/pgSQL function inline_code_block line 23 at RAISE
WARNING:  
WELCOME TO
 _____ _                               _     ____________  
|_   _(_)                             | |    |  _  \ ___ \ 
  | |  _ _ __ ___   ___  ___  ___ __ _| | ___| | | | |_/ / 
  | | | |  _ ` _ \ / _ \/ __|/ __/ _` | |/ _ \ | | | ___ \ 
  | | | | | | | | |  __/\__ \ (_| (_| | |  __/ |/ /| |_/ /
  |_| |_|_| |_| |_|\___||___/\___\__,_|_|\___|___/ \____/
               Running version 1.7.1
For more information on TimescaleDB, please visit the following links:

 1. Getting started: https://docs.timescale.com/getting-started
 2. API reference documentation: https://docs.timescale.com/api
 3. How TimescaleDB is designed: https://docs.timescale.com/introduction/architecture

Note: TimescaleDB collects anonymous reports to better understand and assist our users.
For more information and how to disable, please see our docs https://docs.timescaledb.com/using-timescaledb/telemetry.

2020-06-05 18:24:08.142 UTC [49] WARNING:  telemetry could not connect to "telemetry.timescale.com"
2020-06-05 18:24:08.142 UTC [49] DETAIL:  SSL error want read
2020-06-05 18:24:08.142 UTC [50] ERROR:  TimescaleDB background worker connected to template database, exiting
CREATE EXTENSION

/usr/local/bin/docker-entrypoint.sh: sourcing /docker-entrypoint-initdb.d/001_reenable_auth.sh
2020-06-05 18:24:08.143 UTC [34] LOG:  background worker "TimescaleDB Background Worker Scheduler" (PID 50) exited with exit code 1

/usr/local/bin/docker-entrypoint.sh: running /docker-entrypoint-initdb.d/002_timescaledb_tune.sh
Using postgresql.conf at this path:
/var/lib/postgresql/data/postgresql.conf

Writing backup to:
/tmp/timescaledb_tune.backup202006051824

Recommendations based on 15.35 GB of available memory and 8 CPUs for PostgreSQL 12
shared_buffers = 3929MB
effective_cache_size = 11789MB
maintenance_work_mem = 1964MB
work_mem = 5030kB
timescaledb.max_background_workers = 8
max_worker_processes = 19
max_parallel_workers_per_gather = 4
max_parallel_workers = 8
wal_buffers = 16MB
min_wal_size = 512MB
default_statistics_target = 500
random_page_cost = 1.1
checkpoint_completion_target = 0.9
max_locks_per_transaction = 128
autovacuum_max_workers = 10
autovacuum_naptime = 10
effective_io_concurrency = 200
timescaledb.last_tuned = '2020-06-05T18:24:08Z'
timescaledb.last_tuned_version = '0.8.1'
Saving changes to: /var/lib/postgresql/data/postgresql.conf

waiting for server to shut down....2020-06-05 18:24:08.162 UTC [34] LOG:  received fast shutdown request
2020-06-05 18:24:08.165 UTC [34] LOG:  aborting any active transactions
2020-06-05 18:24:08.165 UTC [46] LOG:  terminating TimescaleDB job scheduler due to administrator command
2020-06-05 18:24:08.165 UTC [68] FATAL:  terminating autovacuum process due to administrator command
2020-06-05 18:24:08.165 UTC [46] FATAL:  terminating connection due to administrator command
2020-06-05 18:24:08.165 UTC [34] LOG:  background worker "logical replication launcher" (PID 42) exited with exit code 1
2020-06-05 18:24:08.165 UTC [41] LOG:  terminating TimescaleDB background worker launcher due to administrator command
2020-06-05 18:24:08.165 UTC [41] FATAL:  terminating connection due to administrator command
2020-06-05 18:24:08.166 UTC [34] LOG:  background worker "TimescaleDB Background Worker Launcher" (PID 41) exited with exit code 1
2020-06-05 18:24:08.166 UTC [34] LOG:  background worker "TimescaleDB Background Worker Scheduler" (PID 46) exited with exit code 1
2020-06-05 18:24:08.166 UTC [36] LOG:  shutting down
2020-06-05 18:24:08.263 UTC [34] LOG:  database system is shut down
 done
server stopped

PostgreSQL init process complete; ready for start up.

2020-06-05 18:24:08.392 UTC [1] LOG:  starting PostgreSQL 12.3 on x86_64-pc-linux-musl, compiled by gcc (Alpine 9.2.0) 9.2.0, 64-bit
2020-06-05 18:24:08.394 UTC [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
2020-06-05 18:24:08.394 UTC [1] LOG:  listening on IPv6 address "::", port 5432
2020-06-05 18:24:08.401 UTC [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2020-06-05 18:24:08.481 UTC [70] LOG:  database system was shut down at 2020-06-05 18:24:08 UTC
2020-06-05 18:24:08.493 UTC [1] LOG:  database system is ready to accept connections
2020-06-05 18:24:08.497 UTC [76] LOG:  TimescaleDB background worker launcher connected to shared catalogs
^C2020-06-05 18:24:11.600 UTC [1] LOG:  received fast shutdown request
2020-06-05 18:24:11.602 UTC [1] LOG:  aborting any active transactions
2020-06-05 18:24:11.602 UTC [76] LOG:  terminating TimescaleDB background worker launcher due to administrator command
2020-06-05 18:24:11.602 UTC [78] LOG:  terminating TimescaleDB job scheduler due to administrator command
2020-06-05 18:24:11.602 UTC [76] FATAL:  terminating connection due to administrator command
2020-06-05 18:24:11.602 UTC [78] FATAL:  terminating connection due to administrator command
2020-06-05 18:24:11.602 UTC [78] LOG:  terminating TimescaleDB job scheduler due to administrator command
2020-06-05 18:24:11.603 UTC [1] LOG:  background worker "logical replication launcher" (PID 77) exited with exit code 1
2020-06-05 18:24:11.603 UTC [1] LOG:  background worker "TimescaleDB Background Worker Launcher" (PID 76) exited with exit code 1
2020-06-05 18:24:11.604 UTC [1] LOG:  background worker "TimescaleDB Background Worker Scheduler" (PID 78) exited with exit code 1

@akuzm I get the similar logs to you and @mingan above. The database seems functional, but is the following ERROR log considered normal?

2021-10-28 09:26:25.322 UTC [58] ERROR:  TimescaleDB background worker connected to template database, exiting
CREATE EXTENSION

Safe to ignore, but we could probably improve it. I created an issue: https://github.com/timescale/timescaledb-docker/issues/170

so the problem is

2020-04-03 11:44:34.866 UTC [49] LOG:  received fast shutdown request
waiting for server to shut down ... failed
pg_ctl: server does not shut down

What could it possibly be?

No worries, hopefully that works for @DanielJoyce too. We’ll work on documenting or improving that flow