【发布时间】:2019-08-01 12:02:41
【问题描述】:
我不知道如何在新的 ubuntu 18.04 服务器上恢复 postgres 安装。我的旧 postgres 在 mnt 分区中。
我刚刚使用 postgresqp 11 全新安装配置了新的 ubuntu 18.04 服务器。现在,我想用我的旧 postgres(也是 11)指向 mnt 分区。我尝试使用路径"/mnt/postgresql/11/main" 更改默认目录的data_directory,但没有成功。有什么想法吗?
mnt 分区包含我所有的数据库和旧信息:
/mnt/postgresql/11/main$ ls -a
. base pg_dynshmem pg_notify pg_snapshots pg_subtrans pg_wal postmaster.opts
.. global pg_logical pg_replslot pg_stat pg_tblspc pg_xact
PG_VERSION pg_commit_ts pg_multixact pg_serial pg_stat_tmp pg_twophase postgresql.auto.conf
我的默认路径是:
/etc/postgresql/11/main$ ls
conf.d pg_ctl.conf pg_ident.conf postgresql.conf.save start.conf
environment pg_hba.conf postgresql.conf postgresql.conf.save.1
而我实际的/etc/postgresql/11/main/postgresql.conf 是:
#------------------------------------------------------------------------------
# FILE LOCATIONS
#------------------------------------------------------------------------------
# The default values of these variables are driven from the -D command-line
# option or PGDATA environment variable, represented here as ConfigDir.
#data_directory = '/mnt/postgresql/11/main' '/var/lib/postgresql/11/main'
data_directory = '/mnt/postgresql/11/main' # use data in another directory
# (change requires restart)
hba_file = '/etc/postgresql/11/main/pg_hba.conf' # host-based authentication file
# (change requires restart)
ident_file = '/etc/postgresql/11/main/pg_ident.conf' # ident configuration file
# (change requires restart)
# If external_pid_file is not explicitly set, no extra PID file is written.
external_pid_file = '/var/run/postgresql/11-main.pid' # write an extra PID file
# (change requires restart)
#------------------------------------------------------------------------------
# CONNECTIONS AND AUTHENTICATION
#------------------------------------------------------------------------------
# - Connection Settings -
listen_addresses = '*' # what IP address(es) to listen on;
# comma-separated list of addresses;
# defaults to 'localhost'; use '*' for all
# (change requires restart)
port = 5432 # (change requires restart)
我需要恢复所有 mnt 分区数据,但我不知道该怎么做。有什么帮助??
当我重新启动 postgres 时给了我这个消息:
psql
psql: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
【问题讨论】:
标签: linux postgresql server database-restore