Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I've installed a postgres db on my debian squeeze. There's a /etc/init.d/postresql to control the database. When I type pstree -c, I get two traces with postgresql. After /etc/init.d/postgresl stop I have still one trace left with postgresql. Where do I have to look for this issue? Is there an entry to start another postgresql at booting time? Where can I see this?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

Assuming you have PostgreSQL installed from repository packages (e.g. postgresql-8.4) this is perfectly possible if second cluster (let's say test) is set in manual mode:

cat /etc/postgresql/8.4/test/start.conf 
# Automatic startup configuration
# auto: automatically start/stop the cluster in the init script
# manual: do not start/stop in init scripts, but allow manual startup with
#         pg_ctlcluster
# disabled: do not allow manual startup with pg_ctlcluster (this can be easily
#           circumvented and is only meant to be a small protection for
#           accidents).

manual

You can check all registered clusters by pg_lsclusters command:

pg_lsclusters 
Version Cluster   Port Status Owner    Data directory                     Log file
8.4     main      5432 online postgres /var/lib/postgresql/8.4/main       /var/log/..
8.4     test      5433 online postgres /var/lib/postgresql/8.4/test       /var/log/..

pstree -c | grep postgres result:

 |-postgres-+-postgres
 |          |-postgres
 |          |-postgres
 |          `-postgres
 |-postgres-+-postgres
 |          |-postgres
 |          |-postgres
 |          `-postgres

Manual mode (as opposite to auto) means that DB cluster is not handled by /etc/init.d/postgresql script, so after:

# /etc/init.d/postgresql stop

there is still one working server's instance:

pg_lsclusters 
Version Cluster   Port Status Owner    Data directory                     Log file
8.4     main      5432 down   postgres /var/lib/postgresql/8.4/main       /var/log/..
8.4     test      5433 online postgres /var/lib/postgresql/8.4/test       /var/log/..

and pstree returns remaining trace:

 |-postgres-+-postgres
 |          |-postgres
 |          |-postgres
 |          `-postgres

To shut down remaining instance explicitly use:

# pg_ctlcluster 8.4 test stop
share|improve this answer
    
Thank you very much for this interesting answer!! I'll check this next week at office and after that accept it :-) –  strauberry Aug 12 '11 at 9:07
    
Hi, I found the mistake with your manual: in the start.conf I can see "auto", so it is handled via init.d. Additionally, I started a postgres-server manually with /usr/lib/postgresql/8.4/bin/pg_ctl start... so there are many instances. Thank you! –  strauberry Sep 29 '11 at 8:46

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.