首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >关于postgreSQL9.6初始配置的帮助

关于postgreSQL9.6初始配置的帮助
EN

Database Administration用户
提问于 2016-06-07 19:37:30
回答 1查看 2.1K关注 0票数 2

我最近在windows 7 64位计算机上安装了postgreSQL9.6版本。在安装过程中,有人要求我输入超级用户密码和数据库的区域设置(我选择了默认区域设置)。在安装过程中,有一个名为“服务器集群初始化”的步骤。这个步骤失败了,我得到了相同的错误消息。但是,服务器已成功安装。

现在,当我启动postgreSQL9.6命令行应用程序时,需要提供一些信息。我不知道他们到底想要什么。因此,我给出了所需字段的快照。

显而易见,提示请求服务器本地主机:、数据库波斯特格斯:、端口PG_端口:和用户名PG_用户名:

安装说明说,对于这些字段,我应该输入默认值。这些字段的默认值是什么。我只知道端口号和超级用户密码。

基本上,我不知道这些领域需要输入哪些信息。

此外,当我试图使用pgadmin添加服务器时,我会得到以下错误

代码语言:javascript
运行
复制
**

Server doesn't listen
    The server doesn't accept connections: the connection library reports 
    could not connect to server: Connection refuse (0x0000274D/10061)     Is   the server running on host "localhost" (::1) and accepting TCP/IP     connections on port 5432? could not connect to server: Connection refused (0x0000274D/10061) Is the server running on host "localhost" (127.0.0.1) and accepting TCP/IP connections on port 5432? 
If you encounter this message, please check if the server you're trying to contact is actually running PostgreSQL on the given port. Test if you have network connectivity from your client to the server host using ping or equivalent tools. Is your network / VPN / SSH tunnel / firewall configured correctly? 
For security reasons, PostgreSQL does not listen on all available IP addresses on the server machine initially. In order to access the server over the network, you need to enable listening on the address first. 
For PostgreSQL servers starting with version 8.0, this is controlled using the "listen_addresses" parameter in the postgresql.conf file. Here, you can enter a list of IP addresses the server should listen on, or simply use '*' to listen on all available IP addresses. For earlier servers (Version 7.3 or 7.4), you'll need to set the "tcpip_socket" parameter to 'true'. 
You can use the postgresql.conf editor that is built into pgAdmin III to edit the postgresql.conf configuration file. After changing this file, you need to restart the server process to make the setting effective. 
If you double-checked your configuration but still get this error message, it's still unlikely that you encounter a fatal PostgreSQL misbehaviour. You probably have some low level network connectivity problems (e.g. firewall configuration). Please check this thoroughly before reporting a bug to the PostgreSQL community.

**

我正试图在我的机器上创建一个本地服务器,以便学习postgreSQL。

正如注释部分所建议的那样,我试图找到我获得postgresql.conf.sample文件的postgresql.conf.sample文件。我正在以快照的形式发布此文件的内容。

我是否需要删除该#以使配置工作?

EN

回答 1

Database Administration用户

发布于 2016-06-07 20:52:42

基本上,您的pg_hba.conf文件需要更新才能正常工作。要查找conf文件的位置,请查找主postgresql.conf文件,该文件通常位于/Data目录中。

还可以检查您的postgresql.conf文件,查看它正在侦听的端口#,您可能已经设置了一个非默认端口。运行netstat -an可以帮助您验证它是否正在侦听。如果没有确保服务或应用程序正在运行。

在验证并编辑pg_hba.conf之后,您应该在Windows中重新启动服务,然后在本地再次测试。如果您正在运行IPv6,那么“向所有人开放”的表示法将是::0/0,这是一个常见的实现,但安全性实践却很差。我建议只对它进行测试,然后一旦它起作用,将它锁定为特定的it,因为您知道一切都已启动并运行。

在您的conf文件上尝试这一点,并尝试在本地连接。如果使用IPV6,请在CIDR-ADDRESS中使用IPV6地址:

代码语言:javascript
运行
复制
# TYPE  DATABASE    USER        CIDR-ADDRESS          METHOD
local   all         all                               trust

这里是PostgreSQL hba_conf的文档。

我最近看到的最常见的问题是,当服务器或客户端使用IPv6或默认安装时,客户端试图从与服务器不同的IP连接。否则,您的conf文件可能设置错误。

票数 1
EN
页面原文内容由Database Administration提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://dba.stackexchange.com/questions/140658

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档