Hadoop新手求助:Ubuntu系统下localhost:9870无法访问
Hey there, fellow Hadoop beginner! Let's work through that "page doesn't exist" error when trying to access localhost:9870—this is a super common hiccup when getting started, so don't worry, we'll fix it together.
Here are the most likely fixes, ordered from easiest to check:
1. Verify Hadoop Services Are Running
The localhost:9870 URL is for the NameNode Web UI, which only works if the Hadoop HDFS services are up and running.
- Open your terminal and run this command to check active Hadoop processes:
You should see at leastjpsNameNode,DataNode, andResourceManagerin the output. If these are missing, start the services:
Note: Some older Hadoop setups usestart-dfs.sh # Starts HDFS services (NameNode/DataNode) start-yarn.sh # Starts YARN services (ResourceManager/NodeManager)start-all.sh, but it's deprecated in newer versions—stick to the two separate commands above.
2. Double-Check Hadoop Configuration Files
Incorrect configs are the #1 culprit here. You'll need to verify two key files in your Hadoop installation directory (usually $HADOOP_HOME/etc/hadoop/):
core-site.xml
Open it with a text editor (e.g., nano $HADOOP_HOME/etc/hadoop/core-site.xml) and make sure it has this property:
<property> <name>fs.defaultFS</name> <value>hdfs://localhost:9000</value> </property>
hdfs-site.xml
Check this file for the NameNode HTTP address property:
<property> <name>dfs.namenode.http-address</name> <value>localhost:9870</value> </property>
After making any changes, restart all Hadoop services to apply them.
3. Check Ubuntu Firewall Settings
Ubuntu's default firewall (ufw) might be blocking port 9870.
- First, test if disabling the firewall fixes the issue:
If you can accesssudo ufw disablelocalhost:9870now, re-enable the firewall and add a rule to allow the port:sudo ufw allow 9870/tcp sudo ufw enable
4. Ensure Port 9870 Isn't Occupied by Another Process
Sometimes another app might be using port 9870. Check with this command:
ss -tulpn | grep 9870
If you see a process listed here, you can either:
- Kill that process (use
sudo kill <PID>where<PID>is the process ID), or - Update the
dfs.namenode.http-addressproperty inhdfs-site.xmlto use a different port (e.g.,9871), then restart Hadoop.
5. Rule Out Browser Issues
- Double-check you typed the URL correctly: it's
http://localhost:9870(not9070or another typo). - Try accessing it in a private/incognito window to bypass cached pages.
If none of these steps work, feel free to share the output of jps and your config files—we can dig deeper!
内容的提问来源于stack exchange,提问作者Kevin Su




