Hi, I need to run a number of PostgreSQL servers in different FreeBSD jails. I managed to run a first instance of PostgreSQL server in a jail, but after I launch a new server in another jail the first one starts to return an error messages like the following: semctl(1507328, 4, SETVAL, 0) failed: Invalid argument The problem in general is: only one instance of PostgreSQL server processes clients' connections, all of the others return semctl errors. The system is FreeBSD 5.4-PRERELEASE. PostgreSQL-7.4.7. SEM and SHM sysctl setting are: # sysctl -a | grep shm kern.ipc.shmmax: 100000000 kern.ipc.shmmin: 1 kern.ipc.shmmni: 192 kern.ipc.shmseg: 128 kern.ipc.shmall: 32768 kern.ipc.shm_use_phys: 0 kern.ipc.shm_allow_removed: 0 # sysctl -a | grep sem kern.ipc.semmap: 256 kern.ipc.semmni: 256 kern.ipc.semmns: 512 kern.ipc.semmnu: 256 kern.ipc.semmsl: 60 kern.ipc.semopm: 100 kern.ipc.semume: 10 kern.ipc.semusz: 92 kern.ipc.semvmx: 32767 kern.ipc.semaem: 16384 Trying to solve the problem I've set the following in postgresql.conf files: max_connections = 5 shared_buffers = 100 Please help! What am I doing wrong? -- Alexander Rusinov
On Tue, Apr 26, 2005 at 05:58:27PM +0300, Alexander Rusinov wrote:> Hi, > > I need to run a number of PostgreSQL servers in different FreeBSD jails.Is SYSV IPC allowed for jails? It's not enabled by default. -- Spartak Radchenko SVR1-RIPE
Alexander Rusinov <boot@eurocom.od.ua> wrote:> Hi, > > I need to run a number of PostgreSQL servers in different FreeBSD jails. > I managed to run a first instance of PostgreSQL server in a jail, but > after I launch a new server in another jail the first one starts to > return an error messages like the following: > > semctl(1507328, 4, SETVAL, 0) failed: Invalid argument > > The problem in general is: only one instance of PostgreSQL server > processes clients' connections, all of the others return semctl errors.I had this exact same problem. I never found a solution. The cause appears to be that, since shared memory is not segregated between jails, the newly launched Postgres instances corrupt the shared memory of previously running Postgres instances. Supposedly, this shouldn't be possible, but it was happening and I never found a solution.> > The system is FreeBSD 5.4-PRERELEASE. PostgreSQL-7.4.7. SEM and SHM > sysctl setting are: > > # sysctl -a | grep shm > kern.ipc.shmmax: 100000000 > kern.ipc.shmmin: 1 > kern.ipc.shmmni: 192 > kern.ipc.shmseg: 128 > kern.ipc.shmall: 32768 > kern.ipc.shm_use_phys: 0 > kern.ipc.shm_allow_removed: 0 > > # sysctl -a | grep sem > kern.ipc.semmap: 256 > kern.ipc.semmni: 256 > kern.ipc.semmns: 512 > kern.ipc.semmnu: 256 > kern.ipc.semmsl: 60 > kern.ipc.semopm: 100 > kern.ipc.semume: 10 > kern.ipc.semusz: 92 > kern.ipc.semvmx: 32767 > kern.ipc.semaem: 16384 > > Trying to solve the problem I've set the following in postgresql.conf > files: > max_connections = 5 > shared_buffers = 100 > > Please help! What am I doing wrong? > > -- > Alexander Rusinov > > _______________________________________________ > freebsd-stable@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-stable > To unsubscribe, send any mail to "freebsd-stable-unsubscribe@freebsd.org"-- Bill Moran Potential Technologies http://www.potentialtech.com
On 26/04/05, Alexander Rusinov <boot@eurocom.od.ua> wrote:> Hi, > > I need to run a number of PostgreSQL servers in different FreeBSD jails. > I managed to run a first instance of PostgreSQL server in a jail, but > after I launch a new server in another jail the first one starts to > return an error messages like the following: > > semctl(1507328, 4, SETVAL, 0) failed: Invalid argument > > The problem in general is: only one instance of PostgreSQL server > processes clients' connections, all of the others return semctl errors. > > The system is FreeBSD 5.4-PRERELEASE. PostgreSQL-7.4.7. SEM and SHM > sysctl setting are:Just add the following line to your /etc/rc.conf jail_sysvipc_allow="YES" and ipc configuration will be shared with the jails Regards -- Renato Botelho ICQ: 54596223 AIM: RBGargaBR
>>> >>> Just add the following line to your /etc/rc.conf >>> >>> jail_sysvipc_allow="YES" >>> and ipc configuration will be shared with the jails >>> >>> >> I have IPC enabled for jails already. So unfortunately this is not a >> solution. >> >> Is anybody here who do run several jailed PostgreSQL servers? >> > AFAIR PostgreSQL generates the shared memory identifier based on the > port it is runing on. It is possible to run two instances of > PostgreSQL on different ports, so it should work if they are in > seperate jails.Actually, I'm using unix sockets for those servers so I never thought about changing the port number. But now I tried and ... that helped! Thank you! I guess this is a workaround but not a solution though.
An unknown poster wrote:> AFAIR PostgreSQL generates the shared memory identifier based on > the port it is runing on. It is possible to run two instances of > PostgreSQL on different ports, so it should work if they are in > seperate jails.Correct. Alexander Rusinov <boot@eurocom.od.ua> writes:> I guess this is a workaround but not a solution though.There are two possible solutions: - hack the SysV IPC code to use separate namespaces for each jail - make PostgreSQL use POSIX shared memory instead of SysV shared memory I suspect that the latter is significantly easier, and would probably improve performance as well. DES -- Dag-Erling Sm?rgrav - des@des.no
Dag-Erling Sm?rgrav wrote:> There are two possible solutions: > > - hack the SysV IPC code to use separate namespaces for each jail > > - make PostgreSQL use POSIX shared memory instead of SysV shared > memory > > I suspect that the latter is significantly easier, and would probably > improve performance as well. > > DESIt might be easier to hack PostgreSQL so that the shared memory identifier depends not only on the port, but also on the IP address (which will of course be different for each jail). Or better yet, to be able to specify the shared memory identifier to use directly in the config file. Richard Coleman rcoleman@criticalmagic.com