Thread: Alternate db location

Alternate db location

From
rwhart@mchsi.com
Date:
Hi all,
  I am installing 8.0.1 on FC3.  The initial installatin went well.  I am now
trying to change and use a different directory /pg_data. I have established and
exportede PGDATA and it is /pg_data.  I have mkdir /pg_data and changed the
owner to postgres and run chmod with 700 on the directory. Whenever it log in as
user postgres and run initdb I get the output of the attached file.
  Does anyone have any ideas?  AFAIK I have follwed the docs.

Thanks,

Bob Hartung


Attachment

Re: Alternate db location

From
Scott Marlowe
Date:
On Tue, 2005-02-15 at 09:16, rwhart@mchsi.com wrote:
> Hi all,
>   I am installing 8.0.1 on FC3.  The initial installatin went well.  I am now
> trying to change and use a different directory /pg_data. I have established and
> exportede PGDATA and it is /pg_data.  I have mkdir /pg_data and changed the
> owner to postgres and run chmod with 700 on the directory. Whenever it log in as
> user postgres and run initdb I get the output of the attached file.
>   Does anyone have any ideas?  AFAIK I have follwed the docs.

Looks pretty normal, is it just hanging there, or does it finish
eventually?

Re: Alternate db location

From
Tom Lane
Date:
rwhart@mchsi.com writes:
> [ initdb fails with ]
> creating directory /pg_data/pg_tblspc ... ok
> selecting default max_connections ... 10
> selecting default shared_buffers ... 50
> creating configuration files ... ok
> creating template1 database in /pg_data/base/1 ...

Hmm, the "default max_connections" and "default shared_buffers" values
are pretty fishy: those are the minimums that initdb will select if
the postgres bootstrap process failed to start with anything larger.
I interpret the above as saying that postgres boot won't start at all.
What do you see if you start it by hand, ie

    postgres -boot -x0 template1

            regards, tom lane

Re: Alternate db location

From
Marco Colombo
Date:
On Tue, 15 Feb 2005 rwhart@mchsi.com wrote:

> Hi all,
>  I am installing 8.0.1 on FC3.  The initial installatin went well.  I am now
> trying to change and use a different directory /pg_data. I have established and
> exportede PGDATA and it is /pg_data.  I have mkdir /pg_data and changed the
> owner to postgres and run chmod with 700 on the directory. Whenever it log in as
> user postgres and run initdb I get the output of the attached file.
>  Does anyone have any ideas?  AFAIK I have follwed the docs.
>
> Thanks,
>
> Bob Hartung

Are you running SElinux with the targeted policy, in enforced mode?
I think this is FC3 default. Check /var/log/messages for audit errors.

You need to modify your policy if you want PostgreSQL (or any other
daemons affected by the targeted policy, that is most of them) to be able
to access data in non standard directories. I've been through it, it's not
that hard. Alternatively, you may run SElinux in permissive mode or
disable it entirely. See /etc/sysconfig/selinux (there's also a GUI tool
to set SElinux behaviour but I always forget its name). Please note
that disabling SElinux affects the security of _all_ daemons.

As a quick test, you may run:

# setenforce 0

and then launch the initdb. Watch for audit errors in messages.


BTE, has anyone tried with:

setsebool postgresql_disable_trans=0 ?

Unluckily, I don't have a test host at hand at the moment. Maybe
in the targeted policy that's enough to disable controls on PostgreSQL,
while leaving other daemons confined. I'm not sure, tho, I'm just getting
started with SElinux.

.TM.
--
       ____/  ____/   /
      /      /       /            Marco Colombo
     ___/  ___  /   /              Technical Manager
    /          /   /             ESI s.r.l.
  _____/ _____/  _/               Colombo@ESI.it