Ubuntu18.04 Hadoop Pseudo-Distributed

sudo tar -zxvf hadoop-3.1.2.tar.gz -C /usr/local/
sudo mv hadoop-3.1.2/ ./hadoop
sudo chown -R hosea ./hadoop/
ls -al
vim ./etc/hadoop/hadoop-env.sh
export JAVA_HOME=/usr/local/jdk/jdk1.8.0_212
vim ./etc/hadoop/core-site.xml
<configuration>
        <property>
                <name>fs.defaultFS</name>
                <value>hdfs://localhost:9000</value>
        </property>
</configuration>
vim ./etc/hadoop/hdfs-site.xml
<configuration>
        <property>
                <name>dfs.replication</name>
                <value>1</value>
        </property>
</configuration>
ssh-keygen -t rsa -P '' -f ~/.ssh/id_rsa
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
chmod 0600 ~/.ssh/authorized_keys
./bin/hdfs namenode -format
./sbin/start-dfs.sh

Name Node - http://localhost:9870

./bin/hdfs dfs -mkdir /user
./bin/hdfs dfs -mkdir /user/hosea
./bin/hdfs dfs -mkdir input
./bin/hdfs dfs -put etc/hadoop/*.xml input
./bin/hadoop jar share/hadoop/mapreduce/hadoop-mapreduce-examples-3.1.2.jar grep input output 'dfs[a-z.]+'
./bin/hdfs dfs -get output output
cat output/*
原文地址:https://www.cnblogs.com/hosealyu1996/p/11401078.html