Buenos días a todos: Días atrás preguntaba sobre como tunear un PostgreSQL para producción y una de las cosas que me recomendaron fue aumentar el tamaño de algunas variables en el postgresql.conf. Estas son las modificaciones que hice: -shared_buffers = 1200MB -work_mem = 16MB -effective_cache_size = 2GB Dichos valores requieren que se aumenten otros a nivel de Kernel en el Linux donde tengo montado el Postgres. Pues cuando intento iniciar o reiniciar el servidor me da este error:
#/etc/init.d/postgresql-8.3 restart * Restarting PostgreSQL 8.3 database server * The PostgreSQL server failed to start. Please check the log output: 2009-05-20 09:20:01 CDT FATAL: could not create shared memory segment: Invalid argument 2009-05-20 09:20:01 CDT DETAIL: Failed system call was shmget(key=5432001, size=1282195456, 03600). 2009-05-20 09:20:01 CDT HINT: This error usually means that PostgreSQL's request for a shared memory segment exceeded your kernel's SHMMAX parameter. You can either reduce the request size or reconfigure the kernel with larger SHMMAX. To reduce the request size (currently 1282195456 bytes), reduce PostgreSQL's shared_buffers parameter (currently 153600) and/or its max_connections parameter (currently 103). If the request size is already small, it's possible that it is less than your kernel's SHMMIN parameter, in which case raising the request size or reconfiguring SHMMIN is called for. The PostgreSQL documentation contains more information about shared memory configuration. La solución es "sencilla" pues solamente necesito ejecutar estos dos comandos para modificar las variables a nivel de kernel del SO. # sysctl -w kernel.shmmax=1282195456 kernel.shmmax = 1282195456 # sysctl -w kernel.shmall=2097152 kernel.shmall = 2097152 Ahora todo bien hasta el momento, una vez que ejecuto dichos comandos Postgre inicia sin problema alguno. ¿Dónde está el problema? Si por alguna casualidad tengo que reiniciar el Servidor (no el Postgre) esas variables reestablecen su valor original y entonces Postgres no inicia correctamente por lo que tengo que ejecutar el proceso completo nuevamente. Supuestamente haciendo esto: #echo 1282195456 >/proc/sys/kernel/shmmax #echo 2097152 >/proc/sys/kernel/shmall Cuando reinicie el sistema debería tomar esos valores pero no lo está haciendo. ¿Alguna idea o solución alternativa? Un saludo y desde ya gracias Ing. Reynier Pérez Mira Dirección Técnica IP -- TIP 7: no olvides aumentar la configuración del "free space map"