HiveBrain v1.2.0
Get Started
← Back to all entries
gotchasqlMinor

Why does `pg_lsclusters` not list my Postgres cluster?

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
whypostgresdoespg_lsclusterslistnotcluster

Problem


  • I apt-get installed Postgres 9.2.4 (using PPA).



  • I used pg_dropcluster --stop 9.2 main to remove the default database cluster, because I intended on creating a new cluster on a separate SSD volume (a Rackspace block storage volume) that was just mounted.



  • I created that new cluster whose data resides on my SSD volume and started it (ps shows all the normal Postgres processes running for that new cluster and I'm able to open a Postgres shell and run SQL - i.e., it's running fine). Now when I run pg_lsclusters there are none listed.



The main cluster listed just fine before I deleted it. Why won't my new cluster show up, even when it's running? I've even rebooted the server (just in case).

Solution

In order to use these postgres common tools with a cluster, they need to be used consistently. You would use pg_createcluster -d /path/to/data, instead of initdb. pg_createcluster adds the cluster to postgres-common in order to facilitate these handy operations. It is a wrapper, just like pg_ctlcluster, around the lower-level tools (e.g., initdb and pg_ctl), providing access from one place to operating on all of your clusters. It also has some defaults, such as an automatically configured log location based on the cluster name. this means you don't have to use -l /var/log/my-custom.log when you're creating or starting the server.

Context

StackExchange Database Administrators Q#43920, answer score: 9

Revisions (0)

No revisions yet.