我正在尝试将 Ubuntu Server 上的 PostgreSQL 从 9.6 升级到 10。这是我第一次这样做。服务器尚不包含任何有用的数据,但我想确保下次我可以正确执行此操作。
运行 pg_upgrade 脚本:
须藤 -u postgres /usr/lib/postgresql/10/bin/pg_upgrade -b /usr/lib/postgresql/9.6/bin -B /usr/lib/postgresql/10/bin -d /var/lib/postgresql/9.6 /main/ -D /var/lib/postgresql/10/main/
这是控制台输出:
Performing Consistency Checks
-----------------------------
Checking cluster versions ok
*failure*
Consult the last few lines of "pg_upgrade_server.log" for
the probable cause of the failure.
connection to database failed: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/lib/postgresql/.s.PGSQL.50432"?
could not connect to source postmaster started with the command:
"/usr/lib/postgresql/9.6/bin/pg_ctl" -w -l "pg_upgrade_server.log" -D "/var/lib/postgresql/9.6/main/" -o "-p 50432 -b -c listen_addresses='' -c unix_socket_permissions=0700 -c unix_socket_directories='/var/lib/postgresql'" start
Failure, exiting
Run Code Online (Sandbox Code Playgroud)
这是 pg_upgrade_server.log 的内容:
command: "/usr/lib/postgresql/9.6/bin/pg_ctl" -w -l "pg_upgrade_server.log" -D "/var/lib/postgresql/9.6/main/" -o "-p 50432 -b -c listen_addresses='' -c unix_socket_permissions=0700 -c unix_socket_directories='/var/lib/postgresql'" start >> "pg_upgrade_server.log" 2>&1
waiting for server to start....postgres: could not access the server configuration file "/var/lib/postgresql/9.6/main/postgresql.conf": No such file or directory
stopped waiting
pg_ctl: could not start server
Examine the log output.
Run Code Online (Sandbox Code Playgroud)
我现在完全糊涂了。我该怎么办?
你知道他们怎么说假设这个词
我假设配置目录和数据目录是相同的。
将您的命令更改为此,它将起作用。
sudo -u postgres /usr/lib/postgresql/10/bin/pg_upgrade \
-b /usr/lib/postgresql/9.6/bin -B /usr/lib/postgresql/10/bin \
-d /var/lib/postgresql/9.6/main/ -D /var/lib/postgresql/10/main/
-o 'config_file=/etc/postgresql/9.6/main/postgresql.conf' \
-O 'config_file=/etc/postgresql/10/main/postgresql.conf'
Run Code Online (Sandbox Code Playgroud)
我们可以提供特殊的配置文件位置作为选项
另外,我相信您已经确定了默认安装问题或需要更新文档
默认安装应该在 datadir 中创建配置文件
既然这是玩,也试试这个:
sudo -u postgres pg_dropcluster 10 main
sudo -u postgres pg_upgradecluster 9.6 main
Run Code Online (Sandbox Code Playgroud)
空数据库似乎尚未创建。或者在不同的目录中。这就是为什么在错误消息中找不到 postgresql.conf 的原因。
ls -l /var/lib/postgresql/9.6/main/postgresql.conf /var/lib/postgresql/10/main/postgresql.conf
应该显示两个文件。
应该运行两个版本的等效 initdb 命令
pg_ctl -D /var/lib/postgresql/9.6/main initdb
pg_ctl -D /var/lib/postgresql/10/main initdb
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
11570 次 |
最近记录: |