网站建设资讯

NEWS

网站建设资讯

CentOS6.5中怎么利用ROOT用户实现HDFS伪分布式部署-创新互联

为沭阳等地区用户提供了全套网页设计制作服务,及沭阳网站建设行业解决方案。主营业务为网站建设、成都网站设计、沭阳网站设计,以传统方式定制建设网站,并提供域名空间备案等一条龙服务,秉承以专业、用心的态度为用户提供真诚的服务。我们深信只要达到每一位用户的要求,就会得到认可,从而选择与我们长期合作。这样,我们也可以走得更远!

CentOS6.5中怎么利用ROOT用户实现HDFS伪分布式部署,针对这个问题,这篇文章详细介绍了相对应的分析和解答,希望可以帮助更多想解决这个问题的小伙伴找到更简单易行的方法。

hadoop部署

单机               --无进程
伪分布式部署   -- 进程存在+1节点   开发
集群部署         -- 进程存在+n阶段   开发/生产

#hadoop解压
[root@hadoop001 software]# tar -xzvf hadoop-2.8.1.tar.gz
[root@hadoop001 software]# chown -R root:root hadoop-2.8.1

[root@hadoop001 hadoop-2.8.1]# ll
drwxrwxr-x. 2 root root  4096 Jun  2  2017 bin                -- 执行命令shell
drwxrwxr-x. 3 root root  4096 Jun  2  2017 etc                -- 配置文件                 
drwxrwxr-x. 2 root root  4096 Jun  2  2017 include
drwxrwxr-x. 3 root root  4096 Jun  2  2017 lib                  -- 库
drwxrwxr-x. 2 root root  4096 Jun  2  2017 libexec
-rw-rw-r--. 1 root root 99253 Jun  2  2017 LICENSE.txt
-rw-rw-r--. 1 root root 15915 Jun  2  2017 NOTICE.txt
-rw-r--r--. 1 root root  1366 Jun  2  2017 README.txt
drwxrwxr-x. 2 root root  4096 Jun  2  2017 sbin                -- 启动和关闭hadoop                 
drwxrwxr-x. 4 root root  4096 Jun  2  2017 share              --  jar

#hadoop全局环境变量
[root@hadoop001 hadoop-2.8.1]# vim /etc/profile
export HADOOP_HOME=/opt/software/hadoop-2.8.1
export PATH=$HADOOP_HOME/bin:$PROTOC_HOME/bin:$FINDBUGS_HOME/bin:$MAVEN_HOME/bin:$JAVA_HOME/bin:$PATH

[root@hadoop001 hadoop-2.8.1]# source /etc/profile
[root@hadoop001 hadoop-2.8.1]# which hadoop
/opt/software/hadoop-2.8.1/bin/hadoop

[root@hadoop001 bin]# rm -rf *.cmd
[root@hadoop001 sbin]# rm -rf *.cmd

#配置core-site文件

  • [root@hadoop001 hadoop]# vim core-site.xml

  •     

  •         fs.defaultFS

  •         hdfs://localhost:9000    --HDFD端口和路径

  •     

  • [root@hadoop001 hadoop]# vim hdfs-site.xml:

  •     

  •         dfs.replication

  •         1             -- 集群主机数量

  •     


#本机ssh验证配置
[root@hadoop001 hadoop]# cd ~
[root@hadoop001 ~]# cd .ssh
[root@hadoop001 .ssh]# ll
total 0
[root@hadoop001 ~]# rm -rf .ssh
[root@hadoop001 ~]# ssh-keygen
[root@hadoop001 ~]# cd .ssh
[root@hadoop001 .ssh]# ll
total 8
-rw-------. 1 root root 1675 May 14 23:38 id_rsa
-rw-r--r--. 1 root root  396 May 14 23:38 id_rsa.pub
[root@hadoop001 .ssh]# cat id_rsa.pub >> authorized_keys
[root@hadoop001 .ssh]# ll
total 12
-rw-r--r--. 1 root root  396 May 14 23:40 authorized_keys
-rw-------. 1 root root 1675 May 14 23:38 id_rsa
-rw-r--r--. 1 root root  396 May 14 23:38 id_rsa.pub

#第一次必须操作,本机修改过端口
[root@hadoop001 ~]# ssh localhost date
ssh: connect to host localhost port 22: Connection refused
[root@hadoop001 ~]# ssh -p2222 localhost date
The authenticity of host '[localhost]:2222 ([::1]:2222)' can't be established.
RSA key fingerprint is 09:b9:67:65:cb:e6:ca:31:5d:33:6c:3b:92:9e:c2:1a.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '[localhost]:2222' (RSA) to the list of known hosts.
Mon May 14 23:42:37 EDT 2018

#格式化HDFS文件系统
[root@hadoop001 ~]# which hdfs
/opt/software/hadoop-2.8.1/bin/hdfs
[root@hadoop001 ~]# hdfs namenode -format

#启动HDFS文件系统
[root@hadoop001 sbin]# /opt/software/hadoop-2.8.1/sbin/start-dfs.sh
Starting namenodes on [localhost]
localhost: ssh: connect to host localhost port 22: Connection refused
localhost: ssh: connect to host localhost port 22: Connection refused
Starting secondary namenodes [0.0.0.0]
0.0.0.0: ssh: connect to host 0.0.0.0 port 22: Connection refused
#解决port 22错误

[root@hadoop000 hadoop]# vi  hadoop-env.sh

添加:export HADOOP_SSH_OPTS="-p 2222"

#解决 ERROR:JAVA_HOME
[root@hadoop000 hadoop]# vi  hadoop-env.sh
export JAVA_HOME=/usr/java/jdk1.8.0_45


#启动OK
[root@hadoop001 sbin]# /opt/software/hadoop-2.8.1/sbin/start-dfs.sh
[root@hadoop001 hadoop]# /opt/software/hadoop-2.8.1/sbin/start-dfs.sh
Starting namenodes on [localhost]
localhost: starting namenode, logging to /opt/software/hadoop-2.8.1/logs/hadoop-root-namenode-hadoop001.out
localhost: starting datanode, logging to /opt/software/hadoop-2.8.1/logs/hadoop-root-datanode-hadoop001.out
Starting secondary namenodes [0.0.0.0]
0.0.0.0: starting secondarynamenode, logging to /opt/software/hadoop-2.8.1/logs/hadoop-root-secondarynamenode-hadoop001.out

#检测与启动
[root@hadoop000 hadoop-2.8.1]# jps
16243 Jps
15943 DataNode
5127 Launcher
16139 SecondaryNameNode
15853 NameNode
 
 

关于CentOS6.5中怎么利用ROOT用户实现HDFS伪分布式部署问题的解答就分享到这里了,希望以上内容可以对大家有一定的帮助,如果你还有很多疑惑没有解开,可以关注创新互联-成都网站建设公司行业资讯频道了解更多相关知识。


网页名称:CentOS6.5中怎么利用ROOT用户实现HDFS伪分布式部署-创新互联
路径分享:http://cdweb.net/article/cojdjs.html