Обсуждение: Three Variations of postgresql.conf

Поиск
Список
Период
Сортировка

Three Variations of postgresql.conf

От
Michael Convey
Дата:
In Ubuntu 14.10, there are three variations of the postgresql.conf configuration file, as follows: 

/var/lib/postgresql/9.4/main/postgresql.auto.conf
/usr/lib/tmpfiles.d/postgresql.conf
/etc/postgresql/9.4/main/postgresql.conf

What is the difference between these files and which is the correct one to change for modifying the configurations contained therein?

Re: Three Variations of postgresql.conf

От
Adrian Klaver
Дата:
On 11/12/2015 07:46 AM, Michael Convey wrote:
> In Ubuntu 14.10, there are three variations of the postgresql.conf
> configuration file, as follows:
>
> /var/lib/postgresql/9.4/main/postgresql.auto.conf

The above is for when you do ALTER SYSTEM:
http://www.postgresql.org/docs/9.4/interactive/sql-altersystem.html

> /usr/lib/tmpfiles.d/postgresql.conf

This is system file that the OS seems to be using to determine where to
run Postgres sockets, create temp files, etc:

"# Directory for PostgreSQL sockets, lockfiles and stats tempfiles
d /var/run/postgresql 2775 postgres postgres - -
# Log directory
d /var/log/postgresql 1775 root postgres - -
"

I would leave this one alone.

In my 14.04 install there are also files for sshd and xconsole.

> /etc/postgresql/9.4/main/postgresql.conf

The above is the primary conf file for the cluster. This is where you
want to change variables, if you are not using ALTER SYSTEM.

>
> What is the difference between these files and which is the correct one
> to change for modifying the configurations contained therein?


--
Adrian Klaver
adrian.klaver@aklaver.com


Re: Three Variations of postgresql.conf

От
Melvin Davidson
Дата:
Ubuntu does not use the standard pg_ctl for postgreSQL. Instead, it uses pg_ctlcluster.
That in turn controls the different PostgreSQL clusters. When you do an install of a new cluster, pg_ctlcluster is smart enough to put postgresql.conf & pg_hba.conf into separate dirs.
So to be specific, /usr/lib/tmpfiles.d/postgresql.conf is just a tmp file that you can ingnore, /etc/postgresql/9.4/main/postgresql.conf is the original version for the 9.4 cluster and /var/lib/postgresql/9.4/main/postgresql.auto.conf is the actual, live version of the 9.4 cluster that you need to change to affect the 9.4 cluster. Likewise for the pg_hba.conf.

On Thu, Nov 12, 2015 at 10:46 AM, Michael Convey <smconvey@gmail.com> wrote:
In Ubuntu 14.10, there are three variations of the postgresql.conf configuration file, as follows: 

/var/lib/postgresql/9.4/main/postgresql.auto.conf
/usr/lib/tmpfiles.d/postgresql.conf
/etc/postgresql/9.4/main/postgresql.conf

What is the difference between these files and which is the correct one to change for modifying the configurations contained therein?



--
Melvin Davidson
I reserve the right to fantasize.  Whether or not you
wish to share my fantasy is entirely up to you.

Re: Three Variations of postgresql.conf

От
Adrian Klaver
Дата:
On 11/12/2015 08:07 AM, Melvin Davidson wrote:
> Ubuntu does not use the standard pg_ctl for postgreSQL. Instead, it uses
> pg_ctlcluster.
> That in turn controls the different PostgreSQL clusters. When you do an
> install of a new cluster, pg_ctlcluster is smart enough to put
> postgresql.conf & pg_hba.conf into separate dirs.
> So to be specific, /usr/lib/tmpfiles.d/postgresql.conf is just a tmp
> file that you can ingnore, /etc/postgresql/9.4/main/postgresql.conf is
> the original version for the 9.4 cluster and

No, it is the actual conf file for the cluster.

> /var/lib/postgresql/9.4/main/postgresql.auto.conf is the actual, live
> version of the 9.4 cluster that you need to change to affect the 9.4
> cluster. Likewise for the pg_hba.conf.

No, as you can see if look in the file:

# Do not edit this file manually!
# It will be overwritten by the ALTER SYSTEM command.

There is no pg_hba.conf file in /var/lib/postgresql/9.4/main/ it is in
/etc/postgresql/9.4/main/

/etc/postgresql/* is where configuration is done, with the exception of
those done through ALTER SYSTEM, which are persisted in
postgresql.auto.conf.

>
> On Thu, Nov 12, 2015 at 10:46 AM, Michael Convey <smconvey@gmail.com
> <mailto:smconvey@gmail.com>> wrote:
>
>     In Ubuntu 14.10, there are three variations of the postgresql.conf
>     configuration file, as follows:
>
>     /var/lib/postgresql/9.4/main/postgresql.auto.conf
>     /usr/lib/tmpfiles.d/postgresql.conf
>     /etc/postgresql/9.4/main/postgresql.conf
>
>     What is the difference between these files and which is the correct
>     one to change for modifying the configurations contained therein?
>
>
>
>
> --
> *Melvin Davidson*
> I reserve the right to fantasize.  Whether or not you
> wish to share my fantasy is entirely up to you.


--
Adrian Klaver
adrian.klaver@aklaver.com


Re: Three Variations of postgresql.conf

От
Tom Lane
Дата:
Adrian Klaver <adrian.klaver@aklaver.com> writes:
> On 11/12/2015 08:07 AM, Melvin Davidson wrote:
>> In Ubuntu 14.10, there are three variations of the postgresql.conf
>> configuration file, as follows:
>>
>> /var/lib/postgresql/9.4/main/postgresql.auto.conf
>> /usr/lib/tmpfiles.d/postgresql.conf
>> /etc/postgresql/9.4/main/postgresql.conf

FWIW, I would imagine that /usr/lib/tmpfiles.d/postgresql.conf is
a configuration file for the system's tmp-file-cleaner daemon
(probably telling it not to flush some postgres-related files),
not a PG config file at all.  If you look into it you'll likely
find that it doesn't look anything like PG configuration data.

As already noted, postgresql.auto.conf is not for hand-editing.

            regards, tom lane


Re: Three Variations of postgresql.conf

От
Melvin Davidson
Дата:
To clarify.

To see the ACTUAL clusters installed, and the LIVE config directories, you use
pg_lsclusters.

pg_ctlclusters then can control each individual cluster

So, for example, since apparently you have the 9.4 version of PostgreSQL,
pg_ctlcluster 9.4 main status
would probably show you that the 9.4 version of PostgreSQL is active and will also show you the command line arguments used to start it.


On Thu, Nov 12, 2015 at 11:29 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
Adrian Klaver <adrian.klaver@aklaver.com> writes:
> On 11/12/2015 08:07 AM, Melvin Davidson wrote:
>> In Ubuntu 14.10, there are three variations of the postgresql.conf
>> configuration file, as follows:
>>
>> /var/lib/postgresql/9.4/main/postgresql.auto.conf
>> /usr/lib/tmpfiles.d/postgresql.conf
>> /etc/postgresql/9.4/main/postgresql.conf

FWIW, I would imagine that /usr/lib/tmpfiles.d/postgresql.conf is
a configuration file for the system's tmp-file-cleaner daemon
(probably telling it not to flush some postgres-related files),
not a PG config file at all.  If you look into it you'll likely
find that it doesn't look anything like PG configuration data.

As already noted, postgresql.auto.conf is not for hand-editing.

                        regards, tom lane



--
Melvin Davidson
I reserve the right to fantasize.  Whether or not you
wish to share my fantasy is entirely up to you.

Re: Three Variations of postgresql.conf

От
Adrian Klaver
Дата:
On 11/12/2015 08:37 AM, Melvin Davidson wrote:
> To clarify.
>
> To see the ACTUAL clusters installed, and the LIVE config directories,
> you use
> pg_lsclusters.

Actually:

aklaver@arkansas:~$ pg_lsclusters

Ver Cluster Port Status Owner    Data directory               Log file

9.3 main    5432 down   postgres /var/lib/postgresql/9.3/main
/var/log/postgresql/postgresql-9.3-main.log

9.4 main    5434 online postgres /var/lib/postgresql/9.4/main
/var/log/postgresql/postgresql-9.4-main.log

You get the $DATA directories and the log files. The config directories
are in /etc/postgresql/*

>
> pg_ctlclusters then can control each individual cluster
>
> So, for example, since apparently you have the 9.4 version of PostgreSQL,
> pg_ctlcluster 9.4 main status
> would probably show you that the 9.4 version of PostgreSQL is active and
> will also show you the command line arguments used to start it.
>
>
> On Thu, Nov 12, 2015 at 11:29 AM, Tom Lane <tgl@sss.pgh.pa.us
> <mailto:tgl@sss.pgh.pa.us>> wrote:
>
>     Adrian Klaver <adrian.klaver@aklaver.com
>     <mailto:adrian.klaver@aklaver.com>> writes:
>     > On 11/12/2015 08:07 AM, Melvin Davidson wrote:
>     >> In Ubuntu 14.10, there are three variations of the postgresql.conf
>     >> configuration file, as follows:
>     >>
>     >> /var/lib/postgresql/9.4/main/postgresql.auto.conf
>     >> /usr/lib/tmpfiles.d/postgresql.conf
>     >> /etc/postgresql/9.4/main/postgresql.conf
>
>     FWIW, I would imagine that /usr/lib/tmpfiles.d/postgresql.conf is
>     a configuration file for the system's tmp-file-cleaner daemon
>     (probably telling it not to flush some postgres-related files),
>     not a PG config file at all.  If you look into it you'll likely
>     find that it doesn't look anything like PG configuration data.
>
>     As already noted, postgresql.auto.conf is not for hand-editing.
>
>                              regards, tom lane
>
>
>
>
> --
> *Melvin Davidson*
> I reserve the right to fantasize.  Whether or not you
> wish to share my fantasy is entirely up to you.


--
Adrian Klaver
adrian.klaver@aklaver.com


Re: Three Variations of postgresql.conf

От
Melvin Davidson
Дата:
Oops, I forgot to mention pg_initicluster, which is used to initiate the various version/cluster combinations in Ubuntu.
It makes it easier to have several versions and clusters on the same server, albeit that is not what most people/companies usually do.
eg: In Ubuntu, you could possibly have the following on one server:

Ver Cluster Port Status Owner    Data directory                    Log file
9.1  prod    5432 online  postgres /var/lib/postgresql/9.1/prod /var/log/postgresql/postgresql-9.1-prod.log
9.1  dev      5433 online postgres /var/lib/postgresql/9.1/dev   /var/log/postgresql/postgresql-9.1-dev.log
9.4  prod    5435 online  postgres /var/lib/postgresql/9.4/prod /var/log/postgresql/postgresql-9.4-prod.log
9.4  dev      5436 online postgres /var/lib/postgresql/9.4/dev   /var/log/postgresql/postgresql-9.4-dev.log
9.4  qa       5437 online postgres /var/lib/postgresql/9.4/qa    /var/log/postgresql/postgresql-9.4-qa.log

On Thu, Nov 12, 2015 at 11:56 AM, Adrian Klaver <adrian.klaver@aklaver.com> wrote:
On 11/12/2015 08:37 AM, Melvin Davidson wrote:
To clarify.

To see the ACTUAL clusters installed, and the LIVE config directories,
you use
pg_lsclusters.

Actually:

aklaver@arkansas:~$ pg_lsclusters

Ver Cluster Port Status Owner    Data directory               Log file

9.3 main    5432 down   postgres /var/lib/postgresql/9.3/main /var/log/postgresql/postgresql-9.3-main.log

9.4 main    5434 online postgres /var/lib/postgresql/9.4/main /var/log/postgresql/postgresql-9.4-main.log

You get the $DATA directories and the log files. The config directories are in /etc/postgresql/*


pg_ctlclusters then can control each individual cluster

So, for example, since apparently you have the 9.4 version of PostgreSQL,
pg_ctlcluster 9.4 main status
would probably show you that the 9.4 version of PostgreSQL is active and
will also show you the command line arguments used to start it.


On Thu, Nov 12, 2015 at 11:29 AM, Tom Lane <tgl@sss.pgh.pa.us
<mailto:tgl@sss.pgh.pa.us>> wrote:

    Adrian Klaver <adrian.klaver@aklaver.com
    <mailto:adrian.klaver@aklaver.com>> writes:
    > On 11/12/2015 08:07 AM, Melvin Davidson wrote:
    >> In Ubuntu 14.10, there are three variations of the postgresql.conf
    >> configuration file, as follows:
    >>
    >> /var/lib/postgresql/9.4/main/postgresql.auto.conf
    >> /usr/lib/tmpfiles.d/postgresql.conf
    >> /etc/postgresql/9.4/main/postgresql.conf

    FWIW, I would imagine that /usr/lib/tmpfiles.d/postgresql.conf is
    a configuration file for the system's tmp-file-cleaner daemon
    (probably telling it not to flush some postgres-related files),
    not a PG config file at all.  If you look into it you'll likely
    find that it doesn't look anything like PG configuration data.

    As already noted, postgresql.auto.conf is not for hand-editing.

                             regards, tom lane




--
*Melvin Davidson*
I reserve the right to fantasize.  Whether or not you
wish to share my fantasy is entirely up to you.


--
Adrian Klaver
adrian.klaver@aklaver.com



--
Melvin Davidson
I reserve the right to fantasize.  Whether or not you
wish to share my fantasy is entirely up to you.