连接失败问题

使用postgres数据库连接工具测试,遇到两次失败

第一个登录失败问题

Connection to 192.168.XX.XX:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.
Connection refused: connect
Connection refused: connect

这语句翻译下,用户名密码是正确的,但是tcp/ip的连接失败了。这个解决方法其实就是去建立tcp/ip连接过程。

原因是宿主机并没有监听其他的主机接口,因此没有建立连接。

解决方法

修改/var/lib/pgsql/9.6/data/postgresql.conf
新增listen_addresses = '*' #what IP address(es) to listen on
#默认
listen_addresses = 'localhost'

第二个登录失败问题

The server doesn't grant access to the database: the server reports
FATAL: no pg_hba.conf entry for host "192.168.X.X", user "postgres", database "postgres"
#FATA:no pg_hba.conf entry for host "192.168.113.1",user "postgres",database "postgres",SSL off

这个问题也说这个主机没有权限访问数据库,也告诉配置文件在哪:pg_hba.conf。

pg_hba.conf为PostgreSQL的访问策略配置文件,默认位于/var/lib/pgsql/9.6/data/pg_hba.conf目录(postgres 9.6)。

该配置文件有5个参数,分别为:TYPE(主机类型)、DATABASE(数据库名)、USER(用户名)、ADDRESS(IP地址和掩码)、METHOD(加密方法)。

关于这个配置文件可以参考PostgreSQL的pg_hba.conf文件讲解。

解决方式增加选项支持所所有的主机ip访问

增加

host    all             all             0.0.0.0/0               md5

postgres登录失败Connection refused与SSL off失败的更多相关文章

  1. cas 单点登录出现org.jasig.cas.client.util.CommonUtils.getResponseFromServer - 拒绝连接 Connection refused

    cas 单点登录出现org.jasig.cas.client.util.CommonUtils.getResponseFromServer - 拒绝连接 Connection refused 环境: ...

  2. docker登录报错Error response from daemon: Get https://192.168.30.10/v1/users/: dial tcp 192.168.30.10:443: connect: connection refused

    背景描述: 登录docker报错: [root@localhost sysconfig]# docker login 192.168.30.10 Username (newcs06): newcs06 ...

  3. ZooKeeper集群搭建中的Connection refused而导致的启动失败

    1. 前言 每一次搭建集群环境都像一次战斗,作战中任何一个细节的出错都会导致严重的后果,所以搭建中所需要做的配置如系统配置.网络配置(防火墙记得关).用户权限.文件权限还有配置文件等等内容,都必须非常 ...

  4. Linux用sendmail发信失败,提示Connection refused by [127.0.0.1]

    现象: Linux用sendmail发信失败,提示Connection refused by [127.0.0.1] 29 14:10:44 iZ257p7xxilZ sendmail[3395]: ...

  5. com.microsoft.sqlserver.jdbc.SQLServerException: 到主机 的 TCP/IP 连接失败。 java.net.ConnectException: Connection refused: connect

      问题描述:最简单的数据库连接报错,到主机  的 TCP/IP 连接失败.(win 7 操作系统) 错误信息: com.microsoft.sqlserver.jdbc.SQLServerExcep ...

  6. 使用putty远程登录Ubuntu时,报Network error:Connection refused错误及解决

    putty远程登录Ubuntu,弹出Network error:Connection refused的错误提示框,就是因为Ubuuntu没有安装ssh服务. 执行命令: sudo apt instal ...

  7. 使用putty远程登录Ubuntu时,报Network error:Connection refused错误

    putty远程登录Ubuntu,弹出Network error:Connection refused的错误提示框,就是因为Ubuuntu没有安装ssh服务.执行命令: sudo apt-get ins ...

  8. ssh本机失败(ssh: connect to host localhost port 22: Connection refused)

    ssh本机失败(ssh: connect to host localhost port 22: Connection refused) 一. 问题描述 之前一直在服务上使用宝塔面板, 今天突发奇想, ...

  9. 使用putty远程登录Ubuntu时,报Network error:Connection refused错误及解决(记录)

    putty远程登录Ubuntu,弹出Network error:Connection refused的错误提示框,就是因为Ubuuntu没有安装ssh服务.执行命令: sudo apt-get ins ...

随机推荐

  1. Django框架之登录案例

    内容: (1)request.GET和request.POST (2)获取get方法提交和post方法提交的数据 一.登录案例 登录逻辑代码 def login(request): if reques ...

  2. Springboot学习:SpringMVC自动配置

    Spring MVC auto-configuration Spring Boot 自动配置好了SpringMVC 以下是SpringBoot对SpringMVC的默认配置:==(WebMvcAuto ...

  3. 九、Appium-python-UI自动化之通过text定位

    1.通过xpath定位text xpath路径为://android.widget.EditText[@text='请输入包含街道的完整地址'] 2.通过AndroidUIAutomator # 这个 ...

  4. 14. 深入解析Pod对象(一)

    14. 深入解析Pod对象(一) """ 通过前面的讲解,大家应该都知道: Pod,而不是容器,它是 Kubernetes 项目中的最小编排单位.将这个设计落实到 API ...

  5. 【Fine学习笔记】python 文件l操作方法整理

    python脚本可以对excel进行创建.读.写.保存成指定文件名,保存到指定路径的操作.整理了以下处理方法:   首先区别几个操作方式: "r" 以读方式打开,只能读文件 , 如 ...

  6. Android Studio如何更新support repository

    转自: http://blog.csdn.net/sinat_29696083/article/details/70256377 刚进新公司,熟悉新业务中.老大叫我看看关于ConstraintLayo ...

  7. 指令——mdadm

    Mdadm命令详解 Linux内核中有一个md(multiple devices)模块在底层管理RAID设备,它会在应用层给我们提供一个应用程序的工具mdadm ,mdadm是linux下用于创建和管 ...

  8. tomcat配置限制ip和建立图片服务器

    1.配置限制ip访问 打开 tomcat里conf文件下的server.xml 在<Host name="localhost" appBase="webapps&q ...

  9. python 之并发编程更新版进程池与进程池比较与回调函数

    一.更新版进程池与进程池比较 from concurrent.futures import ProcessPoolExecutor, ThreadPoolExecutor import os, tim ...

  10. Python 之并发编程之manager与进程池pool

    一.manager 常用的数据类型:dict list 能够实现进程之间的数据共享 进程之间如果同时修改一个数据,会导致数据冲突,因为并发的特征,导致数据更新不同步. def work(dic, lo ...