Thread: "private" installation of postgres

"private" installation of postgres

From
Scott Ribe
Date:
Assume I want to install an instance of postgres such that it cannot interfere with another install, or even be visible
toother apps. Is this all I need to do: 

- install pg somewhere within my own directory
- init the db somewhere within my own directory
- disallow IP connections
- set the socket directory somewhere within my own directory

Or is there a doc on this somewhere?

--
Scott Ribe
scott_ribe@elevated-dev.com
http://www.elevated-dev.com/
(303) 722-0567 voice





Re: "private" installation of postgres

From
John R Pierce
Date:
On 09/07/10 5:15 PM, Scott Ribe wrote:
> Assume I want to install an instance of postgres such that it cannot interfere with another install, or even be
visibleto other apps. Is this all I need to do: 
>
> - install pg somewhere within my own directory
> - init the db somewhere within my own directory
> - disallow IP connections
> - set the socket directory somewhere within my own directory
>
> Or is there a doc on this somewhere?

I'm pretty sure the socket directory is hard coded in the source, I
don't think you can override it even with ./configure





Re: "private" installation of postgres

From
"Joshua J. Kugler"
Date:
On Tuesday 07 September 2010, John R Pierce elucidated thus:
>   On 09/07/10 5:15 PM, Scott Ribe wrote:
> > Assume I want to install an instance of postgres such that it
> > cannot interfere with another install, or even be visible to other
> > apps. Is this all I need to do:
> >
> > - install pg somewhere within my own directory
> > - init the db somewhere within my own directory
> > - disallow IP connections
> > - set the socket directory somewhere within my own directory
> >
> > Or is there a doc on this somewhere?
>
> I'm pretty sure the socket directory is hard coded in the source, I
> don't think you can override it even with ./configure

postgresql.conf:

unix_socket_directory = '/var/run/postgresql'

j

--
Joshua Kugler
Part-Time System Admin/Programmer
http://www.eeinternet.com - Fairbanks, AK
PGP Key: http://pgp.mit.edu/  ID 0x73B13B6A

Re: "private" installation of postgres

From
"Greg Sabino Mullane"
Date:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: RIPEMD160


> Assume I want to install an instance of postgres such
> that it cannot interfere with another install,
> or even be visible to other apps. Is this all I need to do:
>
> - install pg somewhere within my own directory
> - init the db somewhere within my own directory
> - disallow IP connections
> - set the socket directory somewhere within my own directory

Yep, that should do it. I do this all the time for testing
various programs. Set the socket with pg_ctl -o "-k newsocketdir"

- --
Greg Sabino Mullane greg@turnstep.com
End Point Corporation http://www.endpoint.com/
PGP Key: 0x14964AC8 201009072027
http://biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B906714964AC8
-----BEGIN PGP SIGNATURE-----

iEYEAREDAAYFAkyG2JsACgkQvJuQZxSWSsg8igCg+CkN8v3NeKtQzIobEG6wP1gD
k08AnAivO5e77TMOMcTlitPNXNyhg5wr
=hgpw
-----END PGP SIGNATURE-----



Re: "private" installation of postgres

From
John R Pierce
Date:
  On 09/07/10 5:24 PM, Joshua J. Kugler wrote:
>> I'm pretty sure the socket directory is hard coded in the source, I
>> don't think you can override it even with ./configure
> postgresql.conf:
>
> unix_socket_directory = '/var/run/postgresql'
>

for some reason, I'm remembering that last time I looked, there were
places where this value wasn't being used.  but then again, maybe I'm
thinking of something else entirely different and am just confused.
wouldn't be the first time.



Re: "private" installation of postgres

From
Rodrigo Gonzalez
Date:
It is defined in postgresql.conf

unix_socket_directory = '/var/run/postgresql'

On Tue, 07 Sep 2010 17:20:24 -0700
John R Pierce <pierce@hogranch.com> wrote:

>   On 09/07/10 5:15 PM, Scott Ribe wrote:
> > Assume I want to install an instance of postgres such that it
> > cannot interfere with another install, or even be visible to other
> > apps. Is this all I need to do:
> >
> > - install pg somewhere within my own directory
> > - init the db somewhere within my own directory
> > - disallow IP connections
> > - set the socket directory somewhere within my own directory
> >
> > Or is there a doc on this somewhere?
>
> I'm pretty sure the socket directory is hard coded in the source, I
> don't think you can override it even with ./configure
>
>
>
>
>


Attachment

Re: "private" installation of postgres

From
Scott Ribe
Date:
On Sep 7, 2010, at 6:30 PM, John R Pierce wrote:

> for some reason, I'm remembering that last time I looked, there were places where this value wasn't being used.  but
thenagain, maybe I'm thinking of something else entirely different and am just confused.   wouldn't be the first time. 

Well, unless I hear definitively, I'll consider that something I need to test. Of course there's also an option to
specifythe default when building the source, I expect *that* should work, and as far as I'm concerned there would be no
problemdoing it that way. 

--
Scott Ribe
scott_ribe@elevated-dev.com
http://www.elevated-dev.com/
(303) 722-0567 voice





Re: "private" installation of postgres

From
Scott Ribe
Date:
On Sep 7, 2010, at 6:28 PM, Greg Sabino Mullane wrote:

> Yep, that should do it. I do this all the time for testing
> various programs. Set the socket with pg_ctl -o "-k newsocketdir"

Thanks :-)

--
Scott Ribe
scott_ribe@elevated-dev.com
http://www.elevated-dev.com/
(303) 722-0567 voice





Re: "private" installation of postgres

From
Tom Lane
Date:
John R Pierce <pierce@hogranch.com> writes:
>   On 09/07/10 5:24 PM, Joshua J. Kugler wrote:
>>> I'm pretty sure the socket directory is hard coded in the source, I
>>> don't think you can override it even with ./configure

>> postgresql.conf:
>> unix_socket_directory = '/var/run/postgresql'

> for some reason, I'm remembering that last time I looked, there were
> places where this value wasn't being used.

The client side is obviously not going to know what is in the server's
config file, so you're going to have to specify that path every time you
connect.  Depending on what you are doing, you might want to build a
version of libpq that defaults to assuming the nondefault socket
location rather than /tmp.  If so, edit DEFAULT_PGSOCKET_DIR in
src/include/pg_config_manual.h.

Personally, though, I think it's easier to change the default port
number and not worry about sharing /tmp.  Changing the port is a good
idea anyway to avoid any possible conflicts on shared memory IDs.

            regards, tom lane

Re: "private" installation of postgres

From
Scott Ribe
Date:
On Sep 7, 2010, at 7:09 PM, Tom Lane wrote:

> Personally, though, I think it's easier to change the default port
> number and not worry about sharing /tmp.  Changing the port is a good
> idea anyway to avoid any possible conflicts on shared memory IDs.

I was planning on changing the default port number (I forgot to state that in my email), but also moving the socket dir
justto be really sure. 

--
Scott Ribe
scott_ribe@elevated-dev.com
http://www.elevated-dev.com/
(303) 722-0567 voice





Re: "private" installation of postgres

From
"Joshua J. Kugler"
Date:
On Tuesday 07 September 2010, Scott Ribe elucidated thus:
> On Sep 7, 2010, at 7:09 PM, Tom Lane wrote:
> > Personally, though, I think it's easier to change the default port
> > number and not worry about sharing /tmp.  Changing the port is a
> > good idea anyway to avoid any possible conflicts on shared memory
> > IDs.
>
> I was planning on changing the default port number (I forgot to state
> that in my email), but also moving the socket dir just to be really
> sure.

If you do a private socket dir, and connect via that, you don't even
have to listen on a TCP port at all.

j

--
Joshua Kugler
Part-Time System Admin/Programmer
http://www.eeinternet.com - Fairbanks, AK
PGP Key: http://pgp.mit.edu/  ID 0x73B13B6A

Re: "private" installation of postgres

From
Scott Ribe
Date:
On Sep 8, 2010, at 1:39 PM, Joshua J. Kugler wrote:

> If you do a private socket dir, and connect via that, you don't even
> have to listen on a TCP port at all.

Right, but it's hardwired in that the IP port number is used as part of the domain socket name, and according to Tom
alsoused somehow in shared memory segments. 

--
Scott Ribe
scott_ribe@elevated-dev.com
http://www.elevated-dev.com/
(303) 722-0567 voice