Resolution: Using java connection Fastdfs, upload files Times: SocketTimeOutException problem

Recent studies of distributed storage Fastdfs, on centOS After configuration, use centOS or putty connection and upload pictures and read the URL storage server returned with a browser, everything is normal.


However, when using eclipse upload pictures, error: SocketTimeOutException.

Error behavior: String [] strings = storageClient.upload_file ( "D: \\ 120.jpg", "jpg", null);


Check online for nearly a day, but there is no corresponding solution, the only one close to the argument is: tracker server's IP to use external network IP.

But he did not say anything very specific.


After pro-test, this method, I still can not solve the problem.

Moreover, Fastdfs this problem, the Internet rarely mentioned, the study a bit.


Repeatedly checking API code, confirmation.

Repeatedly checking Fastdfs configuration confirmation.

The tracker server's IP into extranet IP, and then restart the storage server service, found stuck, unable to restart.


Finally, double-check the configuration file, found the problem:

In conf storage server, the first 23, 24 line is this:

# the storage server port
port=23000


This undoubtedly represents a storage server own port number.

And, our newly installed centOS, the default port number on, is very small! Before 80,8080,22122 port, are their own and later opened manually.

And this 23,000, it may not open !!

After confirmation, it is true, after opening the port, eclipse upload files to normal! Junit green bar!


Thinking:

Why the first three port number manually open and aware, and this port, but just think of the last?

Because, when debugging centOS or putty in the first three did not open, it will be a problem immediately.

However, the fourth port, in centOS and putty, even if did not open, does not affect upload pictures or pictures by accessing http URL!

Cause it difficult to think this in itself is very simple question.


Port View and open the way:

In centOS server or putty in:

1. Check the open ports:

#/etc/init.d/iptables status

2. Manually open the specified port (to 23,000 for example):

#/sbin/iptables -I INPUT -p tcp --dport 23000 -j ACCEPT

3. After opening the port, remember to save:

#/etc/rc.d/init.d/iptables save


Original: https://blog.csdn.net/jsflzhong/article/details/51647481

Guess you like

Origin www.cnblogs.com/116970u/p/11260187.html