最近在linux上使用jmeter进行压测时,遇到了下面问题:

使用jmeter-server启动jmeter server报错,提示中的endpoint并不是该server的ip:

server的ip是内网的192.168.60.223,但endpoint却是202.106.199.37,貌似是联通的一个外网ip。

[root@host_60_223 bin]# ./jmeter-server

Created remote object: UnicastServerRef [liveRef: [endpoint:[202.106.199.37:48777](local),objID:[114b877d:1535f0bf800:-7fff, -8953048443915791496]]]

Server failed to start: java.rmi.RemoteException: Cannot start. See server log file.; nested exception is: 

java.rmi.ConnectException: Connection refused to host: 202.106.199.37; nested exception is: 

java.net.ConnectException: 连接超时

An error occurred: Cannot start. See server log file.; nested exception is: 

java.rmi.ConnectException: Connection refused to host: 202.106.199.37; nested exception is: 

java.net.ConnectException: 连接超时

通过网上各种查询,有人说是hostname在hosts文件中没有配置,这个一般都需要配置吗?

虽然疑问但没有找到别的解决办法,只能试试看:

[root@host_60_223 bin]# hostname

host_60_223

修改/etc/hosts文件加入下面的ip hostname

vi /etc/hosts

192.168.60.223 host_60_223


果然跟这个有关,至于为什么现在还不清楚。

[root@host_60_223 bin]# ./jmeter-server

Created remote object: UnicastServerRef [liveRef: [endpoint:[192.168.60.223:36259](local),objID:[3d1e428a:1535f20e6c7:-7fff, -6723038591539730142]]]