Postgresql – pgpool-ii show server as down, but server is running fine

postgresqlruby-on-rails-3

I am using postgres 9.2 with streaming replication. I have 1 master DB and 2 standby DBs, it's hosted on amazon EC2, each has it's own server. On separate server i have pgpool(3.2.3) that does load balancing

In the pgpool config I have

num_init_children=290, 
max_pool- 2, 
child_life_time - 0
child_max_connections - 100, 
connection_life_time- 100, 
client_idle_limit - 0
do not cache onnections

Sometimes pgpool shows server status as "down", even though the server is up & running fine, due to this, i am getting a lot of issues.
Also i have in pgpool config:

health_check_timeout - 60
health_check_period - 30
health_check_max_retries - 3
health_check_retry_delay -5

Also pgpool is not writing log 🙁
I set the logging up as

log_destination "stderr"
debug_level 0
logdir /var/tmp

I checked permissions it has 777, so it's not the case.
when i start pgpool i start it with "-n" option to let it write log.

Any ideas why server shown as down & where is my logs ?

Best Answer

Here's a response about the logs.

First, the log_directory is the place where pgpool_status is written, not the actual logs, which is why you're not finding the logs there.

Logging can be done in either of two ways. You've got it set to send logs to STDERR, i.e. the file descriptor for error messages. In the script you're using to start pgpool, you could add a redirect for STDERR to a file, which would then be your logfile:

pgpool [whatever options you use] > /var/tmp/pgpool.log 2>&1

Another way is to set logging to go via the regular syslog daemon. In that case, change the log_destination like this:

log_destination 'syslog'

This will send the logs on facility local7. If you want it sent to another facility, use

syslog_facility 'local0'

or whatever facility you like. Of course, you also need to configure your syslog daemon to handle that facility.

Once that part is done, chances are it'll be easier for you to figure out the other problems.