So, I built the PostgreSQL with citus extension in docker. I use the official documentation in citus, then I run this command in the terminal.
docker run -d -v /root/volumes/citus-data:/data --network citus-network --name citus_coordinator -p 5500:5432 -e POSTGRES_PASSWORD=mypassword citusdata/citus:11.1
Then Database successfully building.
But I want to create the pg_stat_statements
extension.
I configuration the postgresql.conf
file.
shared_preload_libraries = 'pg_stat_statements'
pg_stat_statements.track = all
pg_stat_statements.max = 10000
track_activity_query_size = 2048
Then I restarted the PostgreSQL container. Wrote the this query
SELECT * FROM pg_stat_statements;
in terminal. I saw this error
[55000] ERROR: pg_stat_statements must be loaded via shared_preload_libraries
I didn't understand, why the config file didn't see this extension, What was my mistake?
Solved
I am running the PostgreSQL container with postgres:latest image.
Then I entered the container.
So, I installed the citus from here into the container.
Then installed apt-get install postgresql-contrib
into the container.Next step, run create extension pg_stat_statements;
And everything worked for me.
-
I don't see you defining a persistent volume mapping in your docker command; without persistent storage, whatever you change inside a container will disappear upon restart.mustaccio– mustaccio2022年10月13日 13:00:33 +00:00Commented Oct 13, 2022 at 13:00
-
@mustaccio oh sorry , I editin the postGismat Gusein– Gismat Gusein2022年10月14日 07:00:53 +00:00Commented Oct 14, 2022 at 7:00
-
@GismatHusein you can put the "solved" part in an answer (and remove it from the question).ypercubeᵀᴹ– ypercubeᵀᴹ2022年10月17日 12:54:41 +00:00Commented Oct 17, 2022 at 12:54
2 Answers 2
Both citus
and pg_stat_statements
should be present in shared_preload_libraries
: shared_preload_libraries = 'citus, pg_stat_statements'
-
1I have the same issue again.Gismat Gusein– Gismat Gusein2022年10月13日 12:35:13 +00:00Commented Oct 13, 2022 at 12:35
You have to restart the Postgresql Server in order to load the shared library
and afterwards execute
CREATE EXTENSION pg_stat_statements;
Before you can use it.
-
I do it. But I see the same error.
pg_stat_statements must be loaded via shared_preload_libraries
Gismat Gusein– Gismat Gusein2022年10月13日 10:14:04 +00:00Commented Oct 13, 2022 at 10:14
Explore related questions
See similar questions with these tags.