- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我想配置我的 DigitalOcean Postgresql 数据库,以便在家里使用 pg_dumb,但我无法让它正常工作:
它与 pg_hba-conf 一起工作:
host all all all md5
并在 postgresaql.conf 中
listen_addresses = '*'
但我不想使用“all”和“*”,因为我猜这不安全。
我认为,在阅读了 Postgresql 文档(pg_hba.conf 和 authentication 等等...)后,我应该在这两个文件中使用我的 IP:
pg_hba.conf: host all all xxx.xxx.xx.xx/32 md5
postgresql.conf: listen_addresses = 'localhost,xxx.xxx.xx.xx'
但我无法理解这个问题:
listen_addresses='*'
放在 postgresql.conf 里,我在 pg_hba.conf 里放什么 IP 都没有关系! 它适用于任何 ip ¿?¿?例如 host all all 113.147.107.52/0 md5
如果我将 listen_addresses='localhost,[my_IP]'
放在 postgresql.conf 中,它不起作用:连接到数据库“c..ion”失败: 无法连接到服务器:连接被拒绝
。
在 [my_IP]
中,我输入了从 ipecho.net 获得的 Ip,Ip 正确吗?
这是 pg_hba.conf,最后一个条目是我想只允许我访问的内容
# Database administrative login by Unix domain socket
local all postgres md5
# TYPE DATABASE USER ADDRESS METHOD
# "local" is for Unix domain socket connections only
local all rails peer
# IPv4 local connections:
host all all 127.0.0.1/32 md5
# IPv6 local connections:
host all all ::1/128 md5
# For copy from home with pg_dumb, this IP is random: all IPs allow me to execute pg_dum if in listen_address='*'
host all all my_ip_from_ipecho.net/32 md5
我想我需要更多的IP知识,除此之外我完全迷路了
( PD:最后,我想我会在服务器中执行 pg_dump,然后,从我家里的 PC,我会用 scp
复制这些备份文件。但我想了解发生了什么以及它是如何工作的)
非常感谢
最佳答案
如果你想在 postgresql.conf 中指定 ip 地址,你将必须确认你的客户端将来自的所有 ip(包括在这种情况下你的 PC ip 或 VPN,如果你正在使用)。
这就是为什么当您使用“*”时它会起作用,因为它会监听来自所有 ip(包括您的)的客户端。
pg_hba.conf 将用作防火墙,因此您也需要在那里配置您的入口。
在你的情况下,我认为最好使用 listen_addresses='*' ,并在 pg_hba 中配置 ip 地址,因为参数 listen_addresses 需要在你想要更改它时重新启动。
pg_hba.conf: host all all xxx.xxx.xx.xx/0 md5
postgresql.conf: listen_addresses = '*'
如果您需要进一步的帮助来配置您的 pg_hba,请告诉我。
祝你好运!
注意:关于 listen_addresses 参数的更多信息 http://www.postgresql.org/docs/9.4/static/runtime-config-connection.html
关于linux - 如何安全地配置 pg_hba.conf postgresql.conf 以连接到 postgresql 数据库服务器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37163956/
这是与 postgresql 9.6.9 一起使用的。 这是我的 pg_hba.conf 文件的一部分: local sameuser all
我正在 Ub12.04 服务器上安装和运行 postgres 服务器。 谁能帮我找到打开 pg_hba.conf 以接受来自任何主机的任何连接的语法? 我试过了 host all all 0.0.0.
我正在寻找一种以编程方式编辑 pg_hba.conf 的方法,类似于 pg_conftool 允许您编辑 postgresql.conf 的方式: ~$ pg_conftool 11 main set
在 pg_hba.conf 中,我有 host all all 127.0.0.1/32 md5 host all
好的,首先我是法国人,对于错误消息可能的不理解或错误翻译,我们深表歉意。 我有一个 Raspberry,上面有一个 Tomcat 服务器。另外,我也使用 Postgresql。 在我的网站上,服务器端
我要修改线路 local all all peer 到 local all all md5 在 shell 脚本中。最好的方法是什么?如果我要搜索该行,我应该寻找什么字符串? pg_hba.conf中
关闭。这个问题是off-topic .它目前不接受答案。 想改进这个问题吗? Update the question所以它是on-topic用于堆栈溢出。 关闭 10 年前。 Improve thi
pg_hba.conf 配置详解 该文件位于初始化安装的数据库目录下 编辑 pg_hba.conf 配置文件 ?
我正在尝试连接到我在远程计算机上设置的 PostgreSQL 数据库。 我收到以下错误: org.postgresql.util.PSQLException: FATAL: no pg_hba.con
所以我正在尝试设置 PostgreSQL 以在我的 Mac 10.9 Mavericks 机器上与 metasploit 一起使用。我正在尝试按照此页面上列出的说明进行操作。 http://www.d
我见过的所有示例都有单独一行的注释。 下面的尾随评论可以吗? host all all 0.0.0.0/0 md5 # accept all connections 最佳答
我有 postgres 在树莓派上运行,我正在变老 psycopg2.OperationalError: FATAL: Peer authentication failed for user "ge
我正在尝试远程访问安装在 IP A.A.A.A 的服务器上的 postgresql。有两台服务器,其中一台的IP为A.A.A.A,安装了postgresql;另一个有IP B.B.B.B. 我编辑了
在我们运行时安装 postgres 之后,正在为我的一个客户端设置服务器我们遇到以下错误的服务器。当我凝视它时,有一些可用的解决方案,但没有一个对我有用,你能看看它并说出发生了什么吗。 Status:
当我尝试使用 DBI 连接时出现以下错误 DBI connect('database=chaosLRdb;host=192.168.0.1;port=5433','postgres',...) fai
所以,我正在尝试为我的应用程序(针对 Ubuntu 16)创建一个安装脚本。它必须创建一个 postgresql 用户,授予该用户通过密码进行身份验证的权限,并授予该用户在本地进行身份验证的权限。我只
我发现设置 pg_hba.conf 文件非常困难。这是浪费我时间的常见情况。我需要做什么? 首先,在 Amazon、Digital Ocean 或我自己的硬件上安装新安装的 Linux 发行版的虚拟机
我弄乱了我的 pg_hba.conf 文件,我不想重新安装 - 我在网络上的任何地方都找不到默认的文件。有人有吗? 最佳答案 以下内容默认pg_hba.conf在 PostgreSQL 12 中 #
我正在使用 circleci 运行一些涉及数据库的测试。我的服务器使用 node 和 sequelize 作为 orm。每当我运行测试时,都会出现以下错误: SequelizeConnectionEr
我正在尝试为 Hive 设置 PostgreSQL。这是 /var/lib/pgsql/data/pg_hba.conf 的内容: # TYPE DATABASE USER
我是一名优秀的程序员,十分优秀!