PostgreSQL——启动脚本

<仅供参考,执行結果受环境影响>

如下:

pgpath='/usr/local/pgsql/bin'
pgdata='/usr/local/pgsql/data'

#以 postgres 用户身份启动 postgresql 服务进程
su postgres -c "$pgpath/postgres >> $pgdata/logfile 2>&1 &"

pid=$(head -n 1 $pgdata/postmaster.pid)

#防止 postgresql 主进程被 OOM_killer 杀掉
(echo -1000 > /proc/$pid/oom_score_adj ; echo -17 > /proc/$pid/oom_adj) 2>$pgdata/logfile

#开启大頁内存(8GB == 2MB × 4096echo 4096 > /proc/sys/vm/nr_hugepages

 

posted @ 2015-10-30 19:45  范辉  阅读(895)  评论(0编辑  收藏  举报