Search Postgresql Archives

Re: Problem changing default data_directory in PG 9.6 + CentOS6

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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



--
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux