0

我试图初始化 postgresql 数据目录,我得到这个错误:

[postgres@vix-db1-1 ~]$ /usr/pgsql-9.5/bin/initdb --nodename=vix-db1-1 -D /var/lib/pgsql/9.5/data
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.
The database cluster will be initialized with locale "en_US.UTF-8".
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".
Data page checksums are disabled.
creating directory /var/lib/pgsql/9.5/data ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting dynamic shared memory implementation ... posix
creating configuration files ... ok
creating template1 database in /var/lib/pgsql/9.5/data/base/1 ... ok
initializing pg_authid ... ok
initializing dependencies ... ok
creating system views ... ok
creating cluster information ... FATAL:  syntax error at or near "-" at character 16
STATEMENT:  CREATE NODE vix-db1-1 WITH (type = 'coordinator');
child process exited with exit code 1
initdb: removing data directory "/var/lib/pgsql/9.5/data"

它说“致命:在字符 16 处或附近出现语法错误”;但是由于新的服务器版本,主机名必须带有“-”。

我尝试在没有节点名的情况下这样做,但另一个问题是:

[postgres@vix-db1-1 ~]$ /usr/pgsql-9.5/bin/initdb -D /var/lib/pgsql/9.5/data
initdb: Postgres-XL node name is mandatory
Try "initdb --help" for more information.
[postgres@vix-db1-1 ~]$

我该如何解决这个问题?

4

2 回答 2

2

您必须使用 PostgreSQL 的一些分支,因为initdb没有--nodename参数。

写那个叉子的人做得不好,因为他们忘记在某个地方正确地转义特殊字符。您应该将其作为错误报告给软件供应商。

于 2020-08-24T06:21:28.537 回答
0

@anaigini 我将把评论移到回答,因为它有效:

您可能必须在引号中传递名称,以便它在查询中替换,使用 --nodename='"vix-db1-1"'。外壳将使用外部单引号,而将内部双引号用于查询。

于 2020-08-24T19:42:20.010 回答