Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fkli7-0006Hl-9d for pgsql-general@arkaria.postgresql.org; Wed, 01 Aug 2018 07:38:19 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fkli5-0001zp-85 for pgsql-general@arkaria.postgresql.org; Wed, 01 Aug 2018 07:38:17 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fkli4-0001zi-W7 for pgsql-general@lists.postgresql.org; Wed, 01 Aug 2018 07:38:17 +0000 Received: from 23-25-19-49-static.hfc.comcastbusiness.net ([23.25.19.49] helo=jeeves.wrkhors.com) by magus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fkli1-0006am-40 for pgsql-general@postgresql.org; Wed, 01 Aug 2018 07:38:16 +0000 Received: from wrkhors.com (localhost [127.0.0.1]) by jeeves.wrkhors.com (Postfix) with ESMTP id C123210EF4B; Wed, 1 Aug 2018 02:52:50 -0500 (CDT) Date: Wed, 1 Aug 2018 02:37:18 -0500 From: Steven Lembark To: Alvaro Aguayo Garcia-Rada Cc: pgsql-general@postgresql.org, "Lu, Dan" , lembark@wrkhors.com Subject: Re: Question on postgresql.conf Message-ID: <20180801023718.0664ed27@wrkhors.com> In-Reply-To: <1725191888.48995.1533013367672.JavaMail.zimbra@adriana.opensysperu.com> References: <364bc889f8634b5a811a603a3ff725df@msx.bala.susq.com> <1725191888.48995.1533013367672.JavaMail.zimbra@adriana.opensysperu.com> Organization: Workhorse Computing MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk 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 lembark@wrkhors.com +1 888 359 3508