Ubuntu升级后的多个Postgres实例

前端之家收集整理的这篇文章主要介绍了Ubuntu升级后的多个Postgres实例前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
刚刚将Ubuntu升级到最新版本,但现在我有两个Postgres实例.

8.4和9.1

问题是我不知道第二个端口在哪个端口上运行?

如何检测正在运行的端口….

如果我运行cristi @ cristi-hp:/usr/share / postgresql-common $sudo -u postgres psql
psql(8.4.8)
输入“帮助”以获取帮助.

如何使用psql for 9.1?

两者似乎都运行:
cristi @ cristi-hp:/usr/share / postgresql-common $sudo /etc/init.d/postgresql start
密码的[sudo]密码:
*启动Postgresql 8.4数据库服务器[确定]
*启动Postgresql 9.1数据库服务器

谢谢…

Ubuntu是一个基于Debian的系统,能够像你看到的那样运行Postgres的多个实例.通常,除非另外配置,否则启动的第一个实例将具有默认的Postgres端口,并且每个后续实例将采用下一个更高的端口(如果可用).这些端口可以在/ etc / postgresql /< version> /< cluster> /下的配置文件中定义,以便它们在您需要时不会更改,但我确实需要.实际上粗略看一下/etc/init.d/postgresql也会告诉您可以通过/ etc / postgresql /< version> /< cluster> / environment设置环境变量.

包管理器甚至还包括/usr/share/doc/postgresql-common/README.Debian.gz,它有一个快速解释如何处理集群管理的部分,包括pg_lsclusters命令,它将为您提供Postgres版本和端口号以及有关每个已配置群集的其他详细信息.

要回答有关停止实例的评论中的问题…您可以编辑/ etc / postgresql /< version> /< cluster> /下的start.conf文件,并将其从auto更改为disabled或manual.引用默认的start.conf文件本身…

# Automatic startup configuration
# auto: automatically start/stop the cluster in the init script
# manual: do not start/stop in init scripts,but allow manual startup with
#         pg_ctlcluster
# disabled: do not allow manual startup with pg_ctlcluster (this can be easily
#           circumvented and is only meant to be a small protection for
#           accidents).
原文链接:https://www.f2er.com/ubuntu/348036.html

猜你在找的Ubuntu相关文章