Re: Question on postgresql.conf

2018-08-01 Thread Steven Lembark
On Tue, 31 Jul 2018 00:02:47 -0500 (PET)
Alvaro Aguayo Garcia-Rada  wrote:

> Hi.
> 
> As far as I know, it's not currently possible. Maybe recompiling, but
> that could not be the best for production environment. I suppose this
> is this way becuase postgres is designed to expect a certain folder
> structure for it's data folder, and configuration files are
> considered part of it.
> 
> As you may see on the documentation:
> 
> https://www.postgresql.org/docs/9.6/static/app-postgres.html
> 
> You can change the data folder (-D command line option), but, no
> matter what the data folder is, it MUST have a postgresql.conf, as
> well as pg_hba.conf
> 
> However, some distros have made a similar appriach to what you may be
> looking to do. Don't remmeber which one, but there's a distro which
> it's stabdard postgresql server packages store configuration files
> at /etc/postgresql, while storing data at /var/lib/postgresql. This
> is done by simoly making a symlink, like "ln
> -s /mnt/shared/postgres/server1.conf /var/lib/postgres/data/postgresql.conf".
> Same applies to other conficuration files.

Normally the config files live on the server. If you want to 
hack the basename I'd suggest using symlinks for each machine.
Set up a whatever.conf. files you like, symlink them 
into of /etc/posgresql (or whatever you use on Windows):

e.g., 

#!/usr/bin/env bash

[ -z "$HOST_CONF_DIR"   ] || exit -1;
[ -d  $HOST_CONF_DIR] || exit -2;
[ -r  $HOST_CONF_DIR] || exit -3;

suffix=".$(hostname)";

cd /etc/postgresql;

for i in $HOST_CONF_DIR/*;
do
ln -fsv $i ./$(basename $i $suffix);
done

echo 'Config dir:';
ls -al $PWD;

exit 0;

Result: You have the standard paths where PG expexts them and 
ls -al (or readlink) will tell you which host they were generated
for.

-- 
Steven Lembark   1505 National Ave
Workhorse Computing Rockford, IL 61103
lemb...@wrkhors.com+1 888 359 3508



Re: Question on postgresql.conf

2018-07-31 Thread Dimitri Maziuk
On 07/31/2018 01:16 PM, George Neuner wrote:
> 
> I understand the problem with network shares - but the OP mentioned
> only a "shared location", which could be just another directory on the
> same device.   Because the OP said also that there were other DBMS
> being used in the same shop, I considered that there might be a
> respectable SAN involved.

(Veering further OT) yeah and you have to remember to tell Lennartware
to start the automounter before the database and make sure the next
update doesn't "improve" on your configs... IME the shared location that
works best is the chef master.

-- 
Dimitri Maziuk
Programmer/sysadmin
BioMagResBank, UW-Madison -- http://www.bmrb.wisc.edu



signature.asc
Description: OpenPGP digital signature


Re: Question on postgresql.conf

2018-07-31 Thread George Neuner
On Tue, 31 Jul 2018 12:59:03 -0500, Dimitri Maziuk
 wrote:

>On 07/31/2018 12:33 PM, George Neuner wrote:
>
>> Is there some reason that postgresql.conf cannot be a link to your
>> file?
>
>It's six of one, half a dozen of the other. The big problem is when the
>network share is unavailable at host boot and all of your databases are
>belong to bitbucket. If you want to do it right, you need chef/puppet as
>already suggested.

I understand the problem with network shares - but the OP mentioned
only a "shared location", which could be just another directory on the
same device.   Because the OP said also that there were other DBMS
being used in the same shop, I considered that there might be a
respectable SAN involved.

George




Re: Question on postgresql.conf

2018-07-31 Thread Dimitri Maziuk
On 07/31/2018 01:05 PM, Steve Atkins wrote:

> You'd do that with "include_dir 'conf.d'" or similar, I think, which 
> PostgreSQL
> has in all current versions.

So it does, huh. I guess it helps to read all the way to end of
postgresql.conf sometimes...

-- 
Dimitri Maziuk
Programmer/sysadmin
BioMagResBank, UW-Madison -- http://www.bmrb.wisc.edu



signature.asc
Description: OpenPGP digital signature


Re: Question on postgresql.conf

2018-07-31 Thread Steve Atkins


> On Jul 31, 2018, at 10:59 AM, Dimitri Maziuk  wrote:
> 
> On 07/31/2018 12:33 PM, George Neuner wrote:
> 
>> Is there some reason that postgresql.conf cannot be a link to your
>> file?
> 
> It's six of one, half a dozen of the other. The big problem is when the
> network share is unavailable at host boot and all of your databases are
> belong to bitbucket. If you want to do it right, you need chef/puppet as
> already suggested.
> 
> One useful thing linux (at least) has now is conf.d directories whose
> contents are auto-included after the main config: this way you can keep
> the vendor-provided /etc/blah.conf and have all your host-specific
> settings in /etc/blah.d/myhost.conf, all living together happily ever
> after. You still want the latter to be a local file that's guaranteed
> available when blah service starts up. (Postgres devs: hint! hint!)

You'd do that with "include_dir 'conf.d'" or similar, I think, which PostgreSQL
has in all current versions.

Cheers,
  Steve




Re: Question on postgresql.conf

2018-07-31 Thread Dimitri Maziuk
On 07/31/2018 12:33 PM, George Neuner wrote:

> Is there some reason that postgresql.conf cannot be a link to your
> file?

It's six of one, half a dozen of the other. The big problem is when the
network share is unavailable at host boot and all of your databases are
belong to bitbucket. If you want to do it right, you need chef/puppet as
already suggested.

One useful thing linux (at least) has now is conf.d directories whose
contents are auto-included after the main config: this way you can keep
the vendor-provided /etc/blah.conf and have all your host-specific
settings in /etc/blah.d/myhost.conf, all living together happily ever
after. You still want the latter to be a local file that's guaranteed
available when blah service starts up. (Postgres devs: hint! hint!)

-- 
Dimitri Maziuk
Programmer/sysadmin
BioMagResBank, UW-Madison -- http://www.bmrb.wisc.edu



signature.asc
Description: OpenPGP digital signature


Re: Question on postgresql.conf

2018-07-31 Thread George Neuner
On Mon, 30 Jul 2018 18:35:59 +, "Lu, Dan"  wrote:

>I am going through the PostgreSQL manual and came across a question 
>hoping you can help me.  It appears the "postgresql.conf" file is 
>needed by default to start Postgres.  Since we have standard with 
>other RDBMS to store the configuration file on a shared location for
>easy comparison, I would like to use a different name for this file
>like .conf.

Is there some reason that postgresql.conf cannot be a link to your
file?

George




Re: Question on postgresql.conf

2018-07-31 Thread Dimitri Maziuk

On 7/31/2018 9:36 AM, Matt Zagrabelny wrote:


Or have puppet/chef/ansible/etc. write the correct config file based on 
your dynamic data.


Postgres ain't orrible. I wonder if one actually needs as much 
host-specific config tuning in the first place... I haven't touched 
oracle in forever, though, and mostly managed to repress the memories by 
now.


Dima



Re: Question on postgresql.conf

2018-07-31 Thread Matt Zagrabelny
On Tue, Jul 31, 2018 at 9:21 AM, Tom Lane  wrote:

> "Lu, Dan"  writes:
> > Question:
> > Can  be a variable like `hostname` derived from Unix shell or
> I have to hardcode the name of the host like " include
> /nfs/global/postgres-host123.cnf
>
> Nope, you'd have to hard-code it.
>
> Of course, you could have the startup script that you intended to set the
> env variable just overwrite $PGDATA/postgresql.conf with the right thing.


Or have puppet/chef/ansible/etc. write the correct config file based on
your dynamic data.

-m


Re: Question on postgresql.conf

2018-07-31 Thread Tom Lane
"Lu, Dan"  writes:
> Question:
> Can  be a variable like `hostname` derived from Unix shell or I 
> have to hardcode the name of the host like " include 
> /nfs/global/postgres-host123.cnf

Nope, you'd have to hard-code it.

Of course, you could have the startup script that you intended to set the
env variable just overwrite $PGDATA/postgresql.conf with the right thing.

regards, tom lane



RE: Question on postgresql.conf

2018-07-31 Thread Lu, Dan
Thanks for your reply.

I can start the database like this: pg_ctl start -D /hostname/postgres/data -l 
/hostname/postgres/log

My data directory has the following file:
postgres.cnf

Content of the postgres.cnf contains only 1 line:
include /nfs/global/postgres-.cnf

Question:
Can  be a variable like `hostname` derived from Unix shell or I have 
to hardcode the name of the host like " include /nfs/global/postgres-host123.cnf

-Original Message-
From: Tom Lane [mailto:t...@sss.pgh.pa.us]
Sent: Tuesday, July 31, 2018 9:52 AM
To: Lu, Dan 
Cc: David G. Johnston ; Alvaro Aguayo Garcia-Rada 
; pgsql-gene...@postgresql.org
Subject: Re: Question on postgresql.conf

"Lu, Dan"  writes:
> Say, I want to put the config file on a share drive so all my postgres 
> configuration file can be seen in one location.
> /nfs/global/postgres-.cnf

What I'd do is make each data directory's postgresql.conf contain just this:

include /nfs/global/postgres-.cnf

and then just start the postmaster without any weird switches.
In this way you will avoid breaking PG-specific tools that expect to find the 
config file at its standard location.

regards, tom lane



IMPORTANT: The information contained in this email and/or its attachments is 
confidential. If you are not the intended recipient, please notify the sender 
immediately by reply and immediately delete this message and all its 
attachments. Any review, use, reproduction, disclosure or dissemination of this 
message or any attachment by an unintended recipient is strictly prohibited. 
Neither this message nor any attachment is intended as or should be construed 
as an offer, solicitation or recommendation to buy or sell any security or 
other financial instrument. Neither the sender, his or her employer nor any of 
their respective affiliates makes any warranties as to the completeness or 
accuracy of any of the information contained herein or that this message or any 
of its attachments is free of viruses.



Re: Question on postgresql.conf

2018-07-31 Thread Tom Lane
"Lu, Dan"  writes:
> Say, I want to put the config file on a share drive so all my postgres 
> configuration file can be seen in one location.
> /nfs/global/postgres-.cnf

What I'd do is make each data directory's postgresql.conf
contain just this:

include /nfs/global/postgres-.cnf

and then just start the postmaster without any weird switches.
In this way you will avoid breaking PG-specific tools that
expect to find the config file at its standard location.

regards, tom lane



RE: Question on postgresql.conf

2018-07-31 Thread Lu, Dan
Is this the correct syntax for starting Postgres using a separate config_file 
for each host?  We like to take advantage of the Unix variable “hostname” to 
source in the name of the file.

Machine1: (notice we are using the `hostname` unix variable)
pg_ctl start -D /hostname/postgres/data -l /hostname/postgres/log -o 
config_file="/nfs/global/postgres-`hostname`.cnf"

Machine2: (notice we are using the `hostname` unix variable)
pg_ctl start -D /hostname/postgres/data -l /hostname/postgres/log -o 
config_file="/nfs/global/postgres-`hostname`.cnf"

From: Lu, Dan
Sent: Tuesday, July 31, 2018 7:28 AM
To: 'David G. Johnston' ; Alvaro Aguayo Garcia-Rada 

Cc: pgsql-gene...@postgresql.org
Subject: RE: Question on postgresql.conf

Hi David,

Which command?  Can you give me an example?

Say, I want to put the config file on a share drive so all my postgres 
configuration file can be seen in one location.

/nfs/global/postgres-.cnf

Example:
/nfs/global/postgres-machine1.cnf

/nfs/global/postgres-machine2.cnf

/nfs/global/postgres-machine3.cnf


From: David G. Johnston [mailto:david.g.johns...@gmail.com]
Sent: Tuesday, July 31, 2018 1:48 AM
To: Alvaro Aguayo Garcia-Rada 
mailto:aagu...@opensysperu.com>>
Cc: pgsql-gene...@postgresql.org<mailto:pgsql-gene...@postgresql.org>; Lu, Dan 
mailto:dan...@msx.bala.susq.com>>
Subject: Re: Question on postgresql.conf

On Monday, July 30, 2018, Alvaro Aguayo Garcia-Rada 
mailto:aagu...@opensysperu.com>> wrote:
As far as I know, it's not currently possible.

That would be incorrect, you just need to change server startup commands.

https://www.postgresql.org/docs/10/static/runtime-config-file-locations.html

David J.




IMPORTANT: The information contained in this email and/or its attachments is 
confidential. If you are not the intended recipient, please notify the sender 
immediately by reply and immediately delete this message and all its 
attachments. Any review, use, reproduction, disclosure or dissemination of this 
message or any attachment by an unintended recipient is strictly prohibited. 
Neither this message nor any attachment is intended as or should be construed 
as an offer, solicitation or recommendation to buy or sell any security or 
other financial instrument. Neither the sender, his or her employer nor any of 
their respective affiliates makes any warranties as to the completeness or 
accuracy of any of the information contained herein or that this message or any 
of its attachments is free of viruses.


Re: Question on postgresql.conf

2018-07-31 Thread Fabio Pardi
Hi,

you can read this:

https://www.postgresql.org/docs/current/static/runtime-config-file-locations.html


Basically you will start Postgres as



pg_ctl -D /nfs/global/


but it expects to find a file postgresql.conf (i do not know any way to specify 
a different file name)


inside postgresql.conf you should then specify something like:

data_directory='/your/data/folder'


What probably better fits you is instead the following:

- use the original location of your data folder and postgresql.conf file

- specify inside the file:
include='/nfs/global/postgres-machine1.cnf'

I have doubts on the security implications of that setup, though.


regards,
fabio pardi




On 31/07/18 13:27, Lu, Dan wrote:
>
> Hi David,
>
>  
>
> Which command?  Can you give me an example?
>
>  
>
> Say, I want to put the config file on a share drive so all my postgres 
> configuration file can be seen in one location.
>
>  
>
> /nfs/global/postgres-.cnf
>
>  
>
> Example:
>
> /nfs/global/postgres-machine1.cnf
>
>  
>
> /nfs/global/postgres-machine2.cnf
>
>  
>
> /nfs/global/postgres-machine3.cnf
>
>  
>
>  
>
> *From:*David G. Johnston [mailto:david.g.johns...@gmail.com]
> *Sent:* Tuesday, July 31, 2018 1:48 AM
> *To:* Alvaro Aguayo Garcia-Rada 
> *Cc:* pgsql-gene...@postgresql.org; Lu, Dan 
> *Subject:* Re: Question on postgresql.conf
>
>  
>
> On Monday, July 30, 2018, Alvaro Aguayo Garcia-Rada  <mailto:aagu...@opensysperu.com>> wrote:
>
> As far as I know, it's not currently possible. 
>
>  
>
> That would be incorrect, you just need to change server startup commands.
>
>  
>
> https://www.postgresql.org/docs/10/static/runtime-config-file-locations.html
>
>  
>
> David J.
>
>  
>
>
> --
>
> IMPORTANT: The information contained in this email and/or its attachments is 
> confidential. If you are not the intended recipient, please notify the sender 
> immediately by reply and immediately delete this message and all its 
> attachments. Any review, use, reproduction, disclosure or dissemination of 
> this message or any attachment by an unintended recipient is strictly 
> prohibited. Neither this message nor any attachment is intended as or should 
> be construed as an offer, solicitation or recommendation to buy or sell any 
> security or other financial instrument. Neither the sender, his or her 
> employer nor any of their respective affiliates makes any warranties as to 
> the completeness or accuracy of any of the information contained herein or 
> that this message or any of its attachments is free of viruses.



RE: Question on postgresql.conf

2018-07-31 Thread Lu, Dan
Hi David,

Which command?  Can you give me an example?

Say, I want to put the config file on a share drive so all my postgres 
configuration file can be seen in one location.

/nfs/global/postgres-.cnf

Example:
/nfs/global/postgres-machine1.cnf

/nfs/global/postgres-machine2.cnf

/nfs/global/postgres-machine3.cnf


From: David G. Johnston [mailto:david.g.johns...@gmail.com]
Sent: Tuesday, July 31, 2018 1:48 AM
To: Alvaro Aguayo Garcia-Rada 
Cc: pgsql-gene...@postgresql.org; Lu, Dan 
Subject: Re: Question on postgresql.conf

On Monday, July 30, 2018, Alvaro Aguayo Garcia-Rada 
mailto:aagu...@opensysperu.com>> wrote:
As far as I know, it's not currently possible.

That would be incorrect, you just need to change server startup commands.

https://www.postgresql.org/docs/10/static/runtime-config-file-locations.html

David J.




IMPORTANT: The information contained in this email and/or its attachments is 
confidential. If you are not the intended recipient, please notify the sender 
immediately by reply and immediately delete this message and all its 
attachments. Any review, use, reproduction, disclosure or dissemination of this 
message or any attachment by an unintended recipient is strictly prohibited. 
Neither this message nor any attachment is intended as or should be construed 
as an offer, solicitation or recommendation to buy or sell any security or 
other financial instrument. Neither the sender, his or her employer nor any of 
their respective affiliates makes any warranties as to the completeness or 
accuracy of any of the information contained herein or that this message or any 
of its attachments is free of viruses.


Re: Question on postgresql.conf

2018-07-30 Thread David G. Johnston
On Monday, July 30, 2018, Alvaro Aguayo Garcia-Rada 
wrote:
>
> As far as I know, it's not currently possible.
>

That would be incorrect, you just need to change server startup commands.

https://www.postgresql.org/docs/10/static/runtime-config-file-locations.html

David J.


RE: Question on postgresql.conf

2018-07-30 Thread Alvaro Aguayo Garcia-Rada
Hi.

As far as I know, it's not currently possible. Maybe recompiling, but that 
could not be the best for production environment. I suppose this is this way 
becuase postgres is designed to expect a certain folder structure for it's data 
folder, and configuration files are considered part of it.

As you may see on the documentation:

https://www.postgresql.org/docs/9.6/static/app-postgres.html

You can change the data folder (-D command line option), but, no matter what 
the data folder is, it MUST have a postgresql.conf, as well as pg_hba.conf

However, some distros have made a similar appriach to what you may be looking 
to do. Don't remmeber which one, but there's a distro which it's stabdard 
postgresql server packages store configuration files at /etc/postgresql, while 
storing data at /var/lib/postgresql. This is done by simoly making a symlink, 
like "ln -s /mnt/shared/postgres/server1.conf 
/var/lib/postgres/data/postgresql.conf". Same applies to other conficuration 
files.

Also, if I'm not wrong, you can set custom permissions on configuration 
files(ONLY configuration files, the rest of the data folder must preserve 
postgres standard permissions). Just make sure the postgres user(or the user 
you will be using to run postgres) can read the configuration files.

Regards,

Alvaro Aguayo
Jefe de Operaciones
Open Comb Systems E.I.R.L.

Oficina: (+51-1) 3377813 | Cel.: (+51) 995540103 | RPC: (+51) 954183248
Website: www.ocs.pe

Sent from my Sony Xperia™ smartphone

 Lu, Dan wrote 



Hello PostgreSQL Support Admin,

My name is Dan Lu.  I am fairly new to PostgreSQL.  I have experience working 
with Oracle/MySQL database.

I am going through the PostgreSQL manual and came across a question hoping you 
can help me.  It appears the "postgresql.conf" file is needed by default to 
start Postgres.  Since we have standard with other RDBMS to store the 
configuration file on a shared location for easy comparison, I would like to 
use a different name for this file like .conf.

Is this supported?  I remember coming across a writing that this is possible 
only when we are in a postgres prompt like.  Would you be able to help me out 
and can give me an example of how this can be done?

Thanks.

Dan



IMPORTANT: The information contained in this email and/or its attachments is 
confidential. If you are not the intended recipient, please notify the sender 
immediately by reply and immediately delete this message and all its 
attachments. Any review, use, reproduction, disclosure or dissemination of this 
message or any attachment by an unintended recipient is strictly prohibited. 
Neither this message nor any attachment is intended as or should be construed 
as an offer, solicitation or recommendation to buy or sell any security or 
other financial instrument. Neither the sender, his or her employer nor any of 
their respective affiliates makes any warranties as to the completeness or 
accuracy of any of the information contained herein or that this message or any 
of its attachments is free of viruses.


Question on postgresql.conf

2018-07-30 Thread Lu, Dan
Hello PostgreSQL Support Admin,

My name is Dan Lu.  I am fairly new to PostgreSQL.  I have experience working 
with Oracle/MySQL database.

I am going through the PostgreSQL manual and came across a question hoping you 
can help me.  It appears the "postgresql.conf" file is needed by default to 
start Postgres.  Since we have standard with other RDBMS to store the 
configuration file on a shared location for easy comparison, I would like to 
use a different name for this file like .conf.

Is this supported?  I remember coming across a writing that this is possible 
only when we are in a postgres prompt like.  Would you be able to help me out 
and can give me an example of how this can be done?

Thanks.

Dan



IMPORTANT: The information contained in this email and/or its attachments is 
confidential. If you are not the intended recipient, please notify the sender 
immediately by reply and immediately delete this message and all its 
attachments. Any review, use, reproduction, disclosure or dissemination of this 
message or any attachment by an unintended recipient is strictly prohibited. 
Neither this message nor any attachment is intended as or should be construed 
as an offer, solicitation or recommendation to buy or sell any security or 
other financial instrument. Neither the sender, his or her employer nor any of 
their respective affiliates makes any warranties as to the completeness or 
accuracy of any of the information contained herein or that this message or any 
of its attachments is free of viruses.