Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unrecognized configuration parameter "dynamic_shared_memory_type"

Tags:

php

postgresql

I am having trouble connecting to postgres (installed using hombrew version 9.4.4). I have previously been able to connect successfully. The only thing that I believe could have changed is I installed PHP 5.5.

I try to start the server:

postgres -D /usr/local/var/postgres

LOG:  unrecognized configuration parameter "dynamic_shared_memory_type"
in file "/usr/local/var/postgres/postgresql.conf" line 130
FATAL:  configuration file "/usr/local/var/postgres/postgresql.conf"
contains errors

My server logs return the same errors. Here is the contents of the postgresql.conf file that is throwing the error:

dynamic_shared_memory_type = posix  # the default is the first option
                # supported by the operating system:
                #   posix
                #   sysv
                #   windows
                #   mmap
                # use none to disable dynamic shared memory

In attempts to troubleshoot, I commented out dynamic_shared_memory_type and got this error:

FATAL:  database files are incompatible with server
DETAIL:  The data directory was initialized by PostgreSQL version 9.4, 
which is not compatible with this version 9.3.5.

However, running brew info postgres, I am told my version is 9.4.4.

like image 631
Kyle Giard-Chase Avatar asked Aug 03 '15 22:08

Kyle Giard-Chase


1 Answers

This command:

$ postgres -D /usr/local/var/postgres

launches whatever postgres binary appears first in the $PATH.

In your case it happens to be postgres 9.3.5, presumably from a previous install and/or another installer. That version can't work with the postgresql.conf for 9.4.x because of the new dynamic_shared_memory_type parameter, but more importantly it can't work with a 9.4.x data directory anyway (data formats are not compatible across major versions).

The command which postgres would tell where it is on disk.

Normally the postgres binary for brew should be located in /usr/local/bin/postgres. To avoid conflicting with another postgres, launch it with an absolute path instead of relative:

$ /usr/local/bin/postgres -D /usr/local/var/postgres

and

 $ /usr/local/bin/postgres -v

to just check for the version number.

On Mac OS X, there are quite a few different installers, as listed in:
https://wiki.postgresql.org/wiki/Installers/Mac_OS_X
with different disk layouts. It's not unusual on Mac to try different installers and end up with several postgres installs in parallel.

like image 187
Daniel Vérité Avatar answered Oct 31 '22 02:10

Daniel Vérité