无法使用pyspark jdbc连接mac中安装的postgres

8i9zcol2  于 2021-05-27  发布在  Spark
关注(0)|答案(0)|浏览(332)

虽然以前讨论过类似的问题,但我仍然需要帮助来解决
我在mac上安装了postgress。我试图从安装在同一台机器上的oraclevm(centossparkpython安装)连接它。
详情如下:
pgèhba.conf文件


# "local" is for Unix domain socket connections only

local   all             all                      trust

# IPv4 local connections:

host    all             all             127.0.0.1/32            md5

# IPv6 local connections:

host    all             all             ::1/128                 trust
host    all             all              0.0.0.0/0                       md5
host    all             all              ::/0                            md5
host all all 192.168.56.1/24 md5

postgresql.conf文件

listen_addresses = '*'      # what IP address(es) to listen on;

# listen_addresses = '127.0.0.1'        # 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)

博士后跑步:

tcp4       0      0  *.5432                 *.*                    LISTEN     
tcp6       0      0  *.5432                 *.*                    LISTEN     
514898fa6aec9d0b stream      0      0 514898fa7f632c0b                0                0                0 /tmp/.s.PGSQL.5432

COMMAND   PID         USER   FD   TYPE             DEVICE SIZE/OFF NODE NAME
postgres 4960 sanjeebpanda    4u  IPv6 0x514898fa69eb3aeb      0t0  TCP *:postgresql (LISTEN)
postgres 4960 sanjeebpanda    5u  IPv4 0x514898fa95f54753      0t0  TCP *:postgresql (LISTEN)

错误:

py4j.protocol.Py4JJavaError: An error occurred while calling o538.load.
: org.postgresql.util.PSQLException: Connection to localhost:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.

 conn = _connect(dsn, connection_factory=connection_factory,**kwasync)
psycopg2.OperationalError: could not connect to server: Connection refused
    Is the server running on host "localhost" (127.0.0.1) and accepting
    TCP/IP connections on port 5432?

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题