简体   繁体   中英

pgpool can't create database

I have started the pgpool using the command

sudo pgpool -n &

it started giving the following message on the terminal:

2012-05-04 10:54:29 LOG: pid 4109: pgpool-II successfully started. version 2.3.2.1 (tomiteboshi)

But when I try to run the following command:

createdb -p 9999 bench_replication

I get the following error message:

createdb: could not connect to database postgres: 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.9999"?

When I change the port from 9999 to 5432, a database bench_replication is created on the local node only, not on slave nodes. But, tutorial say to mention port 9999 in this command in order to create database bench_replication on all slave nodes through pgpool .

To confirm whether pgpool is really running or not, I stop the pgpool using command

2012-05-04 10:58:50 LOG:   pid 4109: received smart shutdown request
stop request sent to pgpool. waiting for termination...done.
[1]+  Done                    sudo -A pgpool -n

which confirms the pgpool was actually running. What am I doing wrong? I have changed all my pgpool configuration file as mentioned in the standard tutorials on net.

Try this command :

createdb -p 9999 -h 127.0.0.1 bench_replication

By default PostgreSQL try to use the socket.

Late response but useful for future generations:

When you run

createdb -p 9999 bench_replication

under root, this generates the following error in log:

no pg_hba.conf entry for host "12.34.56.78", user "root", database "postgres", SSL off

This means you should explicit mention username just like this:

createdb -U postgres -p 9999 bench_replication

Then you will get another error:

no pg_hba.conf entry for host "12.34.56.78", user "postgres", database "postgres", SSL off

So you were blocked by second node on HBA level. In this case either you should allow on second node access from first (in pg_hba.conf): host all postgres 12.34.56.77 trust or you should set password: createdb -U postgres -p 9999 bench_replication -W SoMeP4Ssw0rD


If this is not clear enough - just check for your logs.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM