Обсуждение: Docker with data inside
Hello,
I am trying to create a docker Postgres container with database inside.
When I try to run the container I have the following error
2016-10-20 08:58:33 UTC FATAL: the database system is starting up
2016-10-20 08:58:33 UTC DEBUG: shmem_exit(1): 0 before_shmem_exit callbacks to make
2016-10-20 08:58:33 UTC DEBUG: shmem_exit(1): 0 on_shmem_exit callbacks to make
2016-10-20 08:58:33 UTC DEBUG: proc_exit(1): 1 callbacks to make
2016-10-20 08:58:33 UTC DEBUG: exit(1)
The entry point is
su -c "/usr/lib/postgresql/9.4/bin/postgres -d 3 -D /var/lib/postgresql/9.4/main -c config_file=/etc/postgresql/9.4/main/postgresql.conf" postgres
and the output of command
2016-10-20 08:56:58 UTC DEBUG: postgres: PostmasterMain: initial environment dump:
2016-10-20 08:56:58 UTC DEBUG: -----------------------------------------
2016-10-20 08:56:58 UTC DEBUG: HOSTNAME=c0e6a383b652
2016-10-20 08:56:58 UTC DEBUG: SHELL=/bin/bash
2016-10-20 08:56:58 UTC DEBUG: TERM=xterm
2016-10-20 08:56:58 UTC DEBUG: USER=postgres
2016-10-20 08:56:58 UTC DEBUG: MAIL=/var/mail/postgres
2016-10-20 08:56:58 UTC DEBUG: PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
2016-10-20 08:56:58 UTC DEBUG: _=/usr/lib/postgresql/9.4/bin/postgres
2016-10-20 08:56:58 UTC DEBUG: PWD=/var/ansible
2016-10-20 08:56:58 UTC DEBUG: LANG=en_US.UTF-8
2016-10-20 08:56:58 UTC DEBUG: HOME=/var/lib/postgresql
2016-10-20 08:56:58 UTC DEBUG: SHLVL=2
2016-10-20 08:56:58 UTC DEBUG: LOGNAME=postgres
2016-10-20 08:56:58 UTC DEBUG: PGLOCALEDIR=/usr/share/locale
2016-10-20 08:56:58 UTC DEBUG: PGSYSCONFDIR=/etc/postgresql-common
2016-10-20 08:56:58 UTC DEBUG: LC_COLLATE=en_US.UTF-8
2016-10-20 08:56:58 UTC DEBUG: LC_CTYPE=en_US.UTF-8
2016-10-20 08:56:58 UTC DEBUG: LC_MESSAGES=en_US.UTF-8
2016-10-20 08:56:58 UTC DEBUG: LC_MONETARY=C
2016-10-20 08:56:58 UTC DEBUG: LC_NUMERIC=C
2016-10-20 08:56:58 UTC DEBUG: LC_TIME=C
2016-10-20 08:56:58 UTC DEBUG: -----------------------------------------
2016-10-20 08:56:58 UTC DEBUG: invoking IpcMemoryCreate(size=294363136)
2016-10-20 08:56:58 UTC DEBUG: mmap with MAP_HUGETLB failed, huge pages disabled: Cannot allocate memory
2016-10-20 08:56:58 UTC DEBUG: SlruScanDirectory invoking callback on pg_notify/0000
2016-10-20 08:56:58 UTC DEBUG: removing file "pg_notify/0000"
2016-10-20 08:56:58 UTC DEBUG: dynamic shared memory system will support 108 segments
2016-10-20 08:56:58 UTC DEBUG: created dynamic shared memory control segment 1804289383 (876 bytes)
2016-10-20 08:56:58 UTC DEBUG: max_safe_fds = 984, usable_fds = 1000, already_open = 6
2016-10-20 08:56:58 UTC LOG: redirecting log output to logging collector process
2016-10-20 08:56:58 UTC HINT: Future log output will appear in directory "/var/log/postgresql".
2016-10-20 09:00:41 UTC DEBUG: logger shutting down
2016-10-20 09:00:41 UTC DEBUG: shmem_exit(0): 0 before_shmem_exit callbacks to make
2016-10-20 09:00:41 UTC DEBUG: shmem_exit(0): 0 on_shmem_exit callbacks to make
2016-10-20 09:00:41 UTC DEBUG: proc_exit(0): 0 callbacks to make
2016-10-20 09:00:41 UTC DEBUG: exit(0)
2016-10-20 09:00:41 UTC DEBUG: shmem_exit(-1): 0 before_shmem_exit callbacks to make
2016-10-20 09:00:41 UTC DEBUG: shmem_exit(-1): 0 on_shmem_exit callbacks to make
2016-10-20 09:00:41 UTC DEBUG: proc_exit(-1): 0 callbacks to make
My configuration parameters are
data_directory = '/var/lib/postgresql/9.4/main' # use data in another directory
hba_file = '/etc/postgresql/9.4/main/pg_hba.conf' # host-based authentication file
ident_file = '/etc/postgresql/9.4/main/pg_ident.conf' # ident configuration file
external_pid_file = '/var/run/postgresql/9.4-main.pid' # write an extra PID file
listen_addresses = '0.0.0.0'
port = 5432 # (change requires restart)
max_connections = 10
unix_socket_directories = '/var/run/postgresql' # comma-separated list of directories
ssl = true # (change requires restart)
ssl_cert_file = '/etc/ssl/certs/ssl-cert-snakeoil.pem' # (change requires restart)
ssl_key_file = '/etc/ssl/private/ssl-cert-snakeoil.key' # (change requires restart)
shared_buffers = 256MB
work_mem = 256MB
maintenance_work_mem = 128MB
dynamic_shared_memory_type = posix # the default is the first option
wal_level = hot_standby
wal_buffers = 16MB
checkpoint_segments = 64
checkpoint_completion_target = 0.7
max_wal_senders = 6
wal_keep_segments = 8
effective_cache_size = 256MB
default_statistics_target = 100
logging_collector = on
log_directory = '/var/log/postgresql'
log_filename = 'postgresql-%Y-%m-%d.log'
log_rotation_age = 1d
log_min_duration_statement = 5000
log_line_prefix = '%t '
log_timezone = 'localtime'
stats_temp_directory = '/var/run/postgresql/9.4-main.pg_stat_tmp'
log_autovacuum_min_duration = -1
autovacuum_max_workers = 3
autovacuum_naptime = 15min
autovacuum_vacuum_threshold = 50
autovacuum_analyze_threshold = 50
autovacuum = on
datestyle = 'iso, mdy'
timezone = 'UTC'
timezone = 'Europe/Athens'
client_encoding = UTF8
lc_messages = 'en_US.UTF-8' # locale for system error message
lc_monetary = 'en_US.UTF-8' # locale for monetary formatting
lc_numeric = 'en_US.UTF-8' # locale for number formatting
lc_time = 'en_US.UTF-8' # locale for time formatting
default_text_search_config = 'pg_catalog.english'
Thanks,
Dimitris
Καλημέρα Δημήτρη
On 20/10/2016 12:04, Κοκμάδης Δημήτριος wrote:
On 20/10/2016 12:04, Κοκμάδης Δημήτριος wrote:
Hello,I am trying to create a docker Postgres container with database inside.When I try to run the container I have the following error2016-10-20 08:58:33 UTC FATAL: the database system is starting up2016-10-20 08:58:33 UTC DEBUG: shmem_exit(1): 0 before_shmem_exit callbacks to make2016-10-20 08:58:33 UTC DEBUG: shmem_exit(1): 0 on_shmem_exit callbacks to make2016-10-20 08:58:33 UTC DEBUG: proc_exit(1): 1 callbacks to make2016-10-20 08:58:33 UTC DEBUG: exit(1)
In IPC-enabled/compiled versions you might want to set some kernel tunables related to IPC :
sysctl -a | grep -e 'sem|shm'
and adjust accordingly.
It seems that your installation uses mmap so you gotta handle this error first :
"mmap with MAP_HUGETLB failed, huge pages disabled: Cannot allocate memory"
See some Docker info how to resolve this.
The entry point issu -c "/usr/lib/postgresql/9.4/bin/postgres -d 3 -D /var/lib/postgresql/9.4/main -c config_file=/etc/postgresql/9.4/main/postgresql.conf" postgresand the output of command2016-10-20 08:56:58 UTC DEBUG: postgres: PostmasterMain: initial environment dump:2016-10-20 08:56:58 UTC DEBUG: -----------------------------------------2016-10-20 08:56:58 UTC DEBUG: HOSTNAME=c0e6a383b6522016-10-20 08:56:58 UTC DEBUG: SHELL=/bin/bash2016-10-20 08:56:58 UTC DEBUG: TERM=xterm2016-10-20 08:56:58 UTC DEBUG: USER=postgres2016-10-20 08:56:58 UTC DEBUG: MAIL=/var/mail/postgres2016-10-20 08:56:58 UTC DEBUG: PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games2016-10-20 08:56:58 UTC DEBUG: _=/usr/lib/postgresql/9.4/bin/postgres2016-10-20 08:56:58 UTC DEBUG: PWD=/var/ansible2016-10-20 08:56:58 UTC DEBUG: LANG=en_US.UTF-82016-10-20 08:56:58 UTC DEBUG: HOME=/var/lib/postgresql2016-10-20 08:56:58 UTC DEBUG: SHLVL=22016-10-20 08:56:58 UTC DEBUG: LOGNAME=postgres2016-10-20 08:56:58 UTC DEBUG: PGLOCALEDIR=/usr/share/locale2016-10-20 08:56:58 UTC DEBUG: PGSYSCONFDIR=/etc/postgresql-common2016-10-20 08:56:58 UTC DEBUG: LC_COLLATE=en_US.UTF-82016-10-20 08:56:58 UTC DEBUG: LC_CTYPE=en_US.UTF-82016-10-20 08:56:58 UTC DEBUG: LC_MESSAGES=en_US.UTF-82016-10-20 08:56:58 UTC DEBUG: LC_MONETARY=C2016-10-20 08:56:58 UTC DEBUG: LC_NUMERIC=C2016-10-20 08:56:58 UTC DEBUG: LC_TIME=C2016-10-20 08:56:58 UTC DEBUG: -----------------------------------------2016-10-20 08:56:58 UTC DEBUG: invoking IpcMemoryCreate(size=294363136)2016-10-20 08:56:58 UTC DEBUG: mmap with MAP_HUGETLB failed, huge pages disabled: Cannot allocate memory2016-10-20 08:56:58 UTC DEBUG: SlruScanDirectory invoking callback on pg_notify/00002016-10-20 08:56:58 UTC DEBUG: removing file "pg_notify/0000"2016-10-20 08:56:58 UTC DEBUG: dynamic shared memory system will support 108 segments2016-10-20 08:56:58 UTC DEBUG: created dynamic shared memory control segment 1804289383 (876 bytes)2016-10-20 08:56:58 UTC DEBUG: max_safe_fds = 984, usable_fds = 1000, already_open = 62016-10-20 08:56:58 UTC LOG: redirecting log output to logging collector process2016-10-20 08:56:58 UTC HINT: Future log output will appear in directory "/var/log/postgresql".2016-10-20 09:00:41 UTC DEBUG: logger shutting down2016-10-20 09:00:41 UTC DEBUG: shmem_exit(0): 0 before_shmem_exit callbacks to make2016-10-20 09:00:41 UTC DEBUG: shmem_exit(0): 0 on_shmem_exit callbacks to make2016-10-20 09:00:41 UTC DEBUG: proc_exit(0): 0 callbacks to make2016-10-20 09:00:41 UTC DEBUG: exit(0)2016-10-20 09:00:41 UTC DEBUG: shmem_exit(-1): 0 before_shmem_exit callbacks to make2016-10-20 09:00:41 UTC DEBUG: shmem_exit(-1): 0 on_shmem_exit callbacks to make2016-10-20 09:00:41 UTC DEBUG: proc_exit(-1): 0 callbacks to makeMy configuration parameters aredata_directory = '/var/lib/postgresql/9.4/main' # use data in another directoryhba_file = '/etc/postgresql/9.4/main/pg_hba.conf' # host-based authentication fileident_file = '/etc/postgresql/9.4/main/pg_ident.conf' # ident configuration fileexternal_pid_file = '/var/run/postgresql/9.4-main.pid' # write an extra PID filelisten_addresses = '0.0.0.0'port = 5432 # (change requires restart)max_connections = 10unix_socket_directories = '/var/run/postgresql' # comma-separated list of directoriesssl = true # (change requires restart)ssl_cert_file = '/etc/ssl/certs/ssl-cert-snakeoil.pem' # (change requires restart)ssl_key_file = '/etc/ssl/private/ssl-cert-snakeoil.key' # (change requires restart)shared_buffers = 256MBwork_mem = 256MBmaintenance_work_mem = 128MBdynamic_shared_memory_type = posix # the default is the first optionwal_level = hot_standbywal_buffers = 16MBcheckpoint_segments = 64checkpoint_completion_target = 0.7max_wal_senders = 6wal_keep_segments = 8effective_cache_size = 256MBdefault_statistics_target = 100logging_collector = onlog_directory = '/var/log/postgresql'log_filename = 'postgresql-%Y-%m-%d.log'log_rotation_age = 1dlog_min_duration_statement = 5000log_line_prefix = '%t 'log_timezone = 'localtime'stats_temp_directory = '/var/run/postgresql/9.4-main.pg_stat_tmp'log_autovacuum_min_duration = -1autovacuum_max_workers = 3autovacuum_naptime = 15minautovacuum_vacuum_threshold = 50autovacuum_analyze_threshold = 50autovacuum = ondatestyle = 'iso, mdy'timezone = 'UTC'timezone = 'Europe/Athens'client_encoding = UTF8lc_messages = 'en_US.UTF-8' # locale for system error messagelc_monetary = 'en_US.UTF-8' # locale for monetary formattinglc_numeric = 'en_US.UTF-8' # locale for number formattinglc_time = 'en_US.UTF-8' # locale for time formattingdefault_text_search_config = 'pg_catalog.english'Thanks,Dimitris
-- Achilleas Mantzios IT DEV Lead IT DEPT Dynacom Tankers Mgmt
Hello,
The problem is that I am not able to set kernel parameters inside docker as it is running as readonly
sysctl: setting key "kernel.sem": Read-only file system
Thanks,
Dimitris
2016-10-20 12:31 GMT+03:00 Achilleas Mantzios <achill@matrix.gatewaynet.com>:
Καλημέρα Δημήτρη
On 20/10/2016 12:04, Κοκμάδης Δημήτριος wrote:Hello,I am trying to create a docker Postgres container with database inside.When I try to run the container I have the following error2016-10-20 08:58:33 UTC FATAL: the database system is starting up2016-10-20 08:58:33 UTC DEBUG: shmem_exit(1): 0 before_shmem_exit callbacks to make2016-10-20 08:58:33 UTC DEBUG: shmem_exit(1): 0 on_shmem_exit callbacks to make2016-10-20 08:58:33 UTC DEBUG: proc_exit(1): 1 callbacks to make2016-10-20 08:58:33 UTC DEBUG: exit(1)
In IPC-enabled/compiled versions you might want to set some kernel tunables related to IPC :
sysctl -a | grep -e 'sem|shm'
and adjust accordingly.
It seems that your installation uses mmap so you gotta handle this error first :
"mmap with MAP_HUGETLB failed, huge pages disabled: Cannot allocate memory"
See some Docker info how to resolve this.The entry point issu -c "/usr/lib/postgresql/9.4/bin/postgres -d 3 -D /var/lib/postgresql/9.4/main -c config_file=/etc/postgresql/9. 4/main/postgresql.conf" postgres and the output of command2016-10-20 08:56:58 UTC DEBUG: postgres: PostmasterMain: initial environment dump:2016-10-20 08:56:58 UTC DEBUG: ----------------------------------------- 2016-10-20 08:56:58 UTC DEBUG: HOSTNAME=c0e6a383b6522016-10-20 08:56:58 UTC DEBUG: SHELL=/bin/bash2016-10-20 08:56:58 UTC DEBUG: TERM=xterm2016-10-20 08:56:58 UTC DEBUG: USER=postgres2016-10-20 08:56:58 UTC DEBUG: MAIL=/var/mail/postgres2016-10-20 08:56:58 UTC DEBUG: PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/ games 2016-10-20 08:56:58 UTC DEBUG: _=/usr/lib/postgresql/9.4/bin/postgres 2016-10-20 08:56:58 UTC DEBUG: PWD=/var/ansible2016-10-20 08:56:58 UTC DEBUG: LANG=en_US.UTF-82016-10-20 08:56:58 UTC DEBUG: HOME=/var/lib/postgresql2016-10-20 08:56:58 UTC DEBUG: SHLVL=22016-10-20 08:56:58 UTC DEBUG: LOGNAME=postgres2016-10-20 08:56:58 UTC DEBUG: PGLOCALEDIR=/usr/share/locale2016-10-20 08:56:58 UTC DEBUG: PGSYSCONFDIR=/etc/postgresql-common 2016-10-20 08:56:58 UTC DEBUG: LC_COLLATE=en_US.UTF-82016-10-20 08:56:58 UTC DEBUG: LC_CTYPE=en_US.UTF-82016-10-20 08:56:58 UTC DEBUG: LC_MESSAGES=en_US.UTF-82016-10-20 08:56:58 UTC DEBUG: LC_MONETARY=C2016-10-20 08:56:58 UTC DEBUG: LC_NUMERIC=C2016-10-20 08:56:58 UTC DEBUG: LC_TIME=C2016-10-20 08:56:58 UTC DEBUG: ----------------------------------------- 2016-10-20 08:56:58 UTC DEBUG: invoking IpcMemoryCreate(size=294363136) 2016-10-20 08:56:58 UTC DEBUG: mmap with MAP_HUGETLB failed, huge pages disabled: Cannot allocate memory2016-10-20 08:56:58 UTC DEBUG: SlruScanDirectory invoking callback on pg_notify/00002016-10-20 08:56:58 UTC DEBUG: removing file "pg_notify/0000"2016-10-20 08:56:58 UTC DEBUG: dynamic shared memory system will support 108 segments2016-10-20 08:56:58 UTC DEBUG: created dynamic shared memory control segment 1804289383 (876 bytes)2016-10-20 08:56:58 UTC DEBUG: max_safe_fds = 984, usable_fds = 1000, already_open = 62016-10-20 08:56:58 UTC LOG: redirecting log output to logging collector process2016-10-20 08:56:58 UTC HINT: Future log output will appear in directory "/var/log/postgresql".2016-10-20 09:00:41 UTC DEBUG: logger shutting down2016-10-20 09:00:41 UTC DEBUG: shmem_exit(0): 0 before_shmem_exit callbacks to make2016-10-20 09:00:41 UTC DEBUG: shmem_exit(0): 0 on_shmem_exit callbacks to make2016-10-20 09:00:41 UTC DEBUG: proc_exit(0): 0 callbacks to make2016-10-20 09:00:41 UTC DEBUG: exit(0)2016-10-20 09:00:41 UTC DEBUG: shmem_exit(-1): 0 before_shmem_exit callbacks to make2016-10-20 09:00:41 UTC DEBUG: shmem_exit(-1): 0 on_shmem_exit callbacks to make2016-10-20 09:00:41 UTC DEBUG: proc_exit(-1): 0 callbacks to makeMy configuration parameters aredata_directory = '/var/lib/postgresql/9.4/main' # use data in another directoryhba_file = '/etc/postgresql/9.4/main/pg_hba.conf' # host-based authentication file ident_file = '/etc/postgresql/9.4/main/pg_ident.conf' # ident configuration file external_pid_file = '/var/run/postgresql/9.4-main.pid' # write an extra PID file listen_addresses = '0.0.0.0'port = 5432 # (change requires restart)max_connections = 10unix_socket_directories = '/var/run/postgresql' # comma-separated list of directoriesssl = true # (change requires restart)ssl_cert_file = '/etc/ssl/certs/ssl-cert-snakeoil.pem' # (change requires restart) ssl_key_file = '/etc/ssl/private/ssl-cert-snakeoil.key' # (change requires restart) shared_buffers = 256MBwork_mem = 256MBmaintenance_work_mem = 128MBdynamic_shared_memory_type = posix # the default is the first optionwal_level = hot_standbywal_buffers = 16MBcheckpoint_segments = 64checkpoint_completion_target = 0.7max_wal_senders = 6wal_keep_segments = 8effective_cache_size = 256MBdefault_statistics_target = 100logging_collector = onlog_directory = '/var/log/postgresql'log_filename = 'postgresql-%Y-%m-%d.log'log_rotation_age = 1dlog_min_duration_statement = 5000log_line_prefix = '%t 'log_timezone = 'localtime'stats_temp_directory = '/var/run/postgresql/9.4-main.pg_stat_tmp' log_autovacuum_min_duration = -1autovacuum_max_workers = 3autovacuum_naptime = 15minautovacuum_vacuum_threshold = 50autovacuum_analyze_threshold = 50autovacuum = ondatestyle = 'iso, mdy'timezone = 'UTC'timezone = 'Europe/Athens'client_encoding = UTF8lc_messages = 'en_US.UTF-8' # locale for system error messagelc_monetary = 'en_US.UTF-8' # locale for monetary formattinglc_numeric = 'en_US.UTF-8' # locale for number formattinglc_time = 'en_US.UTF-8' # locale for time formattingdefault_text_search_config = 'pg_catalog.english'Thanks,Dimitris-- Achilleas Mantzios IT DEV Lead IT DEPT Dynacom Tankers Mgmt