我在我的 Red Hat Enterprise 6.3 上安装了 Jenkins。 jenkins 通过监听端口 8080
运行。
[root@linux]# service jenkins status
jenkins (pid 7526) is running...
JENKINS_PORT="8080"
JENKINS_LISTEN_ADDRESS="0.0.0.0"
但是,我无法通过网络浏览器或 cURL 连接到 Jenkins。 HTTP 连接的 TCP 连接是“ESTABLIASHED”,但 HTTP GET 请求一直在等待,Web 浏览器一直在加载。
[root@linux]# netstat -an | grep 8080
tcp 0 0 :::8080 :::* LISTEN
tcp 0 0 ::ffff:172.22.146.9:8080 ::ffff:171.70.233.226:58029 ESTABLISHED
tcp 1 0 ::ffff:172.22.146.9:8080 ::ffff:171.70.233.226:58045 CLOSE_WAIT
tcp 1 0 ::ffff:172.22.146.9:8080 ::ffff:171.70.233.226:58103 CLOSE_WAIT
tcp 0 0 ::ffff:172.22.146.9:8080 ::ffff:171.70.233.226:58112 ESTABLISHED
mylaptop$ ping 172.22.146.9
PING 172.22.146.9 (172.22.146.9): 56 data bytes
64 bytes from 172.22.146.9: icmp_seq=0 ttl=57 time=6.384 ms
64 bytes from 172.22.146.9: icmp_seq=1 ttl=57 time=4.521 ms
64 bytes from 172.22.146.9: icmp_seq=2 ttl=57 time=4.095 ms
^C
--- 172.22.146.9 ping statistics ---enter code here
3 packets transmitted, 3 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 4.095/5.000/6.384/0.994 ms
mylaptop$ curl http://172.22.146.9:8080
<Pending forever here....>
nmap 扫描看起来也不错:
mylaptop$ nmap -p 8080 172.22.146.9
Starting Nmap 6.47 ( http://nmap.org ) at 2015-05-07 11:05 PDT
Nmap scan report for snmplab-linux9.cisco.com (172.22.146.9)
Host is up (0.0018s latency).
PORT STATE SERVICE
8080/tcp open http-proxy
Nmap done: 1 IP address (1 host up) scanned in 0.11 seconds
最佳答案
这是网络问题。 jenkins 默认的 http connect timeout 是 10s,但是请求 '/pluginManager/plugins' 花费超过 10s,因为响应大约 500KB,非常大。
var pluginManagerErrorTimeoutMillis = 10 * 1000;
...
exports.availablePlugins = function(handler) {
jenkins.get('/pluginManager/plugins', function(response) {
if(response.status !== 'ok') {
handler.call({ isError: true, errorMessage: response.message });
return;
}
handler.call({ isError: false }, response.data);
}, {
timeout: pluginManagerErrorTimeoutMillis,
error: function(xhr, textStatus, errorThrown) {
handler.call({ isError: true, errorMessage: errorThrown });
}
});
};
您可以通过浏览器的开发者工具更改pluginManagerErrorTimeoutMillis
。
关于linux - 无法连接到 redhat linux 上的 Jenkins 服务器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30108088/