我正在使用官方的Postgres泊坞窗图片,并且我已经添加了一个shell脚本,该脚本应该在启动服务器之前加载备份(请按照'如何扩展此图像' 39;在this page上
我的加载备份脚本如下:
gosu postgres pg_ctl start -w -D /var/lib/postgresql/data
gosu postgres psql -d postgres -f /dump/dump.sql
gosu postgres pg_ctl stop -w -D /var/lib/postgresql/data
然后Postgres图像自动调用postgres
以启动服务器实时。
从我的日志中我知道psql和postgres命令都运行良好,但当我进入psql(docker exec -it CONTAINER_ID psql -U postgres
),我\c
进入正确的数据库并\dt
列出关系,什么都没有!
为什么会发生这种情况?
我确实收到了以下错误(由docker logs CONTAINER_ID | grep "^[A-Z]*:\s"
找到),但我不知道该怎么做。某些功能或扩展是否存在无关紧要?在这种情况下,我没有使用它们:
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.
****************************************************
WARNING: No password has been set for the database.
This will allow anyone with access to the
Postgres port to access your database. In
Docker's default configuration, this is
effectively any other container on the same
system.
Use "-e POSTGRES_PASSWORD=password" to set
it in "docker run".
****************************************************
psql:/dump/dump.sql:94: ERROR: could not open extension control file "/usr/shar
e/postgresql/9.4/extension/plpython3u.control": No such file or directory
psql:/dump/dump.sql:101: ERROR: extension "plpython3u" does not exist
LOG: database system is ready to accept connections
LOG: autovacuum launcher started
ERROR: could not open extension control file "/usr/share/postgresql/9.4/extensi
on/plpython3u.control": No such file or directory
STATEMENT: CREATE EXTENSION IF NOT EXISTS plpython3u WITH SCHEMA pg_catalog;
ERROR: extension "plpython3u" does not exist
STATEMENT: COMMENT ON EXTENSION plpython3u IS 'PL/Python3U untrusted procedural
language';
ERROR: language "plpython3u" does not exist
psql:/dump/dump.sql:331: ERROR: language "plpython3u" does not exist
HINT: Use CREATE LANGUAGE to load the language into the database.
psql:/dump/dump.sql:334: ERROR: function cuffdiff_metadata.load_all_cuffdiff_me
tadata(text) does not exist
HINT: Use CREATE LANGUAGE to load the language into the database.
STATEMENT: CREATE FUNCTION load_all_cuffdiff_metadata(rna_seq_root text) RETURN
S void
ERROR: function cuffdiff_metadata.load_all_cuffdiff_metadata(text) does not exi
st
STATEMENT: ALTER FUNCTION cuffdiff_metadata.load_all_cuffdiff_metadata(rna_seq_
root text) OWNER TO postgres;
ERROR: language "plpython3u" does not exist
HINT: Use CREATE LANGUAGE to load the language into the database.
STATEMENT: CREATE FUNCTION filter_methylation(file_name text) RETURNS void
psql:/dump/dump.sql:701: ERROR: language "plpython3u" does not exist
HINT: Use CREATE LANGUAGE to load the language into the database.
psql:/dump/dump.sql:704: ERROR: function methylation.filter_methylation(text) d
oes not exist
psql:/dump/dump.sql:897: ERROR: language "plpython3u" does not exist
HINT: Use CREATE LANGUAGE to load the language into the database.
psql:/dump/dump.sql:900: ERROR: function public.debug(text) does not exist
ERROR: function methylation.filter_methylation(text) does not exist
STATEMENT: ALTER FUNCTION methylation.filter_methylation(file_name text) OWNER
TO postgres;
ERROR: language "plpython3u" does not exist
HINT: Use CREATE LANGUAGE to load the language into the database.
STATEMENT: CREATE FUNCTION debug(msg text) RETURNS void
ERROR: function public.debug(text) does not exist
STATEMENT: ALTER FUNCTION public.debug(msg text) OWNER TO postgres;
ERROR: language "plpython3u" does not exist
HINT: Use CREATE LANGUAGE to load the language into the database.
STATEMENT: CREATE FUNCTION load_all(csv_root text) RETURNS void
psql:/dump/dump.sql:1015: ERROR: language "plpython3u" does not exist
HINT: Use CREATE LANGUAGE to load the language into the database.
ERROR: function public.load_all(text) does not exist
psql:/dump/dump.sql:1018: ERROR: function public.load_all(text) does not exist
psql:/dump/dump.sql:1115: ERROR: language "plpython3u" does not exist
HINT: Use CREATE LANGUAGE to load the language into the database.
psql:/dump/dump.sql:1118: ERROR: function rnaseq.load_all_cuffdiff(text) does n
ot exist
psql:/dump/dump.sql:1175: ERROR: language "plpython3u" does not exist
HINT: Use CREATE LANGUAGE to load the language into the database.
STATEMENT: ALTER FUNCTION public.load_all(csv_root text) OWNER TO postgres;
ERROR: language "plpython3u" does not exist
HINT: Use CREATE LANGUAGE to load the language into the database.
STATEMENT: CREATE FUNCTION load_all_cuffdiff(cuffdiff_root text) RETURNS void
ERROR: function rnaseq.load_all_cuffdiff(text) does not exist
STATEMENT: ALTER FUNCTION rnaseq.load_all_cuffdiff(cuffdiff_root text) OWNER TO
postgres;
ERROR: language "plpython3u" does not exist
HINT: Use CREATE LANGUAGE to load the language into the database.
STATEMENT: CREATE FUNCTION load_all_voom_edger(rna_seq_root text) RETURNS void
psql:/dump/dump.sql:1178: ERROR: function rnaseq.load_all_voom_edger(text) does
not exist
ERROR: function rnaseq.load_all_voom_edger(text) does not exist
STATEMENT: ALTER FUNCTION rnaseq.load_all_voom_edger(rna_seq_root text) OWNER T
O postgres;
LOG: checkpoints are occurring too frequently (2 seconds apart)
HINT: Consider increasing the configuration parameter "checkpoint_segments".
LOG: checkpoints are occurring too frequently (3 seconds apart)
HINT: Consider increasing the configuration parameter "checkpoint_segments".
LOG: checkpoints are occurring too frequently (3 seconds apart)
HINT: Consider increasing the configuration parameter "checkpoint_segments".
LOG: checkpoints are occurring too frequently (2 seconds apart)
HINT: Consider increasing the configuration parameter "checkpoint_segments".
LOG: checkpoints are occurring too frequently (6 seconds apart)
HINT: Consider increasing the configuration parameter "checkpoint_segments".
LOG: sending cancel to blocking autovacuum PID 69
DETAIL: Process 68 waits for AccessExclusiveLock on relation 16459 of database
12141.
STATEMENT: ALTER TABLE ONLY histone_homer
ERROR: canceling autovacuum task
CONTEXT: automatic analyze of table "postgres.histone.histone_homer"
LOG: sending cancel to blocking autovacuum PID 69
DETAIL: Process 68 waits for AccessExclusiveLock on relation 16468 of database
12141.
STATEMENT: ALTER TABLE ONLY histone_macs
ERROR: canceling autovacuum task
CONTEXT: automatic analyze of table "postgres.histone.histone_macs"
LOG: sending cancel to blocking autovacuum PID 69
DETAIL: Process 68 waits for AccessExclusiveLock on relation 16485 of database
12141.
STATEMENT: ALTER TABLE ONLY macs_gene_map
ERROR: canceling autovacuum task
CONTEXT: automatic analyze of table "postgres.histone.macs_gene_map"
LOG: sending cancel to blocking autovacuum PID 69
DETAIL: Process 68 waits for AccessExclusiveLock on relation 16543 of database
12141.
STATEMENT: ALTER TABLE ONLY cg_islands
ERROR: canceling autovacuum task
CONTEXT: automatic analyze of table "postgres.methylation.cg_islands"
LOG: sending cancel to blocking autovacuum PID 69
DETAIL: Process 68 waits for AccessExclusiveLock on relation 16551 of database
12141.
STATEMENT: ALTER TABLE ONLY methylation
ERROR: canceling autovacuum task
CONTEXT: automatic analyze of table "postgres.methylation.methylation"
LOG: sending cancel to blocking autovacuum PID 69
DETAIL: Process 68 waits for AccessExclusiveLock on relation 16585 of database
12141.
STATEMENT: ALTER TABLE ONLY rnaseq_count
ERROR: canceling autovacuum task
CONTEXT: automatic analyze of table "postgres.rnaseq.rnaseq_count"
LOG: received smart shutdown request
LOG: autovacuum launcher shutting down
LOG: shutting down
LOG: database system was shut down at 2015-04-14 07:52:46 UTC
LOG: database system is ready to accept connections
LOG: autovacuum launcher started
答案 0 :(得分:0)
为什么在执行加载脚本之前不尝试安装此扩展?这样的事情:
<强> Dockerfile 强>
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get install -y postgresql-plpython3-9.4
加载脚本
gosu postgres pg_ctl start -w -D /var/lib/postgresql/data
gosu postgres psql -d postgres -c "create language 'plpythonu3';"
gosu postgres psql -d postgres -f /dump/dump.sql
gosu postgres pg_ctl stop -w -D /var/lib/postgresql/data