To view the files on haddop, enter:
hadoop fs -ls /
The following occurred:
ls: Call From yx/127.0.1.1 to 0.0.0.0:9000 failed on connection exception:
java.net.ConnectException: Denied to Access
For more details see: http://wiki.apache.org/hadoop/ConnectionRefused
Display 9000 port access denied
from the configuration file, you can know that Hadoop needs to access the machine through 9000 port, but now 9000 port access is denied
Input:
telnet localhost 9000
Display:
Trying 127.0.0.1… telnet: Unable to connect to remote host: Connection refused
Input:
nmap -p 9000 localhost
Display:
Starting Nmap 7.80 ( https://nmap.org ) at 2020-04-25 14:57 CST Nmap scan report for localhost (127.0.0.1) Host is up (0.000051s latency). PORT STATE SERVICE 9000/tcp closed cslistener Nmap done: 1 IP address (1 host up) scanned in 0.03 seconds
Use the command:
lsof -i :9000
See which app is using the port. If the result is empty (return value 1), it is not opened
the above is just to check the status and will not change anything.
Because hadoop connects to the local port in core-site.xml
Open $HADOOP_HOME/etc/hadoop/core-site.xml
<configuration>
<property>
<name>hadoop.tmp.dir</name>
<value>/data/tmp/hadoop/tmp</value>
</property>
<property>
<name>fs.defaultFS</name>
<value>hdfs://0.0.0.0:9000</value>
</property>
</configuration>
It is found that I have not configured the port number, which is modified to:
hdfs://localhost:9000
It still not work.
I tried many methods, and finally found that the most commonly used method on the Internet is to use this method, which is really OK:
cd $HADOOP_HOME/bin
hdfs namenode -format
But I still couldn’t run it. I tried many times and all the results were the same. Later, then I found an error:
WARN common.Util: Path /data/tmp/hadoop/hdfs/name should be specified as a URI in configuration files. Please update hdfs configuration.
This is due to the non-standard path. The file describing the path is in:
$HADOOP_HOMW/etc/hadoop/hdfs-site.xml
Place in the file:
<property>
<name>dfs.datanode.data.dir</name>
<value>/data/tmp/hadoop/hdfs/data</value>
</property>
Amend to read:
<property>
<name>dfs.datanode.data.dir</name>
<value>file:///data/tmp/hadoop/hdfs/data</value>
</property>
The warning disappears
but this does not play a decisive role. My reason is that the security mode is turned on. Just turn off the security mode
cd $HADOOP_HOME/bin
hadoop dfsadmin -safemode leave
Users can
hadoop dfsadmin -safemode value
Operation security mode
value value:
enter: enter security mode
leave: force to leave security mode
get: return to security mode status
wait: until the end of security mode
now:
root@yx:/apps/hadoop/bin# hadoop fs -ls /
20/04/25 19:24:24 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
Found 1 items
drwxr-xr-x - root supergroup 0 2020-04-25 17:13 /test
Read More:
- [Solved] Hadoop failed on connection exception: java.net.ConnectException: Connection refused
- [Solved] failed on connection exception: java.net.ConnectException: Connection denied
- [Solved] Multithreading uses jsch to obtain a session for connection error: session.connect: java.net.socketexception: connection reset
- [Solved] Hadoop Error: Exception in thread “main“ java.io.IOException: Error opening job jar: /usr/local/hadoop-2.
- [Solved] Tomcat configurate HTTPS error: java.net.SocketException: Permission denied
- [Solved] java.security.AccessControlException: Access Denied Error
- JAVA Error Illegal access: this web application instance has been stopped already. Could not load net.sf
- java.net.SocketException: software caused connection abort: socket write error resolution (selenium)
- [Solved] Hadoop Error: HADOOP_HOME and hadoop.home.dir are unset.
- CreateProcess error = 5, access denied. [How to Solve]
- Run hadoop fs -put Command Error: java.io.IOException: Got error, status message , ack with firstBadLink
- [Solved] Failed to start bean ‘documentationPluginsBootstrapper‘; nested exception is java.lang.NullPointerEx
- [Solved] port (127.0.0.1:64444): java.net.SocketException “Interrupted function call: accept failed“
- [Solved] swagger Failed to start bean ‘documentationPluginsBootstrapper‘; nested exception is java.lang.NullP
- The java springboot websocket service server actively closes the connection and causes java.io.EOFException to be thrown
- [Solved] MultipartException: Failed to parse multipart servlet request; nested exception is java.lang.Runtime
- [Solved] Failed to start bean ‘eurekaAutoServiceRegistration‘; nested exception is java.lang.NullPointerExce
- [Solved] Flink1.12 integrate Hadoop 3.X error: java.lang.RuntimeException…
- Java uses class array to report error Exception in thread “main” java.lang.NullPointerException solution
- [Solved] Failed to start bean ‘documentationPluginsBootstrapper’; nested exception is java.lang.NullPointerException