ubuntu下hadoop2安装

前端之家收集整理的这篇文章主要介绍了ubuntu下hadoop2安装前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

1使用ppa/源方式安装JDK

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer
sudo update-java-alternatives -s java-7-oracle
java -version


2用户环境准备:

》vi /etc/hostname

HOSTNAME=cookocean

》vi /etc/hosts

127.0.0.1 localhost
104.131.182.5 cookocean cookocean


》sudo addgroup hadoop

》sudo adduser -ingroup hadoop hadoop

》sudo /etc/sudoers

在root ALL=(ALL:ALL) ALL这一行下添加

hadoop ALL=(ALL:ALL) ALL

sudo apt-get update

》 sudo apt-get upgrade

》sudo apt-get install ssh openssh-server

》su - hadoop

》ssh-keygen -t rsa -P ""

进入~/.ssh/目录下:

cd /home/hadoop/.ssh

将此目录下的id_rsa.pub追加到authorized_keys授权文件中:
cat id_rsa.pub >> authorized_keys

3.安装hadoop2

http://apache.fayea.com/hadoop/common/hadoop-2.7.3/hadoop-2.7.3.tar.gz

export HADOOP_INSTALL=/usr/local/hadoop

PATH=$PATH:$HADOOP_INSTALL/bin

/sbin

HADOOP_MAPRED_HOME=$HADOOP_INSTALL

HADOOP_COMMON_HOME= HADOOP_HDFS_HOME= YARN_HOME=$HADOOP_INSTALL


4.修改环境配置文件

hdfs.site.xml

@H_404_189@ <property> <name>dfs.replication</name> <value>1</value> </property> <property> <name>dfs.namenode.name.dir</name> <value>file:/home/hadoop/hadoop-2.7.3/hdfs/name</value> </property> <property> <name>dfs.datanode.data.dir</name> <value>file:/home/hadoop/hadoop-2.7.3/hdfs/data</value> </property>

core-site.xml

@H_404_189@ <property> <name>fs.default.name</name> <value>hdfs://cookocean:9000</value> </property>

yarn-site.xml

@H_404_189@<property> <name>yarn.nodemanager.aux-services</name> <value>mapreduce_shuffle</value> </property> <property> <name>yarn.nodemanager.aux-services.mapreduce.shuffle.class</name> <value>org.apache.hadoop.mapred.ShuffleHandler</value> </property>

mapred-site.xml

<property>
<name>mapreduce.framework.name</name>
<value>yarn</value>
</property>


格式化hdfs

@H_404_189@ hdfs namenode -format

只需要执行一次即可,如果在hadoop已经使用后再次执行,会清除掉hdfs上的所有数据

6、启动hadoop

首先进入 /usr/local/hadoop/目录

@H_404_189@cd /usr/local/hadoop/

经过上文所描述配置和操作后,下面就可以启动这个单节点的集群

执行启动命令:

@H_404_189@ sbin/start-dfs.sh

执行该命令时,如果有yes /no提示,输入yes,回车即可。

接下来,执行:

@H_404_189@sbin/start-yarn.sh

猜你在找的Ubuntu相关文章