使用ssh psql命令发生意外错误

时间:2020-04-16 21:37:16

标签: postgresql docker ssh psql

当我在docker中运行bash文件时,我计划通过一个服务器A运行一些psql命令到另一个具有postgresql数据库的服务器(数据库服务器),但是它说

[ERROR] [   trapError] An unexpected error occured at line 141 ./functions.sh`

此bash文件的详细信息是:

executeSql() {
  local tmp="/tmp/executeSql"
  ssh ${DBUSERHOST} "sudo -u postgres psql -c \"${SQL}\" -d studenta" > ${tmp} 2>&1
  ST=$?
  if [ "${ST}" != "0" ]; then
    ERROR "Failed to execute sql query"
    cat "${tmp}" >> "${LOGFILE}"
    exit 10
  fi
}

第141行对应

ssh ${DBUSERHOST} "sudo -u postgres psql -c \"${SQL}\" -d studenta" > ${tmp} 2>&1

当我检查PostgreSQL容器中的日志时,它显示如下:

...
REVOKE
REVOKE
GRANT
GRANT

LOG:  received fast shutdown request
LOG:  aborting any active transactions
FATAL:  terminating autovacuum process due to administrator command
FATAL:  terminating autovacuum process due to administrator command
LOG:  autovacuum launcher shutting down
FATAL:  terminating autovacuum process due to administrator command
waiting for server to shut down....LOG:  shutting down
LOG:  database system is shut down
 done
server stopped

PostgreSQL init process complete; ready for start up.

LOG:  database system was shut down at 2020-04-16 19:23:04 UTC
LOG:  MultiXact member wraparound protections are now enabled
LOG:  database system is ready to accept connections
LOG:  autovacuum launcher started
LOG:  server process (PID 165) exited with exit code 255
LOG:  terminating any other active server processes
WARNING:  terminating connection because of crash of another server process
DETAIL:  The postmaster has commanded this server process to roll back the current transaction and exit, because another server process exited abnormally and possibly corrupted shared memory.
HINT:  In a moment you should be able to reconnect to the database and repeat your command.
WARNING:  terminating connection because of crash of another server process
DETAIL:  The postmaster has commanded this server process to roll back the current transaction and exit, because another server process exited abnormally and possibly corrupted shared memory.
HINT:  In a moment you should be able to reconnect to the database and repeat your command.
WARNING:  terminating connection because of crash of another server process
DETAIL:  The postmaster has commanded this server process to roll back the current transaction and exit, because another server process exited abnormally and possibly corrupted shared memory.
HINT:  In a moment you should be able to reconnect to the database and repeat your command.
WARNING:  terminating connection because of crash of another server process
DETAIL:  The postmaster has commanded this server process to roll back the current transaction and exit, because another server process exited abnormally and possibly corrupted shared memory.
HINT:  In a moment you should be able to reconnect to the database and repeat your command.
LOG:  all server processes terminated; reinitializing
LOG:  database system was interrupted; last known up at 2020-04-16 19:28:25 UTC
FATAL:  the database system is in recovery mode
LOG:  database system was not properly shut down; automatic recovery in progress
LOG:  record with zero length at 1/A5D88410
LOG:  redo is not required
LOG:  MultiXact member wraparound protections are now enabled
LOG:  database system is ready to accept connections
LOG:  autovacuum launcher started
LOG:  server process (PID 200) exited with exit code 255
LOG:  terminating any other active server processes
WARNING:  terminating connection because of crash of another server process
DETAIL:  The postmaster has commanded this server process to roll back the current transaction and exit, because another server process exited abnormally and possibly corrupted shared memory.
HINT:  In a moment you should be able to reconnect to the database and repeat your command.
WARNING:  terminating connection because of crash of another server process
DETAIL:  The postmaster has commanded this server process to roll back the current transaction and exit, because another server process exited abnormally and possibly corrupted shared memory.
HINT:  In a moment you should be able to reconnect to the database and repeat your command.
WARNING:  terminating connection because of crash of another server process
DETAIL:  The postmaster has commanded this server process to roll back the current transaction and exit, because another server process exited abnormally and possibly corrupted shared memory.
HINT:  In a moment you should be able to reconnect to the database and repeat your command.
LOG:  all server processes terminated; reinitializing
LOG:  database system was interrupted; last known up at 2020-04-16 19:28:51 UTC
FATAL:  the database system is in recovery mode

所以我想在容器A中,该过程在运行psql命令期间停止了,这导致数据库服务器意外关闭,我怀疑这是某个超时连接,但是不确定... 日志中有一个快速关机,当我运行bash时,它立即退出并出现错误,如本page中所述,可能是PostgreSQL中启用了一些无人值守的安全更新,仍在检查原因... < / p>

另外,问题在于它仅显示了trapError而没有进一步的细节,因此很难找出原因,请问是否有任何解决方案或任何方法可以解决此问题?

0 个答案:

没有答案