I happen to have 2 installed instances of postgresql at my machine: 9.1 and 9.2:

sudo service postgresql status
9.1/main (port 5432): down
9.2/main (port 5433): down

They are located at /etc/postgresql/9.1/ and /etc/postgresql/9.2/. Then I run 9.2 by saying sudo service postgresql start

But this command fails:

$ psql
psql: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?

I really want to use 9.2 only, I don't need 2 instances.

Do you have any idea of how to either remove 9.1 safely or make 9.2 to be the main, default instance?

-------------------------------------------------------------------------------------------------------

This situation with two clusters in Ubuntu may happen when upgrading to a newer release providing an newer postgresql version.

The automatic upgrade does not remove the old cluster, presumably for fear of erasing valuable data (which is wise because some postgres upgrades may require human work to be complete).

If you know you want to drop it, just run:

sudo pg_dropcluster --stop 9.1 main 

The corresponding data directory will be removed and service postgresql will no longer refer to 9.1

At this point the 9.2 cluster will still use the port 5433, which is unpractical.

To switch it to the default port, edit /etc/postgresql/9.2/main/postgresql.conf and change the line port = 5433 to port = 5432

Then restart PostgreSQL.

Finally to get rid of the postgresql-9.1 packages see the result of dpkg -l 'postgresql*9.1*'

2 instances of postgresql but I really need one [closed]的更多相关文章

  1. 解决postgresql -- ERROR: 42601: query has no destination for result data

    I am learning Npgsql and PostgreSQL. I am unable to define the output parameter correctly. What am I ...

  2. PostgreSQL configuration file postgresql.conf recommanded settings and how it works

    1        Set max_connections to three times the number of processor cores on the server. Include vir ...

  3. LINQ to PostgreSQL Tutorial

    原文 LINQ to PostgreSQL Tutorial This tutorial guides you through the process of creating a simple app ...

  4. Java向PostgreSQL发送prepared statement 与 libpq 向PostgreSQL发送prepared statement之比较:

    Java 代码,在数据库端,并没有当成 prepared statetment 被处理. C代码通过libpq 访问数据库端,被当成了 prepared statement 处理.也许是因Postgr ...

  5. PostgreSQL Q&A: Building an Enterprise-Grade PostgreSQL Setup Using Open Source Tools

    转自:https://www.percona.com/blog/2018/10/19/postgresql-building-enterprise-grade-setup-with-open-sour ...

  6. 【转帖】如何在redhat单机服务器上运行postgresql的多个实例(howto run multiple postgresql instance on one redhat server)

    Running multiple PostgreSQL 9.2 Instances on one server in CentOS 6/RHEL 6/Fedora 原帖网站速度很慢,故转帖在此 Thi ...

  7. postgreSQL PL/SQL编程学习笔记(六)——杂七杂八

    1 PL/pgSQL Under the Hood This part discusses some implementation details that are frequently import ...

  8. 云原生 PostgreSQL - CrunchyData PGO 教程:创建、连接、删除 Postgres 集群

    入门 作为安装的一部分,请确保您已完成以下操作: 分叉 Postgres Operator 示例存储库并将其克隆到您的主机. https://github.com/CrunchyData/postgr ...

  9. postgresql 基本语法

    postgresql数据库创建/修改/删除等写入类代码语法总结: 1,创建库 2,创建/删除表 2.1 创建表 create table myTableName 2.2 如果表不存在则创建表 crea ...

随机推荐

  1. 386 Lexicographical Numbers 字典序排数

    给定一个整数 n, 返回从 1 到 n 的字典顺序.例如,给定 n =1 3,返回 [1,10,11,12,13,2,3,4,5,6,7,8,9] .请尽可能的优化算法的时间复杂度和空间复杂度. 输入 ...

  2. D. Fedor and coupons 二分暴力

    http://codeforces.com/contest/754/problem/D 给出n条线段,选出k条,使得他们的公共部分长度最大. 公共部分的长度,可以二分出来,为val.那么怎么判断有k条 ...

  3. 记一个java.lang.NoClassDefFoundError的问题

    如题,即找不到对应class,出现这个问题,很可能是文件路径配置错误,也可能是jar包丢失. 比如我今天遇到的问题,就是IDEA没有把mybatis的jar包复制到编译目录造成的.

  4. 关于串通京东接口的demo

    public string Get(int id) { JObject o = new JObject( new JProperty("billNo", "ESL1363 ...

  5. 对比hive和mysql查询汇总

    由于底层的处理机制大不相同,hive和mysql在查询上还是有较大差异的! 单个表的select操作 最简单的查询 ,字段2 frome 表名 where 字段 [not]in(元素1,元素2): 例 ...

  6. CAD保存文件为各种格式

    <p class="mtext"> 主要用到函数说明:</p><p style="line-height: 0.6;"> & ...

  7. 视频剪辑生成gif格式(php外挂python程序)完美!

    接到朋友的需求,朋友是做php的,让我帮忙处理php生成gif的需求.他的项目类似抖音短视频那种,就是展示出来的界面是gif动图,然后点进去是完整的视频. 我想了想,我倒是没做过php生成gif的需求 ...

  8. Java基础——面向对象(封装——继承——多态 )

    对象 对象: 是类的实例(实现世界中 真 实存在的一切事物 可以称为对象) 类: 类是对象的抽象描述 步骤: 1.定义一个类 (用于 描述人:) ( * 人:有特征和行为) 2.根据类 创建对象 -- ...

  9. LeetCode_16 3SumCloest

    3Sum Closest Given an array nums of n integers and an integer target, find three integers in nums su ...

  10. Extjs选中多行Grid提交

    要实现的效果如图:可以选择多行grid然后提交给后台 1,Extjs中grid如何可以选择多行? 定义一个grid,将色了Type设置为多选即可 selType: 'checkboxmodel', 2 ...