hadoop - meetbill/op_practice_book GitHub Wiki
hadoop 部署
创建 hadoop 用户
root 用户身份登陆
useradd -m hadoop -s /bin/bash
passwd hadoop
echo "hadoop ALL=(ALL) NOPASSWD: ALL" >/etc/sudoers.d/hadoop
配置 ssh 无密码登陆
hadoop 用户身份登陆
ssh-keygen
ssh-copy-id localhost
安装Java环境
sudo yum install java-1.7.0-openjdk java-1.7.0-openjdk-devel
sudo sh -c "echo export JAVA_HOME=/usr/lib/jvm/java-1.7.0 >> /etc/profile"
. /etc/profile
java -version
安装 hadoop2
tar -zxvf hadoop-2.8.1.tar.gz
sudo mv hadoop-2.8.1 /usr/local/hadoop
sudo chown -R hadoop:hadoop /usr/local/hadoop/
cd /usr/local/hadoop
./bin/hadoop version
Hadoop单机配置(非分布式)
cd /usr/local/hadoop
mkdir ./input
cp ./etc/hadoop/*.xml ./input # 将配置文件作为输入文件
./bin/hadoop jar ./share/hadoop/mapreduce/hadoop-mapreduce-examples-*.jar grep ./input ./output 'dfs[a-z.]+'
cat ./output/* # 查看运行结果
启动失败时处理方法
若出现提示 “INFO metrics.MetricsUtil: Unable to obtain hostName java.net.UnknowHostException”,这需要执行如下命令修改 hosts 文件,为你的主机名增加IP映射:
sudo sh -c "echo 127.0.0.1 $HOSTNAME >> /etc/hosts"