From: | Edilmar LISTAS <edilista(at)intersite(dot)com(dot)br> |
---|---|
To: | Devrim Gündüz <devrim(at)gunduz(dot)org>, pgsql-general(at)postgresql(dot)org |
Subject: | Re: Problem changing default data_directory in PG 9.6 + CentOS6 |
Date: | 2016-10-19 16:43:13 |
Message-ID: | c44ab916-1d4d-451c-4ad2-e4f0bc19ab0b@intersite.com.br |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Em 18-10-2016 16:53, Devrim Gündüz escreveu:
>
> Hi,
>
> On Mon, 2016-10-17 at 17:38 -0300, Edilmar LISTAS wrote:
>> I have an env running a changed data_directory fine in a devel machine PG 9.4
>> using Fedora23.
>> Now, I have a server machine with CentOS where I downloaded the RPMs from
>> repo https://download.postgresql.org/pub/repos/yum/9.6/redhat/rhel-6-x86_64/p
>> gdg-centos96-9.6-3.noarch.rpm.
>> All the configs run fine if I doesn't change the default data_directory. But
>> I need to use the path /sistemas/sat4/bdpg.
>>
>> I did these commands:
>>
>> mkdir /sistemas/sat4/bdpg
>> chown postgres /sistemas/sat4/bdpg
>> chmod 700 /sistemas/sat4/bdpg
>> su - postgres
>> /usr/pgsql-9.6/bin/initdb -D /sistemas/sat4/bdpg
>> exit
>>
>> Then, I changed data_directory to /sistemas/sat4/bdpg and tried to restart
>> PG:
>> service postgresql-9.6 restart
>> STOP => OK
>> START => FAILED
>
> On CentOS, the appropriate way to do this is described in README file shipped
> with the RPMs. Related part is:
>
> ===========================================================================
> As an example, let us create a secondary postmaster called, creatively enough,
> 'secondary'. Here are the steps:
> 1.) create a hard link in /etc/rc.d/init.d (or equivalent location)
> to postgresql-9.6 named 'secondary-9.6' : ln postgresql
> secondary Pick
> a name not already used in /etc/rc.d/init.d!
> 2.) create a file in /etc/sysconfig/pgsql named secondary. This file is
> a shell script -- typically you would define PGDATA, and PGOPTS
> here. Since $PGDATA/postgresql.conf will override many of these
> settings, except PGDATA, you might be surprised on startup.
> 3.) create the target PGDATA.
> 4.) Initdb the targe PGDATA as documented in the main documentation.
> Automatic initdb may or may not work for you, so a manual one is
> preferred. This must be done as user 'postgres'
> 5.) Edit postgresql.conf to change the port, address, tcpip settings, etc.
> 6.) Start the postmaster with 'service secondary-9.6 start'.
> ============================================================================
>
> Regards,
>
Thank you very much.
I did these additional cmds and all worked fine!
cd /etc/rc.d/init.d
ln postgresql-9.6 pgsat
cd /etc/sysconfig/pgsql
echo "PGDATA=/sistemas/sat4/bdpg" > pgsat
service pgsat start
chkconfig --add pgsat
chkconfig pgsat on
chkconfig postgresql-9.6 off
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2016-10-19 17:42:50 | Re: pg_upgrade not able to cope with pg_largeobject being in a different tablespace |
Previous Message | Timofei Dynikov | 2016-10-19 16:27:25 | How to build custom rpm package for postgres 9.4.4 |