Postgresql wont restart. Can I clear shared memmory segments without rebooting?
I have a remote server running debian etch,
that has only 1G of ram, (that i cannot easily add ram to), that runs
a large postgresql 7.4 database and it occasionally runs out of enough shared memory. The database is static
and I no longer add data to it. The machine sits on the network and is just for serving up data.
When it runs out of memory, the postgresl database shuts down and the postgresql server will not restart.
I get a message about not enough shared memory when I try to restart postgresql.
While this is happening, when I ran top I saw that the swap space was utilized extensively while the was
some free regular memory (i dont have the output to show).
However i did run and saved the output of the program
vmstat and got this data
procs -----------memory---------- ---swap-- -----io---- -system-- ----cpu----
r b swpd free buff cache si so bi bo in cs us sy id wa
0 0 1951552 208876 28340 42528 14 11 13 11 10 13 2 1 59 39
Now ordinarily when I run the server, (the postgresql crashing happens about once every 3 or 4 weeks)
and I typically reboot the machine and all is fine.
In ordinary use there is no problem, I typically have the following output from top.
Tasks: 96 total, 2 running, 93 sleeping, 0 stopped, 1 zombie
Cpu(s): 0.0%us, 0.0%sy, 0.0%ni,100.0%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
Mem: 906784k total, 897804k used, 8980k free, 5428k buffers
Swap: 1951856k total, 132k used, 1951724k free, 761704k cached
Now what I usually do is simply reboot the machine and everything is fine.
While I can continue to do this, but it goes against the grain. Is there some system command to free the
shared memory so that postgresql will start again without rebooting?
The only significant application that runs on the machine is essentially this postgresql database...
Rebooting is so 'windows(c)'...