0

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?

4
  • try inside quote --nodename='vix-db1-1' or --nodename="vix-db1-1 -D" Commented Aug 24, 2020 at 3:09
  • You may have to pass the name in quotes, so that it substitutes in the query, using --nodename='"vix-db1-1"'. The outer single-quotes will be used by the shell, leaving the inner double-quotes for the query. Commented Aug 24, 2020 at 3:14
  • There is no parameter nodename for initdb:postgresql.org/docs/current/app-initdb.html Commented Aug 24, 2020 at 5:29
  • @mike.k that worked, thx! Commented Aug 24, 2020 at 5:45

2 Answers 2

2

You must be using some fork of PostgreSQL, since initdb does not have a --nodename parameter.

Whoever wrote that fork didn't do a very good job, since they forgot to properly escape special characters somewhere. You should report that as a bug to the software vendor.

Sign up to request clarification or add additional context in comments.

1 Comment

Thx @Laurenz Albe, will take note of this. This was postgresql-xl - don't know what is the difference, but I think it works with HA (failover) nodes.
0

@anaigini I'll move the comment to answer since it worked:

You may have to pass the name in quotes, so that it substitutes in the query, using --nodename='"vix-db1-1"'. The outer single-quotes will be used by the shell, leaving the inner double-quotes for the query.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.