首页 > 代码库 > Hadoop伪分布式搭建CentOS

Hadoop伪分布式搭建CentOS

所需软件及版本:jdk-7u80-linux-x64.tar.gzhadoop-2.6.0.tar.gz1.安装JDK    Hadoop 在需在JDK下运行,注意JDK最好使用Oracle的否则可能出bug2.创建用户    [root@MyDB01 ~]# groupadd hadoop    [root@MyDB01 ~]# useradd -g hadoop hadoop    [root@MyDB01 ~]# passwd hadoop 3.配置SSH    确认SSH的客户端和服务端已安装    [hadoop@MyDB01 ~]$ rpm -qa|grep ssh    libssh2-1.4.2-1.el6.x86_64    openssh-clients-5.3p1-94.el6.x86_64    openssh-server-5.3p1-94.el6.x86_64    openssh-5.3p1-94.el6.x86_64    [hadoop@MyDB01 ~]$     配置SSH免密码登陆    [hadoop@MyDB01 ~]$ mkdir ~/.ssh    [hadoop@MyDB01 ~]$ cd ~/.ssh/                            # 若没有该目录,请先执行一次ssh localhost      [hadoop@MyDB01 .ssh]$ ssh-keygen -t dsa                  # 会有提示,都按回车就可以      [hadoop@MyDB01 .ssh]$ cat id_dsa.pub >> authorized_keys  # 加入授权      [hadoop@MyDB01 .ssh]$ chmod 600 ./authorized_keys        # 修改文件权限,如果不改,无法通过,原因好像是cent os的权限验证比较严格    [hadoop@MyDB01 .ssh]$ssh MyDB01                          # 测试4.安装hadoop    下载    [hadoop@MyDB01 ~]$ wget  http://archive.apache.org/dist/hadoop/core/hadoop-2.6.0/hadoop-2.6.0.tar.gz        解压    [root@MyDB01 hadoop]#tar -zxvf hadoop-2.6.0.tar.gz -C /usr/local    修改权限    [root@MyDB01 local]# mv hadoop-2.6.0/ hadoop/          #更改文件夹名称      [root@MyDB01 local]# chown -R hadoop:hadoop ./hadoop   #修改权限    修改环境变量    [hadoop@MyDB01 ~]$ vi .bash_profile    export HADOOP_HOME=/usr/local/hadoop      export HADOOP_INSTALL=$HADOOP_HOME      export HADOOP_MAPRED_HOME=$HADOOP_HOME      export HADOOP_COMMON_HOME=$HADOOP_HOME      export HADOOP_HDFS_HOME=$HADOOP_HOME      export YARN_HOME=$HADOOP_HOME      export HADOOP_COMMON_LIB_NATIVE_DIR=$HADOOP_HOME/lib/native      export PATH=$PATH:$HADOOP_HOME/sbin:$HADOOP_HOME/bin      export JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.111.x86_64     export PATH=$JAVA_HOME/bin:$PATH      export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar  5.配置伪分布式    #手动创建根目录/hadoop  属主:hadoop    1、core-site.xml文件       <configuration>        <property>              <name>hadoop.tmp.dir</name>              <value>file:/hadoop/tmp</value>          </property>          <property>              <name>fs.defaultFS</name>              <value>hdfs://MyDB01:9000</value>          </property>        </configuration>       2、hdfs-site.xml文件       <configuration>        <property>              <name>dfs.replication</name>              <value>1</value>          </property>          <property>              <name>dfs.namenode.name.dir</name>              <value>file:/hadoop/tmp/dfs/name</value>          </property>          <property>              <name>dfs.datanode.data.dir</name>              <value>file:/hadoop/tmp/dfs/data</value>          </property>         </configuration> 6.对文件系统HDFS格式化操作    hadoop namenode -format

 

Hadoop伪分布式搭建CentOS