Обсуждение: Installation woes via Macports on Mac OS X 10.7

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

Installation woes via Macports on Mac OS X 10.7

От
René Fournier
Дата:
I've tried installation 8.4 and 9.0 on two different machines, and at the end can't start Postgresql. Here's the basic story:

[…]
--->  Building postgresql90-server
--->  Staging postgresql90-server into destroot
--->  Creating launchd control script
###########################################################
# A startup item has been generated that will aid in
# starting postgresql90-server with launchd. It is disabled
# by default. Execute the following command to start it,
# and to cause it to launch at startup:
#
# sudo port load postgresql90-server
###########################################################
--->  Installing postgresql90-server @9.0.5_0

To create a database instance, after install do
 sudo mkdir -p /opt/local/var/db/postgresql90/defaultdb
 sudo chown postgres:postgres /opt/local/var/db/postgresql90/defaultdb
 sudo su postgres -c '/opt/local/lib/postgresql90/bin/initdb -D /opt/local/var/db/postgresql90/defaultdb'

To tweak your DBMS, consider increasing kern.sysv.shmmax by adding an increased kern.sysv.shmmax .. to /etc/sysctl.conf
--->  Activating postgresql90-server @9.0.5_0
--->  Cleaning postgresql90-server
Fri Oct 07 11:24:33 -- Baby-Irmo :: sudo port load postgresql90-server
Password:
Fri Oct 07 14:13:34 -- Baby-Irmo :: sudo mkdir -p /opt/local/var/db/postgresql90/defaultdb
Fri Oct 07 14:13:40 -- Baby-Irmo ::  sudo chown postgres:postgres /opt/local/var/db/postgresql90/defaultdb
Fri Oct 07 14:13:41 -- Baby-Irmo :: sudo vi /etc/sysctl.conf
Fri Oct 07 14:15:46 -- Baby-Irmo :: sudo sysctl -w kern.sysv.shmall=65536
kern.sysv.shmall: 1024 -> 65536
Fri Oct 07 14:15:50 -- Baby-Irmo :: sudo sysctl -w kern.sysv.shmmax=16777216
kern.sysv.shmmax: 4194304 -> 16777216
Fri Oct 07 14:15:52 -- Baby-Irmo :: sudo su postgres -c '/opt/local/lib/postgresql90/bin/initdb -D /opt/local/var/db/postgresql90/defaultdb'
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.

The database cluster will be initialized with locale en_CA.UTF-8.
The default database encoding has accordingly been set to UTF8.
The default text search configuration will be set to "english".

fixing permissions on existing directory /opt/local/var/db/postgresql90/defaultdb ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 12MB
creating configuration files ... ok
creating template1 database in /opt/local/var/db/postgresql90/defaultdb/base/1 ... ok
initializing pg_authid ... ok
initializing dependencies ... ok
creating system views ... ok
loading system objects' descriptions ... ok
creating conversions ... ok
creating dictionaries ... ok
setting privileges on built-in objects ... ok
creating information schema ... ok
loading PL/pgSQL server-side language ... ok
vacuuming database template1 ... ok
copying template1 to template0 ... ok
copying template1 to postgres ... ok

WARNING: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the -A option the
next time you run initdb.

Success. You can now start the database server using:

    /opt/local/lib/postgresql90/bin/postgres -D /opt/local/var/db/postgresql90/defaultdb
or
    /opt/local/lib/postgresql90/bin/pg_ctl -D /opt/local/var/db/postgresql90/defaultdb -l logfile start

Fri Oct 07 14:17:58 -- Baby-Irmo :: /opt/local/lib/postgresql90/bin/postgres -D /opt/local/var/db/postgresql90/defaultdb
Fri Oct 07 14:18:04 -- Baby-Irmo :: /opt/local/lib/postgresql90/bin/psql -U postgres
psql: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
Fri Oct 07 14:18:20 -- Baby-Irmo :: ps -ax | grep "postgres"
   56 ??         0:08.28 /usr/bin/postgres -D /var/pgsql -c listen_addresses= -c log_connections=on -c log_directory=/Library/Logs -c log_filename=PostgreSQL.log -c log_lock_waits=on -c log_statement=ddl -c log_line_prefix=%t  -c logging_collector=on -c unix_socket_directory=/var/pgsql_socket -c unix_socket_group=_postgres -c unix_socket_permissions=0770
  226 ??         0:33.67 postgres: logger process                           
  253 ??         1:41.76 postgres: writer process                           
  254 ??         1:12.68 postgres: wal writer process                           
  255 ??         0:23.39 postgres: autovacuum launcher process                           
  256 ??         0:38.62 postgres: stats collector process                           
28695 ??         0:00.01 /opt/local/bin/daemondo --label=postgresql90-server --start-cmd /opt/local/etc/LaunchDaemons/org.macports.postgresql90-server/postgresql90-server.wrapper start ; --stop-cmd /opt/local/etc/LaunchDaemons/org.macports.postgresql90-server/postgresql90-server.wrapper stop ; --restart-cmd /opt/local/etc/LaunchDaemons/org.macports.postgresql90-server/postgresql90-server.wrapper restart ; --pid=none
28796 ttys002    0:00.00 grep postgres
Fri Oct 07 14:21:11 -- Baby-Irmo :: /opt/local/lib/postgresql90/bin/psql -U postgres
psql: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
Fri Oct 07 14:21:31 -- Baby-Irmo :: 


Any ideas what I need to do?

…Rene


Re: Installation woes via Macports on Mac OS X 10.7

От
Scott Ribe
Дата:
On Oct 7, 2011, at 2:24 PM, René Fournier wrote:

> I've tried installation 8.4 and 9.0 on two different machines, and at the end can't start Postgresql. Here's the
basicstory: 

You can't change shmall & shmmax after boot. They must be set during startup. If you're on a recent version of OS X,
youdo this in /etc/sysctl.conf. 

Also the /usr/bin/postgres that you seen running is not where macports puts it and not the one you tried to start a
coupleof lines earlier, so you have something already installed on your system that is running a postgres instance. 

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





Re: Installation woes via Macports on Mac OS X 10.7

От
René Fournier
Дата:
Hi Scott,

On 2011-10-07, at 2:57 PM, Scott Ribe wrote:

On Oct 7, 2011, at 2:24 PM, René Fournier wrote:

I've tried installation 8.4 and 9.0 on two different machines, and at the end can't start Postgresql. Here's the basic story:

You can't change shmall & shmmax after boot. They must be set during startup. If you're on a recent version of OS X, you do this in /etc/sysctl.conf.

Well, I changed them at the shell and in sysctl, and restarted (on both machines).


Also the /usr/bin/postgres that you seen running is not where macports puts it and not the one you tried to start a couple of lines earlier, so you have something already installed on your system that is running a postgres instance.

Yes, I forgot that machine was running Lion Server (with Postgresql already running).

However, on the other computer, running regular 10.7, the same problem persists, without a /usr/bin version.

Fri Oct 07 15:45:25 -- Frodo :: which psql
/opt/local/lib/postgresql84/bin/psql
Fri Oct 07 15:45:26 -- Frodo :: psql -U postgres
psql: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
Fri Oct 07 15:45:29 -- Frodo :: ps -ax | grep "postgres"
26486 ??         0:00.08 /opt/local/bin/daemondo --label=postgresql84-server --start-cmd /opt/local/etc/LaunchDaemons/org.macports.postgresql84-server/postgresql84-server.wrapper start ; --stop-cmd /opt/local/etc/LaunchDaemons/org.macports.postgresql84-server/postgresql84-server.wrapper stop ; --restart-cmd /opt/local/etc/LaunchDaemons/org.macports.postgresql84-server/postgresql84-server.wrapper restart ; --pid=none
30843 ??         0:00.00 /opt/local/bin/daemondo --label=postgresql90-server --start-cmd /opt/local/etc/LaunchDaemons/org.macports.postgresql90-server/postgresql90-server.wrapper start ; --stop-cmd /opt/local/etc/LaunchDaemons/org.macports.postgresql90-server/postgresql90-server.wrapper stop ; --restart-cmd /opt/local/etc/LaunchDaemons/org.macports.postgresql90-server/postgresql90-server.wrapper restart ; --pid=none
30880 ttys002    0:00.00 grep postgres
Fri Oct 07 15:45:31 -- Frodo :: 

So one thing that's odd, I have two version of postgresql apparently running (although I've removed 9.0 from Macports)… Not sure if this is the cause. Any other suggestions?

Best regards,
René Fournier

Re: Installation woes via Macports on Mac OS X 10.7

От
Scott Ribe
Дата:
On Oct 7, 2011, at 3:48 PM, René Fournier wrote:

> Well, I changed them at the shell and in sysctl, and restarted (on both machines).

Check them at the shell. If they're not what you set in sysctl.conf, then your sysctl.conf is not correct, and since
youcan't change them after startup, you won't be able to launch pg with anything but a tiny shared buffers setting.
Thereare restrictions on them, such as shmall being an even multiple of the VM page size, and some relationship or
otherbetween shmall & shmmax but I don't remember the details. 

> So one thing that's odd, I have two version of postgresql apparently running (although I've removed 9.0 from
Macports)…Not sure if this is the cause. Any other suggestions? 

Yes. Figure out where the logging for the postgres instances you are trying to launch are going, and read the log
messages.Or maybe they're just going to console--check that first. 

You'll have a bit of difficulty getting help here, because you're not likely to find people who know what those
wrappers(daemondo & postgresql84-server.wrapper) actually do, since they're not part of postgresql. One thing you
shouldknow, it is possible to have 2 versions of pg running at the same time, but it is not possible to have 2 versions
runningon the default port at the same time, or in the same data directory ("cluster" in pg terminology). 

Also, you don't have any actual pg instances running there. What you have is some kind of wrapper that tries to launch
pg.That wrapper is failing to launch, and either looping, or quitting and being relaunched--depending on how it is set
up,which I have no idea about. 


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





Re: Installation woes via Macports on Mac OS X 10.7

От
Tom Lane
Дата:
=?iso-8859-1?Q?Ren=E9_Fournier?= <renefournier@gmail.com> writes:
> I've tried installation 8.4 and 9.0 on two different machines, and at the end can't start Postgresql. Here's the
basicstory: 

No, you started it all right, because it's there in the ps output:

> Fri Oct 07 14:18:20 -- Baby-Irmo :: ps -ax | grep "postgres"
>    56 ??         0:08.28 /usr/bin/postgres -D /var/pgsql -c listen_addresses= -c log_connections=on -c
log_directory=/Library/Logs-c log_filename=PostgreSQL.log -c log_lock_waits=on -c log_statement=ddl -c
log_line_prefix=%t -c logging_collector=on -c unix_socket_directory=/var/pgsql_socket -c unix_socket_group=_postgres -c
unix_socket_permissions=0770
>   226 ??         0:33.67 postgres: logger process
>   253 ??         1:41.76 postgres: writer process
>   254 ??         1:12.68 postgres: wal writer process
>   255 ??         0:23.39 postgres: autovacuum launcher process
>   256 ??         0:38.62 postgres: stats collector process
The problem is with that command-line option
"unix_socket_directory=/var/pgsql_socket" that your startup wrapper is
evidently feeding to the postmaster.  That means your postmaster is
listening on a socket file in /var/pgsql_socket, which is not where your
psql is expecting to find it:

> Fri Oct 07 14:18:04 -- Baby-Irmo :: /opt/local/lib/postgresql90/bin/psql -U postgres
> psql: could not connect to server: No such file or directory
> Is the server running locally and accepting
> connections on Unix domain socket "/tmp/.s.PGSQL.5432"?

Here, psql shows it's expecting to find the socket file in /tmp, which
is the default location for PG socket files.

While there are defensible reasons for putting the socket file somewhere
other than /tmp, I'd have to say that an installation wrapper that
thinks it should change that setting on the postmaster command line is
just about as incompetent as it could possibly be.  That's equivalent to
changing the default port number and not bothering to tell the clients
about it.  You need to find a packaging built by somebody with more of a
clue than that.  It's not helping any that you seem to be using a psql
that was built independently of the postmaster (why is the postmaster in
/usr/bin when your psql is in /opt/local/lib/postgresql90?) ... but
frankly, I cannot imagine a sane reason for setting
unix_socket_directory with that mechanism, unless you're intentionally
trying to make it hard to connect.  (And those unix_socket_group and
unix_socket_permissions settings are making it even harder ...)

            regards, tom lane

Re: Installation woes via Macports on Mac OS X 10.7

От
Neil Tiffin
Дата:
On Oct 8, 2011, at 1:01 AM, Tom Lane wrote:

> =?iso-8859-1?Q?Ren=E9_Fournier?= <renefournier@gmail.com> writes:
>> I've tried installation 8.4 and 9.0 on two different machines, and at the end can't start Postgresql. Here's the
basicstory: 
>
> No, you started it all right, because it's there in the ps output:
>
>> Fri Oct 07 14:18:20 -- Baby-Irmo :: ps -ax | grep "postgres"
>>   56 ??         0:08.28 /usr/bin/postgres -D /var/pgsql -c listen_addresses= -c log_connections=on -c
log_directory=/Library/Logs-c log_filename=PostgreSQL.log -c log_lock_waits=on -c log_statement=ddl -c
log_line_prefix=%t -c logging_collector=on -c unix_socket_directory=/var/pgsql_socket -c unix_socket_group=_postgres -c
unix_socket_permissions=0770
>>  226 ??         0:33.67 postgres: logger process
>>  253 ??         1:41.76 postgres: writer process
>>  254 ??         1:12.68 postgres: wal writer process
>>  255 ??         0:23.39 postgres: autovacuum launcher process
>>  256 ??         0:38.62 postgres: stats collector process
> The problem is with that command-line option
> "unix_socket_directory=/var/pgsql_socket" that your startup wrapper is
> evidently feeding to the postmaster.  That means your postmaster is
> listening on a socket file in /var/pgsql_socket, which is not where your
> psql is expecting to find it:
>
>> Fri Oct 07 14:18:04 -- Baby-Irmo :: /opt/local/lib/postgresql90/bin/psql -U postgres
>> psql: could not connect to server: No such file or directory
>> Is the server running locally and accepting
>> connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
>
> Here, psql shows it's expecting to find the socket file in /tmp, which
> is the default location for PG socket files.
>
> While there are defensible reasons for putting the socket file somewhere
> other than /tmp, I'd have to say that an installation wrapper that
> thinks it should change that setting on the postmaster command line is
> just about as incompetent as it could possibly be.  That's equivalent to
> changing the default port number and not bothering to tell the clients
> about it.  You need to find a packaging built by somebody with more of a
> clue than that.  It's not helping any that you seem to be using a psql
> that was built independently of the postmaster (why is the postmaster in
> /usr/bin when your psql is in /opt/local/lib/postgresql90?) ... but
> frankly, I cannot imagine a sane reason for setting
> unix_socket_directory with that mechanism, unless you're intentionally
> trying to make it hard to connect.  (And those unix_socket_group and
> unix_socket_permissions settings are making it even harder ...)
>

You might try http://www.postgresqlformac.com/

Neil