如何在Linux上重启时启动PGBouncer自动启动?

Windows Azure VM中的Ubuntu 12.04(精确)上,我在同一台机器上运行了postgres和pgbouncer.一切都设置好并且有效但是当重新启动VM时,pgbouncer不会自动启动.

>我如何制作它以便在重启时启动?
> Postgres是否需要在PGBouncer之前运行?如果是这样,这是如何实现的?我假设PGBouncer仍会运行,如果Postgres没有运行,或者这个假设是错误的,任何sql连接都无法连接?

我开始运行它的命令如下.注意:我需要成为’postgres’用户才能启动服务,否则会失败.还详细的答案preferrend. Linux不是我的普通操作系统.

sudo su postgres
pgbouncer -d -v /etc/pgbouncer/pgbouncer.ini

如果有用,这就是pgbouncer的安装方式:

sudo apt-get install postgresql-9.3 pgbouncer

注意:我只能在第一次运行pgbouncer -d -v /etc/pgbouncer/pgbouncer.ini命令后才能与pgbouncer服务(强制重新加载,状态,启动,停止)进行交互.

最佳答案
编辑/ etc / default / pgbouncer并设置

START=1

然后使用init脚本启动pgbouncer:

/etc/init.d/pgbouncer start

init脚本将在启动时自动启动pgbouncer.但是你需要设置START = 1.

相关文章

文章浏览阅读1.8k次,点赞63次,收藏54次。Linux下的目录权限...
文章浏览阅读1.6k次,点赞44次,收藏38次。关于Qt的安装、Wi...
本文介绍了使用shell脚本编写一个 Hello
文章浏览阅读1.5k次,点赞37次,收藏43次。【Linux】初识Lin...
文章浏览阅读3k次,点赞34次,收藏156次。Linux超详细笔记,...
文章浏览阅读6.8k次,点赞109次,收藏114次。【Linux】 Open...