PostgreSQL in FreeBSD jails

Marc G. Fournier scrappy at hub.org
Tue May 3 08:04:15 PDT 2005


On Tue, 3 May 2005, [iso-8859-1] Dag-Erling Smørgrav wrote:

> PostgreSQL has always had this problem, both on 4.x and 5.x.  A hack was 
> put in place last November to work around it, but it still exists, and 
> while it may now be possible (with 8.0) for multiple postmasters to run 
> on the same machine

'k, I've been doing multiple since 7.2 on the same machine, all on the 
same port, all different IPs, all on 4.x servers ... have never had an 
issue with crashes (its pretty much my most stable 4.x server) ...

In fact:

# ps aux | grep postmaster | egrep -v "postmaster:" | sort +1 -n
scrappy 36569  0.0  0.0 14552  600  ??  IsJ  19Apr05   0:21.48 /usr/local/pgsql/bin/postmaster -D /usr/local/pgsql/data -S (postgres)
scrappy 36675  0.0  0.0 258184 1052  ??  SsJ  19Apr05  14:10.24 /usr/local/bin/postmaster -D /usr/local/pgsql/data -S (postgres)
scrappy 36865  0.0  0.0 16556  836  ??  IsJ  19Apr05   0:14.17 /usr/local/bin/postmaster -D /usr/local/pgsql/data -S (postgres)
pgsql   37518  0.0  0.0 16400  396  ??  IsJ  19Apr05   0:04.02 /usr/local/bin/postmaster (postgres)
pgsql   37815  0.0  0.0  8144  436  p9- IJ   19Apr05   0:14.62 /usr/local/bin/postmaster (postgres)
pgsql   37962  0.0  0.0  8680  560  ??  IsJ  19Apr05   0:08.72 /usr/local/bin/postmaster (postgres)
pgsql   38168  0.0  0.0 16400  452  ??  IsJ  19Apr05   0:37.69 /usr/local/bin/postmaster (postgres)
pgsql   38316  0.0  0.0  7144  464  ??  IsJ  19Apr05   0:04.08 /usr/local/bin/postmaster (postgres)
pgsql   38458  0.0  0.0  7208  380  ??  IsJ  19Apr05   0:04.01 /usr/local/bin/postmaster (postgres)
pgsql   38596  0.0  0.0  6952  452  ??  IsJ  19Apr05   0:03.90 /usr/local/bin/postmaster (postgres)
scrappy 38717  0.0  0.0  6952  436  ??  IsJ  19Apr05   0:03.98 /usr/local/bin/postmaster (postgres)
pgsql   38868  0.0  0.0  8224  552  ??  SsJ  19Apr05   0:03.39 /usr/local/bin/postmaster -D /usr/local/pgsql/data (postgres)
pgsql   38993  0.0  0.0  7912  584  ??  IsJ  19Apr05   0:06.41 /usr/local/bin/postmaster (postgres)
pgsql   39126  0.0  0.0  7480  400  ??  IsJ  19Apr05   0:01.80 /usr/local/bin/postmaster -D /usr/local/pgsql/data (postgres)
pgsql   87544  0.0  0.1  7948 3528  ??  IsJ  Sun08PM   0:00.78 /usr/local/bin/postmaster -D /usr/local/pgsql/data (postgres)

# ipcs -a | fgrep -f /tmp/pids | sort +10 -n
m 327683    5432003 --rw-------  scrappy     1001  scrappy     1001      7 10256384  36569  38717 8:40:46 11:51:28  8:37:57
m 131076    5432004 --rw-------  scrappy     1001  scrappy     1001    100 257957888  36675  38717 8:40:46 11:54:16  8:38:04
m 10092549    5432005 --rw-------  scrappy     1001  scrappy     1001     12 10362880  36865  38717 8:40:46 11:29:20  8:38:25
m 131080    5432007 --rw-------    pgsql    pgsql    pgsql    pgsql      1 10436608  37518  39126 8:41:20 11:53:08  8:39:18
m 131081    5432008 --rw-------    pgsql    pgsql    pgsql    pgsql      6 2449408  37815  39126 8:41:20 11:52:32  8:39:43
m 393226    5432009 --rw-------    pgsql    pgsql    pgsql    pgsql      9 2596864  37962  39126 8:41:20 11:50:25  8:39:55
m 131083    5432010 --rw-------    pgsql    pgsql    pgsql    pgsql      1 10436608  38168  39126 8:41:20 11:52:15  8:40:06
m 1048588    5432011 --rw-------    pgsql    pgsql    pgsql    pgsql      1 1024000  38316  39126 8:41:20 11:51:53  8:40:19
m 131085    5432012 --rw-------    pgsql    pgsql    pgsql    pgsql      1 1024000  38458  39126 8:41:20 11:50:28  8:40:29
m 131086    5432013 --rw-------    pgsql    pgsql    pgsql    pgsql      1 761856  38596  39126 8:41:20 11:53:02  8:40:38
m 131087    5432014 --rw-------  scrappy     1001  scrappy     1001      1 761856  38717  38717 8:40:46 11:50:42  8:40:46
m 131088    5432015 --rw-------    pgsql    pgsql    pgsql    pgsql      2 811008  38868  39126 8:41:20  1:59:39  8:40:58
m 1507345    5432016 --rw-------    pgsql    pgsql    pgsql    pgsql      1 761856  38993  39126 8:41:20 11:50:37  8:41:07
m 1310738    5432017 --rw-------    pgsql    pgsql    pgsql    pgsql      2 811008  39126  39126 8:41:20  0:59:01  8:41:20
m 196615    5432001 --rw-------    pgsql    pgsql    pgsql    pgsql     11 1548288  87544  8754420:32:30 11:50:56 20:32:30


So, unless I'm missing something here, each postmaster is acquiring its 
own ID, and the above servers consist of the following versions (all of 
which are built from ports):

    1 postgresql-7.2.4_2
    1 postgresql-7.4.1
    1 postgresql-7.4.1_1
    1 postgresql-7.4.2
    2 postgresql-7.4.5
    4 postgresql-7.4.6
    1 postgresql-devel-8.0.0,1
    1 postgresql-server-7.4.7
    1 postgresql-server-7.4.7_3
    1 postgresql-server-8.0.0
    1 postgresql-server-8.0.1_3

So, unless I'm missing something, 4.x did allow for running multiple 
PostgreSQL servers, on the same machine, in multiple jails, each with 
their own distinct shared memory segment ... or am I mis-reading the 
above?

> it is also still possible for malicious code in one jail to crash
> postmasters in other jails.

That one I can agree with, which is why all our database servers are on a 
seperate machine that 'clients' don't have access to ...

----
Marc G. Fournier           Hub.Org Networking Services (http://www.hub.org)
Email: scrappy at hub.org           Yahoo!: yscrappy              ICQ: 7615664


More information about the freebsd-stable mailing list