Re: Is it possible to control the location of the lock file when starting postgres?

Поиск
Список
Период
Сортировка
От rob stone
Тема Re: Is it possible to control the location of the lock file when starting postgres?
Дата
Msg-id 1469065650.5157.12.camel@gmail.com
обсуждение исходный текст
Ответ на Re: Is it possible to control the location of the lock file when starting postgres?  (Steve Langlois <steve.langlois@tavve.com>)
Список pgsql-general
On Thu, 2016-07-21 at 00:12 +0000, Steve Langlois wrote:
>
> > On Jul 20, 2016, at 7:48 PM, Steve Langlois <steve.langlois@tavve.c
> > om> wrote:
> >
> > > you never did answer my previous question, why are you messing
> > > about with manually starting postgres from the wrong user
> > > account, when it should be run as a system service with systemctl
> > > ?
> > I am upgrading an existing system running CentOS 5.6 with Postgres
> > 8.2.5 to CentOS 7 with 9.2.15. The original system modified the
> > postgresql script to manually running postmaster to start the
> > database under the current user control. So it is really for
> > compatibility with the rest of the code. 
> >
> > If local is used for unix domain socket connections do I change --
> > auth to --auth-local=ident for initdb?
> >
>
> I tried the following:
>
> /usr/bin/initdb --pgdata=/usr/test/databases/pgsql1/data --auth-
> local=trust
>
> changed unix_socket_directories = '/tmp’ in postgresql.conf.
>
> Then ran:
>
> /usr/bin/postgres -k /tmp -D /usr/tavve/databases/pgsql1/data &
>
> Contents of pg_hba.conf is 
>
> # TYPE  DATABASE        USER            ADDRESS                
> METHOD
>
> # "local" is for Unix domain socket connections only
> local   all             all                                     trust
> # IPv4 local connections:
> host    all             all             127.0.0.1/32            trust
> # IPv6 local connections:
> host    all             all             ::1/128                 trust
> # Allow replication connections from localhost, by a user with the
> # replication privilege.
> #local   replication     slanglois                              
>  trust
> #host    replication     slanglois        127.0.0.1/32          
>  trust
> #host    replication     slanglois        ::1/128                
> trust
>
> Then I try to run psql and 
>
> [20:01:11 slanglois@tron bin]$ psql
> psql: could not connect to server: No such file or directory
> Is the server running locally and accepting
> connections on Unix domain socket
> "/var/run/postgresql/.s.PGSQL.5432”?
>
> I would expect local all all trust to allow me to connect.



On my testing box this is my pg_hba.conf

local   all             all                                     trust
host    all             all             127.0.0.1/32            trust
host    all             all             ::1/128                 trust

"local" is for psql, etc.
"host" is for JDBC connections

Connection and authentication settings in postgresql.conf

listen_addresses = 'localhost'
port = 5435
max_connections = 100
unix_socket_directories = '/var/run/postgresql'
#unix_socket_group = ''
unix_socket_permissions = 0770 


(I'm using port 5435 for 9.6beta testing)

psql does not start the database engine.

Whichever method you use to start it, that user (usually postgres) has
to own the /var/run/postgresql path and have write permissions.

E.g.:-

-rw-r--r-- 1 postgres postgres 5 Jul 21 03:57 9.6-main.pid


A similar set-up is used for 9.4 and 9.5. I haven't used 9.2 for some
years now, and as John pointed out, that version is nearing the end of
its maintenance cycle. However, I believe a similar set-up was used.
This is running on Debian.

HTH,

Rob




В списке pgsql-general по дате отправления:

Предыдущее
От: John R Pierce
Дата:
Сообщение: Re: Is it possible to control the location of the lock file when starting postgres?
Следующее
От: Adrian Klaver
Дата:
Сообщение: Re: upsert with trigger (or rule)