Thread: rename a cluster

rename a cluster

From
Ray Stell
Date:
Is there a method to rename a cluster?

Re: rename a cluster

From
Peter Eisentraut
Date:
Ray Stell wrote:
> Is there a method to rename a cluster?

Clusters don't have names in the first place.

--
Peter Eisentraut
http://developer.postgresql.org/~petere/

Re: rename a cluster

From
Ray Stell
Date:
On Thu, Feb 15, 2007 at 06:36:23PM +0100, Peter Eisentraut wrote:
> Ray Stell wrote:
> > Is there a method to rename a cluster?
>
> Clusters don't have names in the first place.

So, from 16.2 "Creating a Database Cluster"

"...you must initialize a database storage area on disk.
We call this a database cluster."

then, directory = cluster, no?

What I was trying to get at is, is mv of the dir ok or
is there something else that needs to be considered?  Thx.

Re: rename a cluster

From
"Andy Shellam (Mailing Lists)"
Date:
The cluster's "name" is only the file-system's directory path.

You can easily rename this directory, as long as you pass the relevant directory name to pg_ctl's -D parameter (which tells PostgreSQL which database "cluster" to use.)

It goes without saying, don't move the directory while PostgreSQL is running.


Ray Stell wrote:
On Thu, Feb 15, 2007 at 06:36:23PM +0100, Peter Eisentraut wrote: 
Ray Stell wrote:   
Is there a method to rename a cluster?     
Clusters don't have names in the first place.   
So, from 16.2 "Creating a Database Cluster"

"...you must initialize a database storage area on disk.
We call this a database cluster."

then, directory = cluster, no?

What I was trying to get at is, is mv of the dir ok or
is there something else that needs to be considered?  Thx.

---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

!DSPAM:37,45d4a11118511420134615!

 


-- 
Andy Shellam
NetServe Support Team

the Mail Network
"an alternative in a standardised world"

p: +44 (0) 121 288 0832/0839
m: +44 (0) 7818 000834

Re: rename a cluster

From
Peter Eisentraut
Date:
Ray Stell wrote:
> What I was trying to get at is, is mv of the dir ok or
> is there something else that needs to be considered?  Thx.

Renaming the directory is OK.  Just make sure your init script or
whatever finds it.

--
Peter Eisentraut
http://developer.postgresql.org/~petere/

Re: rename a cluster

From
Ray Stell
Date:
Many thx.  It that in the doc?


On Thu, Feb 15, 2007 at 06:21:05PM +0000, Andy Shellam (Mailing Lists) wrote:
> The cluster's "name" is only the file-system's directory path.
>
> You can easily rename this directory, as long as you pass the relevant
> directory name to pg_ctl's -D parameter (which tells PostgreSQL which
> database "cluster" to use.)
>
> It goes without saying, don't move the directory while PostgreSQL is
> running.
>
>
> Ray Stell wrote:
> >On Thu, Feb 15, 2007 at 06:36:23PM +0100, Peter Eisentraut wrote:
> >
> >>Ray Stell wrote:
> >>
> >>>Is there a method to rename a cluster?
> >>>
> >>Clusters don't have names in the first place.
> >>
> >
> >So, from 16.2 "Creating a Database Cluster"
> >
> >"...you must initialize a database storage area on disk.
> >We call this a database cluster."
> >
> >then, directory = cluster, no?
> >
> >What I was trying to get at is, is mv of the dir ok or
> >is there something else that needs to be considered?  Thx.
> >
> >---------------------------(end of broadcast)---------------------------
> >TIP 2: Don't 'kill -9' the postmaster
> >
> >!DSPAM:37,45d4a11118511420134615!
> >
> >
> >
>
>
> --
> Andy Shellam
> NetServe Support Team
>
> the Mail Network
> "an alternative in a standardised world"
>
> p: +44 (0) 121 288 0832/0839
> m: +44 (0) 7818 000834
>

--
You have no chance to survive make your time.

Re: rename a cluster

From
"Andy Shellam (Mailing Lists)"
Date:
It comes under Server Startup:

http://www.postgresql.org/docs/8.2/static/server-start.html



Ray Stell wrote:
> Many thx.  It that in the doc?
>
>
> On Thu, Feb 15, 2007 at 06:21:05PM +0000, Andy Shellam (Mailing Lists) wrote:
>
>> The cluster's "name" is only the file-system's directory path.
>>
>> You can easily rename this directory, as long as you pass the relevant
>> directory name to pg_ctl's -D parameter (which tells PostgreSQL which
>> database "cluster" to use.)
>>
>> It goes without saying, don't move the directory while PostgreSQL is
>> running.
>>

Re: rename a cluster

From
Bruce Momjian
Date:
Peter Eisentraut wrote:
> Ray Stell wrote:
> > What I was trying to get at is, is mv of the dir ok or
> > is there something else that needs to be considered?  Thx.
>
> Renaming the directory is OK.  Just make sure your init script or
> whatever finds it.

Oh, and make sure the postmaster isn't running when you do the rename.

--
  Bruce Momjian  <bruce@momjian.us>          http://momjian.us
  EnterpriseDB                               http://www.enterprisedb.com

  + If your life is a hard drive, Christ can be your backup. +

Re: rename a cluster

From
Ray Stell
Date:
On Fri, Feb 16, 2007 at 04:35:40PM -0500, Bruce Momjian wrote:
> Peter Eisentraut wrote:
> > Renaming the directory is OK.  Just make sure your init script or
> > whatever finds it.
>
> Oh, and make sure the postmaster isn't running when you do the rename.


Right, there are a few operational considerations.  I think this topic
should be get documented.  I didn't know if there was anything internal
from the initdb and didn't see the answer anywhere.

Really good news found here on this topic.  Everyday seems to bring more good
stuff from pg-land.  I go live with three more apps with pg backends in the
morning, converted from oracle, btw ;)

Re: rename a cluster

From
Tom Lane
Date:
Bruce Momjian <bruce@momjian.us> writes:
> Peter Eisentraut wrote:
>> Renaming the directory is OK.  Just make sure your init script or
>> whatever finds it.

> Oh, and make sure the postmaster isn't running when you do the rename.

While that's surely good practice, I don't think it's actually critical
since 8.1 or whenever we switched the code over to
all-relative-pathnames.  Part of the point of that change was to make
sure that a DBA couldn't accidentally corrupt a database by renaming it
while live.

            regards, tom lane