Обсуждение: Move base directory to different location

Поиск
Список
Период
Сортировка

Move base directory to different location

От
Yambu
Дата:
Hello

May i know the procedure of moving the base directory from /var/lib/pgsql/10/data/base to another location?

regards

Re: Move base directory to different location

От
Holger Jakobs
Дата:

It is no problem to move the base directory.

  1. stop the database server
  2. move the base directory as a whole to some other location
    mv /var/lib/pgsql/10/data/base /some/other/location
  3. create a symbolic link pointing to the new location
    cd /var/lib/pgsql/10/data
    ln -s /some/other/location/base .
  4. start the database server

BTW, an upgrade to a newer major version would be a good idea.

Regards,

Holger

Am 26.11.20 um 13:59 schrieb Yambu:
Hello

May i know the procedure of moving the base directory from /var/lib/pgsql/10/data/base to another location?

regards
-- 
Holger Jakobs, Bergisch Gladbach, Tel. +49-178-9759012
Вложения

Re: Move base directory to different location

От
Paul Förster
Дата:
Hi Holger,

> On 26. Nov, 2020, at 15:00, Holger Jakobs <holger@jakobs.com> wrote:
>
> It is no problem to move the base directory.
>
>     • stop the database server
>     • move the base directory as a whole to some other location
> mv /var/lib/pgsql/10/data/base /some/other/location
>     • create a symbolic link pointing to the new location
> cd /var/lib/pgsql/10/data
> ln -s /some/other/location/base .
>     • start the database server
> BTW, an upgrade to a newer major version would be a good idea.

why not just move the whole database and NOT create a symlink? Then just start the database in the new PGDATA? Of
courseyou'd need to reconfigure your PGDATA in this case but I consider it more clean than running a database cluster
ona symlink. 

Cheers,
Paul


Re: Move base directory to different location

От
Pepe TD Vo
Дата:
Morning Holdger,

since you are mentioning "upgrade to a newer major version", would you please share step by step how to do it in replica?  I have tried to migrate  v.11 to 12 before and failed to upgrade.

v/r,


Bach-Nga

No one in this world is pure and perfect.  If you avoid people for their mistakes you will be alone. So judge less, love, and forgive more.EmojiEmojiEmoji
To call him a dog hardly seems to do him justice though in as much as he had four legs, a tail, and barked, I admit he was, to all outward appearances. But to those who knew him well, he was a perfect gentleman (Hermione Gingold)

**Live simply **Love generously **Care deeply **Speak kindly.
*** Genuinely rich *** Faithful talent *** Sharing success




On Thursday, November 26, 2020, 09:00:48 AM EST, Holger Jakobs <holger@jakobs.com> wrote:


It is no problem to move the base directory.

  1. stop the database server
  2. move the base directory as a whole to some other location
    mv /var/lib/pgsql/10/data/base /some/other/location
  3. create a symbolic link pointing to the new location
    cd /var/lib/pgsql/10/data
    ln -s /some/other/location/base .
  4. start the database server

BTW, an upgrade to a newer major version would be a good idea.

Regards,

Holger

Am 26.11.20 um 13:59 schrieb Yambu:
Hello

May i know the procedure of moving the base directory from /var/lib/pgsql/10/data/base to another location?

regards
-- 
Holger Jakobs, Bergisch Gladbach, Tel. +49-178-9759012

Re: Move base directory to different location

От
Holger Jakobs
Дата:
Hi Paul,

You are perfectly correct. I just answered very specific to the question.

Regards,

Holger

Am 26.11.20 um 15:05 schrieb Paul Förster:
> Hi Holger,
>
>> On 26. Nov, 2020, at 15:00, Holger Jakobs <holger@jakobs.com> wrote:
>>
>> It is no problem to move the base directory.
>>
>>     • stop the database server
>>     • move the base directory as a whole to some other location
>> mv /var/lib/pgsql/10/data/base /some/other/location
>>     • create a symbolic link pointing to the new location
>> cd /var/lib/pgsql/10/data
>> ln -s /some/other/location/base .
>>     • start the database server
>> BTW, an upgrade to a newer major version would be a good idea.
> why not just move the whole database and NOT create a symlink? Then just start the database in the new PGDATA? Of
courseyou'd need to reconfigure your PGDATA in this case but I consider it more clean than running a database cluster
ona symlink. 
>
> Cheers,
> Paul
>
--
Holger Jakobs, Bergisch Gladbach, Tel. +49-178-9759012



Вложения

Re: Move base directory to different location

От
Holger Jakobs
Дата:

Have a look here: https://info.crunchydata.com/blog/how-to-perform-a-major-version-upgrade-using-pg_upgrade-in-postgresql

I couldn't write it any better.


Am 26.11.20 um 15:06 schrieb Pepe TD Vo:
Morning Holdger,

since you are mentioning "upgrade to a newer major version", would you please share step by step how to do it in replica?  I have tried to migrate  v.11 to 12 before and failed to upgrade.

v/r,


Bach-Nga

No one in this world is pure and perfect.  If you avoid people for their mistakes you will be alone. So judge less, love, and forgive more.EmojiEmojiEmoji
To call him a dog hardly seems to do him justice though in as much as he had four legs, a tail, and barked, I admit he was, to all outward appearances. But to those who knew him well, he was a perfect gentleman (Hermione Gingold)

**Live simply **Love generously **Care deeply **Speak kindly.
*** Genuinely rich *** Faithful talent *** Sharing success




On Thursday, November 26, 2020, 09:00:48 AM EST, Holger Jakobs <holger@jakobs.com> wrote:


It is no problem to move the base directory.

  1. stop the database server
  2. move the base directory as a whole to some other location
    mv /var/lib/pgsql/10/data/base /some/other/location
  3. create a symbolic link pointing to the new location
    cd /var/lib/pgsql/10/data
    ln -s /some/other/location/base .
  4. start the database server

BTW, an upgrade to a newer major version would be a good idea.

Regards,

Holger

Am 26.11.20 um 13:59 schrieb Yambu:
Hello

May i know the procedure of moving the base directory from /var/lib/pgsql/10/data/base to another location?

regards
-- 
Holger Jakobs, Bergisch Gladbach, Tel. +49-178-9759012
-- 
Holger Jakobs, Bergisch Gladbach, Tel. +49-178-9759012
Вложения

Re: Move base directory to different location

От
"David G. Johnston"
Дата:
Please don‘t top-post.

On Thursday, November 26, 2020, Holger Jakobs <holger@jakobs.com> wrote:


    BTW, an upgrade to a newer major version would be a good idea.



    Why?

    David J. 

    Re: Move base directory to different location

    От
    Paul Förster
    Дата:
    Hi David,
    
    > On 26. Nov, 2020, at 15:30, David G. Johnston <david.g.johnston@gmail.com> wrote:
    >
    > Why?
    
    it is always a good idea to stay mostly current (at least with minor versions!), not for new features but for security
    andbug fixes. For example, I will update 11.9 and 12.4 to 11.10 and 12.5 in our company in the next few days because of
    someserious CVEs. 
    
    Unfortunately, I can't migrate to 13 by now because applications have not been certified yet. :-(
    
    Cheers,
    Paul
    
    
    

    Move base directory to different location

    От
    "David G. Johnston"
    Дата:
    On Thursday, November 26, 2020, Paul Förster <paul.foerster@gmail.com> wrote:
    Hi David,

    > On 26. Nov, 2020, at 15:30, David G. Johnston <david.g.johnston@gmail.com> wrote:
    >
    > Why?

    it is always a good idea to stay mostly current (at least with minor versions!), not for new features but for security and bug fixes. For example, I will update 11.9 and 12.4 to 11.10 and 12.5 in our company in the next few days because of some serious CVEs.

    Unfortunately, I can't migrate to 13 by now because applications have not been certified yet. :-(

    But the comment was to full upgrade, not just update.  The OP didn’t state which patch release but is running version 10.

    David J.

    Re: Move base directory to different location

    От
    Paul Förster
    Дата:
    Hi David,
    
    > On 26. Nov, 2020, at 15:49, David G. Johnston <david.g.johnston@gmail.com> wrote:
    >
    > But the comment was to full upgrade, not just update.  The OP didn’t state which patch release but is running version
    10.
    
    IMHO, the same applies to major versions.
    
    Also, it's IMHO easier to get problems fixed if you use a current version because developers don't have to check old
    codebut can work and test with a current version. And if you have a real problem, then you most likely won't get a
    backwardcompatible patch. It will rather be fixed in the next release. 
    
    As always, after an update/upgrade is before an update/upgrade. :-)
    
    Cheers,
    Paul
    
    
    

    Re: Move base directory to different location

    От
    "David G. Johnston"
    Дата:
    On Thu, Nov 26, 2020 at 7:56 AM Paul Förster <paul.foerster@gmail.com> wrote:
    Hi David,

    > On 26. Nov, 2020, at 15:49, David G. Johnston <david.g.johnston@gmail.com> wrote:
    >
    > But the comment was to full upgrade, not just update.  The OP didn’t state which patch release but is running version 10.

    IMHO, the same applies to major versions.

    Also, it's IMHO easier to get problems fixed if you use a current version because developers don't have to check old code but can work and test with a current version. And if you have a real problem, then you most likely won't get a backward compatible patch. It will rather be fixed in the next release.

    As always, after an update/upgrade is before an update/upgrade. :-)


    IMHO, that is all a load of nonsense.

    5 years of support is just that, and it is done quite well - the trade-off of upgrading only in order to make the developer's lives marginally easier isn't a good one.  Plus, they have to check the old code anyway since most likely such fixes will need to be back-patched.

    The few behavior changes that don't get back-patched support not upgrading to the newest release ASAP, not doing so sooner.

    And if a such non-batchpatch-able fix is recently discovered it won't be available until the next major release anyway, so even those running cutting-edge wouldn't see a difference compared to running an prior version.

    David J.

    Re: Move base directory to different location

    От
    Paul Förster
    Дата:
    Hi David,
    
    > On 26. Nov, 2020, at 16:38, David G. Johnston <david.g.johnston@gmail.com> wrote:
    > IMHO, that is all a load of nonsense.
    
    do whatever you like.
    
    Cheers,
    Paul
    
    
    

    Re: Move base directory to different location

    От
    "David G. Johnston"
    Дата:
    On Thu, Nov 26, 2020 at 8:41 AM Paul Förster <paul.foerster@gmail.com> wrote:
    Hi David,

    > On 26. Nov, 2020, at 16:38, David G. Johnston <david.g.johnston@gmail.com> wrote:
    > IMHO, that is all a load of nonsense.

    do whatever you like.


    You as well, but you are doing the project a dis-service by recommending to others to perform unnecessary upgrades when the support policies for the PostgreSQL project neither require it, nor do most users benefit from doing so.

    David J.