@pg学习笔记
1:各个系统自动启动脚本位置:安装包的contrib目录

2:将linux脚本复制到/etc/init.d 目录,并命名为:postgresql

3:然后做以下修改:
将prefix设置为postgresql的安装路径:/usr/local/postgresql
将PGDATA设置为postgresql的数据目录路径:/usr/local/postgresql/data
将PGUSER设置为postgresql的用户:admin
启动脚本:
选中部分注释:
添加:su - postgres -c “/usr/local/postgresql/bin/pg_ctl start -D /usr/local/postgresql/data -l /usr/local/postgresql/log/postgresql.log”

将PGLOG 设置为 postgresql 的数据目录的日志文件夹下:$PGDATA/pg_log/serverlog

4:添加到开机自启动
修改文件:chmod a+x postgresql
添加开机启动:chkconfig --add postgresql
5:重启测试

本文介绍了如何在Linux系统中配置PostgreSQL的自动启动脚本,包括将脚本移动到/etc/init.d目录,设置prefix、PGDATA、PGUSER等环境变量,添加启动命令,以及将其添加至开机自启动列表的过程。
2169

被折叠的 条评论
为什么被折叠?



