Postgresql problem initializing data directory

I tried to initialize the postgresql data directory, and I get this error :

[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"

It says “FATAL: syntax error at or near “-” at character 16”, but the hostname has to have the “-” due to new server version.

I tried doing it without nodename, but for that another problem :

[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 ~]$

How do I resolve this problem?

Try the following -

  1. Put the /usr/pgsql-9.5/bin/initdb value inside single-quotes.
  2. Same as above, but use double-quotes.
  3. Escape \ the - character, e.g. \-

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.