温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

CentOS6.5中怎么利用ROOT用户实现HDFS伪分布式部署

发布时间:2021-07-21 10:12:15 来源:亿速云 阅读:179 作者:Leah 栏目:开发技术

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
    <configuration>

  •     <property>

  •         <name>fs.defaultFS</name>

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

  •     </property>

  • </configuration>


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

  • <configuration>

  •     <property>

  •         <name>dfs.replication</name>

  •         <value>1</value>             -- 集群主机数量

  •     </property>

  • </configuration>

  • <configuration>


#本机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伪分布式部署问题的解答就分享到这里了,希望以上内容可以对大家有一定的帮助,如果你还有很多疑惑没有解开,可以关注亿速云行业资讯频道了解更多相关知识。

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI