unexpected error, closing socket connection and attempting reconnect java.net.ConnectException

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/u010503822/article/details/81147193

使用root用户登录,执行安装jdk

rpm -ivh jdk-7u21-linux-x64.rpm

安装zip执行:

yum install -y unzip zip

启动上传solr的配置交给zookeeper的集群进行管理
建议:
使用root用户登录,安装完之后,还需要在 /solr-4.10.3/example 目录下执行:

cd /home/tangchao/develop/solr-4.10.3/example
java -jar start.jar

关闭防火墙:

service iptables stop

使用start_all.sh脚本,启动zookeeper集群

通过zookeeper的客户端上传solr的配置文件目录
解压solr

[root@localhost develop]# tar -zxvf solr-4.10.3.tgz.tgz 

上传solr配置文件

[root@localhost develop]#cd /home/tangchao/develop/solr-4.10.3/example/scripts/cloud-scripts
./zkcli.sh -zkhost 192.168.25.131:2181,192.168.25.131:2182,192.168.25.131:2183 -cmd upconfig -confdir /usr/local/solr-cloud/solrhome01/collection1/conf -confname myconf
展开阅读全文

java.net.ConnectException: Connection refused

08-13

java.net.ConnectException: Connection refusedrn at java.net.PlainSocketImpl.socketConnect(Native Method)rn at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)rn at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)rn at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)rn at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)rn at java.net.Socket.connect(Socket.java:519)rn at java.net.Socket.connect(Socket.java:469)rn at java.net.Socket.(Socket.java:366)rn at java.net.Socket.(Socket.java:180)rn at ism.config.FtpClient.(FtpClient.java:35)rn at ism.config.IsmConfigManagerImpl.checkFTP(IsmConfigManagerImpl.java:337)rn at ism.config.IsmConfigManagerImpl.insertNode(IsmConfigManagerImpl.java:277)rn at ism.config.IsmConfigManagerImpl.insertNode(IsmConfigManagerImpl.java:1136)rn at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)rn at java.lang.reflect.Method.invoke(Method.java:597)rn at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:305)rn at sun.rmi.transport.Transport$1.run(Transport.java:159)rn at java.security.AccessController.doPrivileged(Native Method)rn at sun.rmi.transport.Transport.serviceCall(Transport.java:155)rn at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:535)rnrnrn备注:监听端口状态为rn command: netstat -an|grep 22120rn *.22120 *.* 0 0 128000 0 LISTENrn *.22120 *.* 0 0 128000 0 LISTENrnrn求思路~~~rnrn rnrn 论坛

java.net.ConnectException: Connection timed out: connect

03-25

import java.io.IOException;rnimport java.io.OutputStream;rnimport java.net.Socket;rnimport java.net.UnknownHostException;rnimport java.sql.ResultSet;rnrnimport org.sql.IntoDB;rnrnpublic class BaiduReferer rn public static void main(String[] args) throws UnknownHostException,rn IOException, InterruptedException rn for(int i=0;i<1000;i++)rn send("");rn Thread.sleep(5000);rnrnrn public static void send(String url) throws UnknownHostException,rn IOException rn Socket socket = new Socket("www.baidu.com", 80);rn StringBuffer sb = new StringBuffer("GET /" + url + " HTTP/1.1");rn sb.append("\r\n");rn sb.append("Host: www.baidu.com");rn sb.append("\r\n");rn sbrn .append("User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.8) Gecko/20100202 Firefox/3.5.8 GTB6");rn sb.append("\r\n");rn sbrn .append("Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");rn sb.append("\r\n");rn sb.append("Accept-Language: zh,en;q=0.8,zh-cn;q=0.5,en-us;q=0.3");rn sb.append("\r\n");rn sb.append("Accept-Encoding: gzip,deflate");rn sb.append("\r\n");rn sb.append("Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7");rn sb.append("\r\n");rn sb.append("Keep-Alive: 300");rn sb.append("\r\n");rn sb.append("\r\n");rnrn OutputStream socketOut = socket.getOutputStream();rn socketOut.write(sb.toString().getBytes());rn socket.shutdownOutput(); //半闭输出流rnrnrn if(socket!=null)rn socket.close();rnrn rnrnrn在连接400-500次的时候,就报java.net.ConnectException: Connection timed out: connect异常 论坛

没有更多推荐了,返回首页