gpt4 book ai didi

linux - psql 命令没有响应

转载 作者:太空宇宙 更新时间:2023-11-04 12:02:56 27 4
gpt4 key购买 nike

当我单独运行 psql 命令时(没有参数,安装了 postgres-10,从 Debian Sid 运行),它只是保持空白并永远运行。我尝试使用 systemctl status postgresql 检查状态,它说服务器处于事件状态。当我通过将主机指定为本地主机来运行它时,它会执行相同的操作。

这是我的 postgresql.conf 文件的连接设置部分:

 listen_addresses = '*' # what IP address(es) to listen on;
# comma-separated list of addresses;
# defaults to 'localhost'; use '*' for all
# (change requires restart)
port = 5432 # (change requires restart)
max_connections = 100 # (change requires restart)
# Note: Increasing max_connections costs ~400 bytes of shared memory per
# connection slot, plus lock space (see max_locks_per_transaction).
#superuser_reserved_connections = 3 # (change requires restart)
unix_socket_directories = '/var/run/postgresql' # comma-separated list of directories
# (change requires restart)
#unix_socket_group = '' # (change requires restart)
#unix_socket_permissions = 0777 # begin with 0 to use octal notation
# (change requires restart)
#bonjour = off # advertise server via Bonjour
# (change requires restart)
#bonjour = on # MJB
#bonjour_name = '' # defaults to the computer name
# (change requires restart)

# - Security and Authentication -

#authentication_timeout = 1min # 1s-600s
ssl = true # (change requires restart)
#ssl_ciphers = 'HIGH:MEDIUM:+3DES:!aNULL' # allowed SSL ciphers
# (change requires restart)
#ssl_prefer_server_ciphers = on # (change requires restart)
#ssl_ecdh_curve = 'prime256v1' # (change requires restart)
#ssl_renegotiation_limit = 512MB # amount of data between renegotiations
ssl_cert_file = '/etc/ssl/certs/ssl-cert-snakeoil.pem' # (change requires restart)
ssl_key_file = '/etc/ssl/private/ssl-cert-snakeoil.key' # (change requires restart)
#ssl_ca_file = '' # (change requires restart)
#ssl_crl_file = '' # (change requires restart)
#password_encryption = on
#db_user_namespace = off

# GSSAPI using Kerberos
#krb_server_keyfile = ''
#krb_caseins_users = off

# - TCP Keepalives -
# see "man 7 tcp" for details

#tcp_keepalives_idle = 0 # TCP_KEEPIDLE, in seconds;
# 0 selects the system default
#tcp_keepalives_interval = 0 # TCP_KEEPINTVL, in seconds;
# 0 selects the system default
#tcp_keepalives_count = 0 # TCP_KEEPCNT;
# 0 selects the system default

为了解决这个问题,我应该查看哪些地方?

最佳答案

所以我们可能需要更多信息。你是在终端上运行 psql ?如果是这样,您是否只运行不带参数的 psql(即 $ psql <enter>

当您单独运行 psql 命令时,它会尝试连接到套接字或 127.0.0.1 上的 Postgres 服务器。如果它挂起,它可能正在尝试连接到 127.0.0.1 并且防火墙正在丢弃数据包或者没有任何响应,导致它挂起。如果您等待的时间足够长,它应该会超时。

也许更好的问题是“您期望发生什么?”是否有与终端在同一台机器上运行的 Postgres 服务器?你确定它在运行吗?是否安装了服务?如果是这样,sudo systemctl status postgresql-10表明它正在运行?如果你运行 psql -h 127.0.0.1 会发生什么? Postgres 是否配置为监听网络接口(interface)?是否有防火墙阻止端口 5432? Postgres 是否在端口 5432 上运行?

...潜在问题的 list 还在继续。尝试确定上述问题的一些答案。你的问题相当于“我的车坏了——怎么了?”;我们需要更多信息来帮助您。 :)

关于linux - psql 命令没有响应,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51730968/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com