微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

在OpenBSD上配置PostgreSQL

当Postgresql安装完成后,我们进行以下操作

su-_postgresql
initdb-D/var/postgresql/data-Upostgres-EUTF8-Amd5-W

之后我们需要配置自动启动

OpenBSD 5.6版本

配置自动启动rc.local

if[-x/usr/local/bin/pg_ctl];then
echo-n'postgresql'
su-l_postgresql-c"nohup/usr/local/bin/pg_ctlstart\
-D/var/postgresql/data-l/var/postgresql/logfile\
-o'-D/var/postgresql/data'>/dev/null"
fi

配置自动停止

if[-f/var/postgresql/data/postmaster.pid];then
su-l_postgresql-c"/usr/local/bin/pg_ctlstop-mfast\
-D/var/postgresql/data"
rm-f/var/postgresql/data/postmaster.pid
fi

OpenBSD 5.7版本

在rc.conf.local中添加

pkg_scripts=postgresql

或使用新的rcctl工具

rcctlenablepostgresql

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐