设为首页 收藏本站
查看: 1051|回复: 0

[经验分享] Steps To Setup Hadoop 2.4.0 (Single Node Cluster) on CentOS/RHEL Written by Rahu

[复制链接]

尚未签到

发表于 2018-10-30 11:42:28 | 显示全部楼层 |阅读模式
  Apache Hadoop 2.4.0 significant improvements over the previous stable>
DSC0000.png

Step 1. Install JAVA/JDK
  Java is the primary requirement for running hadoop on any system, So make sure you have java installed on your system using following command.
#java -versionjava version "1.8.0_05"  
Java(TM) SE Runtime Environment (build 1.8.0_05-b13)
  
Java HotSpot(TM) Client VM (build 25.5-b02, mixed mode)
  If you don’t have java installed on your system, use one of following link to install it first.
  Install JAVA/JDK 8 on CentOS and RHEL 6/5
Step 2. Setup Hadoop User
  We recommend to create a normal (nor root) account for hadoop working. So create a system account using following command.
# useradd hadoop  
# passwd hadoop
  After creating account, it also required to set up key based ssh to its own account. To do this use execute following commands.
# su - hadoop  
$ ssh-keygen -t rsa
  
$ cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
  
$ chmod 0600 ~/.ssh/authorized_keys
  Lets verify key based login. Below command should not ask for password but first time it will prompt for adding RSA to the list of known hosts.
$ ssh localhost  
$ exit
Step 3. Download Hadoop 2.4.0

  Now download hadoop 2.4.0 source archive file using below command. You can also select>$ cd ~  
$ wget http://apache.claz.org/hadoop/common/hadoop-2.4.0/hadoop-2.4.0.tar.gz
  
$ tar xzf hadoop-2.4.0.tar.gz
Step 4. Configure Hadoop 2.4.0
4.1. Setup Environment Variables
  First we need to set environment variable uses by hadoop. Edit ~/.bashrc file and append following values at end of file.
export HADOOP_HOME=/home/hadoop/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
  Now apply the changes in current running environment
$source ~/.bashrc  Now edit $HADOOP_HOME/etc/hadoop/hadoop-env.sh file and set JAVA_HOME environment variable
export JAVA_HOME=/opt/jdk1.8.0_05/4.2. Edit Configuration Files
  Hadoop has many of configuration files, which need to configure as per requirements of your hadoop infrastructure. Lets start with the configuration with basic hadoop singlenode cluster setup. first navigate to below location
$ cd $HADOOP_HOME/etc/hadoopEdit core-site.xml
  

  
  fs.default.name
  
    hdfs://localhost:9000
  

  

Edit hdfs-site.xml
  

  
dfs.replication
  
1
  

  

  

  
  dfs.name.dir
  
    file:///home/hadoop/hadoopdata/hdfs/namenode
  

  

  

  
  dfs.data.dir
  
    file:///home/hadoop/hadoopdata/hdfs/datanode
  

  

Edit mapred-site.xml
  

  
  mapreduce.framework.name
  
   yarn
  

  

Edit yarn-site.xml
  

  
  yarn.nodemanager.aux-services
  
    mapreduce_shuffle
  

  

4.3. Format Namenode
  Now format the namenode using following command, make sure that Storage directory is
$hdfs namenode -format  [Sample output]
14/05/04 21:30:55 INFO namenode.NameNode: STARTUP_MSG:  
/************************************************************
  
STARTUP_MSG: Starting NameNode
  
STARTUP_MSG:   host = svr1.tecadmin.net/192.168.1.11
  
STARTUP_MSG:   args = [-format]
  
STARTUP_MSG:   version = 2.4.0
  
...
  
...
  
14/05/04 21:30:56 INFO common.Storage: Storage directory /home/hadoop/hadoopdata/hdfs/namenode has been successfully formatted.
  
14/05/04 21:30:56 INFO namenode.NNStorageRetentionManager: Going to retain 1 images with txid >= 0
  
14/05/04 21:30:56 INFO util.ExitUtil: Exiting with status 0
  
14/05/04 21:30:56 INFO namenode.NameNode: SHUTDOWN_MSG:
  
/************************************************************
  
SHUTDOWN_MSG: Shutting down NameNode at svr1.tecadmin.net/192.168.1.11
  
************************************************************/
Step 5. Start Hadoop Cluster
  Lets start your hadoop cluster using the scripts provides by hadoop. Just navigate to your hadoop sbin directory and execute scripts one by one.
$ cd $HADOOP_HOME/sbin/  Now run start-dfs.sh script.
$start-dfs.sh[Sample output]  
14/05/04 21:37:56 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
  
Starting namenodes on [localhost]
  
localhost: starting namenode, logging to /home/hadoop/hadoop/logs/hadoop-hadoop-namenode-svr1.tecadmin.net.out
  
localhost: starting datanode, logging to /home/hadoop/hadoop/logs/hadoop-hadoop-datanode-svr1.tecadmin.net.out
  
Starting secondary namenodes [0.0.0.0]
  
0.0.0.0: starting secondarynamenode, logging to /home/hadoop/hadoop/logs/hadoop-hadoop-secondarynamenode-svr1.tecadmin.net.out
  
14/05/04 21:38:16 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
  Now run start-yarn.sh script.
$start-yarn.sh[Sample output]  
starting yarn daemons
  
starting resourcemanager, logging to /home/hadoop/hadoop/logs/yarn-hadoop-resourcemanager-svr1.tecadmin.net.out
  
localhost: starting nodemanager, logging to /home/hadoop/hadoop/logs/yarn-hadoop-nodemanager-svr1.tecadmin.net.out
Step 6. Access Hadoop Services in Browser
  Hadoop NameNode started on port 50070 default. Access your server on port 50070 in your favorite web browser.
http://svr1.tecadmin.net:50070/
DSC0001.png

  Now access port 8088 for getting the information about cluster and all applications
http://svr1.tecadmin.net:8088/
DSC0002.png

  Access port 50090 for getting details about secondary namenode.
http://svr1.tecadmin.net:50090/
DSC0003.png

  Access port 50075 to get details about DataNode
http://svr1.tecadmin.net:50075/
DSC0004.png

Step 7. Test Hadoop Setup
  7.1 - Make the HDFS directories required using following commands.
$ bin/hdfs dfs -mkdir /user  
$ bin/hdfs dfs -mkdir /user/hadoop
  7.2 - Now copy all files from local file system /var/log/httpd to hadoop distributed file system using below command
$ bin/hdfs dfs -put /var/log/httpd logs  7.3 - Now browse hadoop distributed file system by opening below url in browser.
http://svr1.tecadmin.net:50070/explorer.html#/user/hadoop/logs
DSC0005.png

  7.4 - Now copy logs directory for hadoop distributed file system to local file system.
$ bin/hdfs dfs -get logs /tmp/logs  
$ ls -l /tmp/logs/



运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-628448-1-1.html 上篇帖子: Hadoop-2.5.2集群安装配置详解 下篇帖子: linux上部署hadoop集群 HA+Federation篇
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表