大网数据广告活动
服务器运维问答

I have multiple PostgreSQL servers installed. How do I disable auto boot for older server?

· 52CE 我爱测

I'm running Ubuntu 12.04 on Oracle VirtualBox. A couple months ago, I installed PostgreSQL server version 9.1 on my machine. Just recently, I learned that PostgreSQL server 9.3 supports JSON data types, so I decided to upgrade. I…

问题原文

原帖链接 · BitPusher16 · CC BY-SA 3.0

I'm running Ubuntu 12.04 on Oracle VirtualBox. A couple months ago, I installed PostgreSQL server version 9.1 on my machine. Just recently, I learned that PostgreSQL server 9.3 supports JSON data types, so I decided to upgrade.

I upgraded to 9.3 by following the instructions here:

https://wiki.postgresql.org/wiki/Apt

wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install postgresql-9.3 pgadmin3

This installed server version 9.3 on my machine alongside version 9.1. Running pg_lsclusters after a fresh boot gives:

Ver Cluster Port Status Owner    Data directory               Log file
9.1 main    5433 online postgres /var/lib/postgresql/9.1/main /var/log/postgresql/postgresql-9.1-main.log
9.3 main    5432 online postgres /var/lib/postgresql/9.3/main /var/log/postgresql/postgresql-9.3-main.log

I then did the following post-upgrade maintenance: I exported several tables from my 9.1 server with pg_dump and restored them to my 9.3 server. I then opened my config files for 9.1 and 9.3 at /etc/postgresql/$VERSION/main/postgresql.conf and swapped their port numbers so that my psql client connects to the new server by default.

My question is this. Both 9.1 and 9.3 start on boot. I would like to prevent 9.1 from auto booting, as it takes up roughly 5% of my system memory. How can I do this?

Resources consulted:

The PostgreSQL doc page on starting a server points me to the standard init.d directory. My init.d directory does contain the script postgresql. It looks like this script can be configured to launch only one version, but the required change is not obvious to me.

http://www.postgresql.org/docs/9.1/interactive/server-start.html

The post below was very informative, but it shows how to remove a cluster, not how to disable one on startup. I would like to leave my older cluster installed, as I may want to retrieve further information from it.

I think I have multiple postgresql servers installed, how do I identify and delete the 'extra' ones?

I have considered writing a script to kill the server once the system has finished loading, but this seems inefficient. Is there a cleaner way to disable version 9.1 on boot?

已采纳解答

原帖链接 · ch2500 · CC BY-SA 4.0

For less of a hack, edit /etc/postgresql/9.1/main/start.conf and replace auto with manual or disabled.

Note: Invoke systemctl daemon-reload after editing this file.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2014-03-17)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0 / CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。