Jmeter无法连接到数据库(Postgres)

时间:2020-05-21 15:10:15

标签: database postgresql ssh automation jmeter

我正在尝试使用Jmeter连接到数据库(Postgres),但是出现以下问题:

在下面回复

Unable to create PoolableConnectionFactory (connection to local host: 5432 refused. Check that the host name and port are correct and that the postmaster is accepting TCP / IP connections.)

下面的请求

Database URL: jdbc:postgresql://localhost:5432/auth?AutoReconnect=true
Username: XXXX
Password: XXXX

当我直接连接到Postgres时,连接到SSH隧道。是吗?

如果是,该如何进行? 你有什么设置吗? 还是在机器上?

有人可以帮助我并逐步进行吗?

非常感谢您!

EstevãoF. P. Marcos

1 个答案:

答案 0 :(得分:1)

  1. 确保您的PostgreSQL实例为started
  2. 确保您的PostgreSQL实例正在接受传入的TCP / IP连接,您在postgresql.conf file中应包含以下行:

    tcpip_socket = true
    
  3. 您可能需要将IP地址列入白名单,以便PostgreSQL可以接受来自它的传入连接,这可以在pg_hba.conf file
  4. 中完成
  5. 在尝试使用JMeter连接数据库之前,请确保您可以使用psql command-line utility成功连接
  6. 仔细检查您的JDBC连接配置,因为您发布的错误消息看起来可疑,尤其是这些空白:

    local host: 5432
         ^     ^
    

    因为从Postgres JDBC驱动程序的角度来看,localhostlocal hostDNS Hostnames不同。

以防万一,请查看The Real Secret to Building a Database Test Plan With JMeter,以了解有关使用JMeter进行数据库负载测试的详细信息的更多信息。

相关问题