hadoop配置

    • 软件环境
      • 搭建规划
    • 安装过程
      • 用户
      • 关闭防火墙
      • 免密登陆之前已经配置过了
      • 创建工具
      • 安装JDK
      • 安装Zookeeper
      • 安装hadoop
      • yarn配置
        • PS
      • 集群初始化
      • 启动yarn
      • 集群关启顺序
        • 再次启动集群
      • 查看集群状态
    • 出现问题

软件环境

hadoop usr/hadoop/app/hadoop
jdk /usr/local/jdk-xxx
zookeeper /usr/hadoop/app/hadoop

软件去官网下载既可

搭建规划

lk slave2 slave2 slave3 slave4 slave5
namenode y y n n n
datanode n n y y y
resourcemanager y y n n n
jouralnode y y y y y
zookeeper y y y n n

安装过程

用户

注意不能用root用户,可以新建一个或者用一个普通账户就可以
我这里用的是qsb,home路径为/home/qsb

关闭防火墙

  1. 查看防火墙状态
    service iptables status

  2. 然后永久关闭防火墙,使用chkconfig iptables off命令,此时当前虚拟机的防火墙还没有关闭。只有在关机重启后才能生效。

免密登陆——之前已经配置过了

创建工具

在家目录下创建tools文件夹,然后创建如下三个文件
这个工具很方便,前面的配置也可以用

  • deploy.sh
#!/bin/bash 
#set -x 

#判断参数是否小于3个,因为运行deploy.sh需要有源文件(或源目录)和目标文件(或目标目录), 
#以及在MachineTag(哪些主机)上执行,这个标记就是上面deploy.conf中的标记 ,如 zookeeper、all等 
#使用实例如:我们把app目录下的所有文件复制到远程标记为zookeeper的主机上的/home/hadoop/app目录下 
# ./deploy.sh  /home/hadoop/app /home/hadoop/app zookeeper 
#执行完上述命令后,shell脚本文件就自动把CDHNode1下的app目录中的文件复制到三个zookeeper节点的app目录下  
if [ $# -lt 3 ]   
then  
  echo "Usage: ./deply.sh srcFile(or Dir) descFile(or Dir) MachineTag" 
  echo "Usage: ./deply.sh srcFile(or Dir) descFile(or Dir) MachineTag confFile" 
  exit  
fi 
#源文件或源目录 
src=$1 
#目标文件或目标目录 
dest=$2cat  
#标记 
tag=$3 

#判断是否使用deploy.conf配置文件,或者自己指定配置文件 

if [ 'a'$4'a' == 'aa' ] 
then 
  confFile=/home/hadoop/tools/deploy.conf 
else  
  confFile=$4 
fi 

#判断配置文件是否是普通文本文件 
if [ -f $confFile ] 
then 
#判断原件是普通文件还是目录 
 if [ -f $src ] 
  then 
#如果是普通文件就把解析出标记对应的主机名的ip 
 for server in `cat $confFile|grep -v '^#'|grep ','$tag','|awk -F',' '{print $1}'`  
    do 
       scp $src $server":"${dest}  #使用循环把文件复制到目标ip上的相应目录下 
    done  
  elif [ -d $src ] 
  then 
    for server in `cat $confFile|grep -v '^#'|grep ','$tag','|awk -F',' '{print $1}'`  
    do 
       scp -r $src $server":"${dest} 
    done  
  else 
      echo "Error: No source file exist" 
  fi 

else 
  echo "Error: Please assign config file or run deploy.sh command with deploy.conf in same directory" 
fi 
  • runRemoteCmd.sh
#!/bin/bash 
#set -x 
#判断参数个数 
#实例如:显示所有节点的java进程,中间用引号的就是命令,这个命令将在所以节点上执行 
#./runRemoteCmd.sh  "jps" all 
if [ $# -lt 2 ] 
then  
  echo "Usage: ./runRemoteCmd.sh Command MachineTag" 
  echo "Usage: ./runRemoteCmd.sh Command MachineTag confFile" 
  exit  
fi 

cmd=$1 
tag=$2 
if [ 'a'$3'a' == 'aa' ] 
then 

  confFile=/home/hadoop/tools/deploy.conf 
else  
  confFile=$3 
fi 

if [ -f $confFile ] 
then 
    for server in `cat $confFile|grep -v '^#'|grep ','$tag','|awk -F',' '{print $1}'`  
    do 
       echo "*******************$server***************************" 
       ssh $server "source /etc/profile; $cmd"   
# 注意在使用的时候要根据自己设置的环境变量的配置位置,给定相应的source源 , 
# 如 我把环境变量设/home/hadoop/.bash_profile文件下,就需要上面这条命令改为 
# ssh $server "source /home/hadoop/.bash_profile;$cmd" 
#上面的例子:这条命令就是在远程标记为tag的主机下执行这个命令jps。 
 done  
else 
  echo "Error: Please assign config file or run deploy.sh command with deploy.conf in same directory"  
fi  
  • deploy.conf
lk,all,zookeeper,journalnode,namenode,resourcemanager, 
slave2,all,slave,zookeeper,journalnode,namenode,datanode,resourcemanager, 
slave3,all,slave,zookeeper,journalnode,datanode,nodemanager, 
slave4,all,slave,journalnode,datanode,nodemanager, 
slave5,all,slave,journalnode,datanode,nodemanager,
  • 给脚本文件添加执行权限
sudo chmod u+x deploy.sh 
sudo chmod u+x runRemoteCmd.sh 

为了方便起见,将tools目录添加到环境变量中

然后就可以通过runRemoteCmd.sh脚本,一键创建所有节点的软件安装目录/usr/hadoop/app

安装JDK

  • 卸载原有的openjdk

    1. 查看原有的JDK信息
rpm -qa | grep java
  1. 把原有的openjdk的软件都需要卸载掉
rpm -e --nodeps xxxx
  1. 安装官网下载的JDK
    直接解压到一个路径,然后在系统路径中添加JDK解压路径即可
export JAVA_HOME=/usr/local/jdk-xxx
export CLASSPATH=.:$JAVA_HOME/lib:$CLASSPATH 
export PATH=$PATH:$JAVA_HOME/bin:$JAVA_HOME/jre/bin 
  1. 记得source一下

  2. 然后查看:

java -version

显示是你下载的版本就行

安装Zookeeper

下载好Zookeeper,然后解压到一个路径,我的机子上是/usr/hadoop/app/zookeeper

  • 修改zookeeper的配置文件
    conf/ 文件夹下面

  • 创建zoo.cfg文件

原来文件夹下面有一个zoo_sample.cfg
cp zoo_sample.cfg zoo.cfg

  • 打开zoo.cfg文件
#添加下面的 
# The number of milliseconds of each tick 
tickTime=2000 
# The number of ticks that the initial 
# synchronization phase can take 
initLimit=10 
# The number of ticks that can pass between 
# sending a request and getting an acknowledgement 
syncLimit=5 
# the directory where the snapshot is stored. 
# do not use /tmp for storage, /tmp here is just 
# example sakes. 
#数据文件目录与日志目录 ,这两个可根据自己的来
dataDir=/data/hadoop/data/zookeeper/zkdata 
dataLogDir=/data/hadoop/data/zookeeper/zkdatalog 
# the port at which the clients will connect 
clientPort=2181 
#server.服务编号=主机名称:Zookeeper不同节点之间同步和通信的端口:选举端口(选举leader)  
server.1=lk:2888:3888 
server.2=slave2:2888:3888 
server.3=slave3:2888:3888 

# administrator guide before turning on autopurge. 
# 
# http://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_maintenance 
# 
# The number of snapshots to retain in dataDir 
#autopurge.snapRetainCount=3 
# Purge task interval in hours 
# Set to "0" to disable auto purge feature 
#autopurge.purgeInterval=1 
  • 配置环境变量
    个人习惯在/etc/profile中配置
export ZOOKEEPER_HOME=/home/hadoop/app/zookeeper  
export PATH=$PATH:$ZOOKEEPER_HOME/bin 

记得source一下

  • 通过远程命令deploy.sh将Zookeeper安装目录拷贝到其他节点(slave2、slave3)上面
deploy.sh zookeeper /usr/hadoop/app/ zookeeper 
  • 通过远程命令runRemoteCmd.sh在所有的zookeeper节点(lk、slave2、slave3)上面创建目录
runRemoteCmd.sh "mkdir -p /home/hadoop/data/zookeeper/zkdata" zookeeper   //创建数据目录 
runRemoteCmd.sh "mkdir -p /home/hadoop/data/zookeeper/zkdatalog" zookeeper   //创建日志目录  
  • 在前面设置的zookeeper数据文件夹中创建myid文件
cd /data/hadoop/data/zookeeper/zkdata  
vim myid

根据前面的server.x来输入
在这里lk,slave2,slave3中分别填入1,2,3

  • 启动zookeeper
    使用runRemoteCmd.sh 脚本,启动所有节点(lk,slave2,slave3)上面的Zookeeper。
 runRemoteCmd.sh "/home/hadoop/app/zookeeper/bin/zkServer.sh start" zookeeper
  • 查看所有节点上面的QuorumPeerMain进程是否启动。
 runRemoteCmd.sh "jps" zookeeper  
或者
 runRemoteCmd.sh "/home/hadoop/app/zookeeper/bin/zkServer.sh status" zookeeper  

如果一个节点为leader,另2个节点为follower,则说明Zookeeper安装成功。



安装hadoop

  • 下载hadoop,解压到/usr/hadoop/app/hadoop中

  • 配置环境变量

HADOOP_HOME=/usr/hadoop/app/hadoop 
PATH=$HADOOP_HOME/bin:$PATH 
  • 切换到usr/hadoop/app/hadoop/etc/hadoop/录下,修改配置文件。

  • 配置hadoop-env.sh

vi hadoop-env.sh
export JAVA_HOME=/usrlocal/jdk1.7.0_79
  • 配置core-site.xml
    仔细看一下,里面的数据都要改成自己的
vi core-site.xml 
<configuration> 
        <property> 
                <name>fs.defaultFSname> 
                <value>hdfs://cluster1value> 
        property> 
         
        <property> 
                <name>hadoop.tmp.dirname> 
                <value>/data/hadoop/data/tmpvalue> 
        property> 
          
        <property> 
                <name>ha.zookeeper.quorumname> 
                <value>lk:2181,slave2:2181,slave3:2181,slave4:2181,slave5:2181value> 
        property> 
         
configuration> 
  • 配置hdfs-site.xml
vi hdfs-site.xml 
<configuration>  
        <property>  
                <name>dfs.replicationname>  
                <value>3value>  
        property>  
          
        <property>  
                <name>dfs.permissionsname>  
                <value>falsevalue>  
        property>  
        <property>  
                <name>dfs.permissions.enabledname>  
                <value>falsevalue>  
        property>  
          
        <property>  
                <name>dfs.nameservicesname>  
                <value>cluster1value>  
        property>  
          
        <property>  
                <name>dfs.ha.namenodes.cluster1name>  
                <value>lk,slave2value>  
        property>  
          
        <property>  
                <name>dfs.namenode.rpc-address.cluster1.lkname>  
                <value>lk:9000value>  
        property>  
          
        <property>  
                <name>dfs.namenode.http-address.cluster1.lkname>  
                <value>lk:50070value>  
        property>  
          
        <property>  
                <name>dfs.namenode.rpc-address.cluster1.slave2name>  
                <value>slave2:9000value>  
        property>  
          
        <property>  
                <name>dfs.namenode.http-address.cluster1.slave2name>  
                <value>slave2:50070value>  
        property>  
          
        <property>  
                <name>dfs.ha.automatic-failover.enabledname>  
                <value>truevalue>  
        property>  
          
        <property>  
                <name>dfs.namenode.shared.edits.dirname>  
                <value>qjournal://lk:8485;slave2:8485;slave3:8485;slave4:8485;slave5:8485/cluster1value>  
        property>  
          
        <property>  
                <name>dfs.client.failover.proxy.provider.cluster1name>  
                <value>org.apache.hadoop.hdfs.server.namenode.ha.ConfiguredFailoverProxyProvidervalue>  
        property>  
          
        <property>  
                <name>dfs.journalnode.edits.dirname>  
                <value>/tmp/hadoop/data/journaldata/jnvalue>  
        property>  
          
        <property>  
                <name>dfs.ha.fencing.methodsname>  
                <value>shell(/bin/true)value>  
        property>  
        <property>  
        <name>dfs.ha.fencing.ssh.private-key-filesname>  
        <value>/home/qsb/.ssh/id_rsavalue>  
        property>  
        <property>  
        <name>dfs.ha.fencing.ssh.connect-timeoutname>  
        <value>10000value>  
        property>  
          
        <property>  
                <name>dfs.namenode.handler.countname>  
                <value>100value>  
        property>  
configuration>  
  • 配置 slave
vim slaves 
slave3
slave4
slave5

yarn配置

  • 配置mapred-site.xml
<configuration> 
        <property> 
                <name>mapreduce.framework.namename> 
                <value>yarnvalue> 
        property> 
          
configuration> 
  • 配置 yarn-site.xml
<configuration> 
     <property> 
          <name>yarn.resourcemanager.connect.retry-interval.msname> 
          <value>2000value> 
     property> 
      
     <property> 
          <name>yarn.resourcemanager.ha.enabledname> 
          <value>truevalue> 
     property> 
      
     <property> 
          <name>yarn.resourcemanager.ha.automatic-failover.enabledname> 
          <value>truevalue> 
     property> 
      
     <property> 
          <name>yarn.resourcemanager.ha.automatic-failover.embeddedname> 
          <value>truevalue> 
     property> 
     <property> 
          <name>yarn.resourcemanager.cluster-idname> 
           <value>yarn-rm-clustervalue> 
     property> 
      
     <property> 
          <name>yarn.resourcemanager.ha.rm-idsname> 
          <value>rm1,rm2value> 
     property> 
      
     <property> 
          <name>yarn.resourcemanager.hostname.rm1name> 
          <value>lkvalue> 
     property> 
      
     <property> 
          <name>yarn.resourcemanager.hostname.rm2name> 
          <value>slave2value> 
     property> 
      
     <property> 
           <name>yarn.resourcemanager.recovery.enabledname> 
          <value>truevalue> 
     property> 
      
     <property> 
          <name>yarn.resourcemanager.zk.state-store.addressname> 
           <value>lk:2181,slave2:2181,slave3:2181,slave4:2181slave5:2181value> 
     property> 
      
     <property> 
           <name>yarn.resourcemanager.zk-addressname> 
          <value>lk:2181,slave2:2181,slave3:2181,slave4:2181slave5:2181value> 
     property> 
      
     <property> 
           <name>yarn.resourcemanager.address.rm1name> 
          <value>lk:8032value> 
     property> 
      
     <property> 
          <name>yarn.resourcemanager.scheduler.address.rm1name> 
          <value>lk:8034value> 
     property> 
      
     <property> 
          <name>yarn.resourcemanager.webapp.address.rm1name> 
          <value>lk:8088value> 
     property> 
      
     <property> 
          <name>yarn.resourcemanager.address.rm2name> 
     <value>slave2:8032value> 
     property> 
      
     <property> 
          <name>yarn.resourcemanager.scheduler.address.rm2name> 
          <value>slave2:8034value> 
     property> 
      
     <property> 
          <name>yarn.resourcemanager.webapp.address.rm2name> 
          <value>slave2:8088value> 
     property> 
      
     <property> 
           <name>yarn.nodemanager.aux-servicesname> 
          <value>mapreduce_shufflevalue> 
     property> 
     <property> 
           <name>yarn.nodemanager.aux-services.mapreduce_shuffle.classname>  
          <value>org.apache.hadoop.mapred.ShuffleHandlervalue> 
     property> 
      
configuration>  
  • 创建好需要的目录
runRemoteCmd.sh "mkdir -p /data/hadoop/data/name" all 

runRemoteCmd.sh "mkdir -p /data/hadoop/data/hdfs/edits" all 

runRemoteCmd.sh "mkdir -p /data/hadoop/data/datanode" all 

runRemoteCmd.sh "mkdir -p /data/hadoop/data/journaldata/jn" all 

runRemoteCmd.sh "mkdir -p /data/hadoop/data/tmp" all 

runRemoteCmd.sh "touch /usr/hadoop/app/hadoop/etc/hadoop/excludes" all  

runRemoteCmd.sh "mkdir -p /data/hadoop/data/pid" all  

PS:

  • 当你的在初始化工程中出错,要把相关目录的文件删除,然后再重新初始化
rm -rf /data/hadoop/data/name/* 

rm -rf /data/hadoop/data/hdfs/edits/* 

rm -rf /data/hadoop/data/datanode/* 

rm -rf /data/hadoop/data/journaldata/jn/* 

rm -rf /data/hadoop/data/tmp/
  • 当你的在初始化工程中出错,要把相关目录的文件删除,然后再重新初始化
rm -rf /data/hadoop/data/name/* 
rm -rf /data/hadoop/data/hdfs/edits/* 

rm -rf /data/hadoop/data/datanode/* 

rm -rf /data/hadoop/data/journaldata/jn/* 

rm -rf /data/hadoop/data/tmp/* 
  • hadoop是所有机器上都要配置的,以上hadoop操作所有机器都要配置

集群初始化

  • 启动所有节点上面的Zookeeper进程
runRemoteCmd.sh "/usr/hadoop/app/zookeeper/bin/zkServer.sh start" zookeeper
  • 启动所有节点上面的journalnode进程
 runRemoteCmd.sh "/usr/hadoop/app/hadoop/sbin/hadoop-daemon.sh start journalnode" all
  • 首先在主节点上(比如,lk)执行格式化
bin/hdfs namenode -format              / /namenode 格式化  
bin/hdfs zkfc -formatZK                 //格式化高可用 
bin/hdfs namenode           //启动namenode  

如果报错,记得看日志查找问题

  • 与此同时,需要在备节点(比如 slave2)上执行数据同步
bin/hdfs namenode -bootstrapStandby     //同步主节点和备节点之间的元数据
  • slave2同步完数据后,紧接着在CDHNode1节点上,按下ctrl+c来结束namenode进程。 然后关闭所有节点上面的journalnode进程
runRemoteCmd.sh "/usr/hadoop/app/hadoop/sbin/hadoop-daemon.sh stop journalnode" all        //然后停掉各节点的journalnode
  • 如果上面操作没有问题,我们可以一键启动hdfs所有相关进程
sbin/start-dfs.sh  
  • 验证是否启动成功

通过web界面查看namenode启动情况。
http://10.113.10.1:50070


一个active,一个standby(因为之前测试的时候把lk暂时关闭了,所以lk成了standby,slave2成了active)

启动成功之后,查看关闭其中一个namenode ,然后在启动namenode 观察切换的状况
关闭slave2

  • 上传文件至hdfs
vi test1.txt  //本地创建一个a.txt文件,内容自己写吧
hdfs dfs -mkdir /test   //在hdfs上创建一个文件目录
hdfs dfs -put test1.txt /test      //向hdfs上传一个文件
hdfs dfs -ls /test       //查看a.txt是否上传成功

如果上面操作没有问题说明hdfs配置成功。

启动yarn

  • 在lk节点上执行。
sbin/start-yarn.sh     
  • 在slave2节点上面执行
sbin/yarn-daemon.sh start resourcemanager 
  • 此时可以看到web界面

网址是:10.113.10.1:8088

显示出集群的信息

如果是打开10.113.10.2:8088,那么会跳转到10.113.10.1的上面

  • 检查一下ResourceManager状态
bin/yarn rmadmin -getServiceState rm1
bin/yarn rmadmin -getServiceState rm2
  • Wordcount示例测试
#创建一个新的文件test2.txt
vim test2.txt

# 上传
hdfs dfs -put test2.txt /test

# 查看
hdfs dfs -ls /test

#测试
hadoop jar share/hadoop/mapreduce/hadoop-mapreduce-examples-2.7.4.jar wordcount /test/test2.txt /test/test2_out/

如果上面执行没有异常,说明YARN安装成功。

  • 计算圆周率测试
    hadoop jar share/hadoop/mapreducehadoop-mapreduce-examples-2.7.4.jar pi 5 5 计算圆周率PI,任务5个,取样5个

集群关启顺序

  • 在slave2节点上面执行
sbin/yarn-daemon.sh stop resourcemanager 
  • 在lk节点上执行
sbin/stop-yarn.sh  
  • 关闭HDFS
sbin/stop-dfs.sh 
  • 关闭zookeeper
runRemoteCmd.sh "/usr/hadoop/app/zookeeper-3.4.10/bin/zkServer.sh stop" zookeeper 

再次启动集群

  • 启动zookeeper
runRemoteCmd.sh "/usr/hadoop/app/zookeeper-3.4.10/bin/zkServer.sh start" zookeeper 
  • 启动HDFS
sbin/start-dfs.sh 
  • 在lk节点上执行
sbin/start-yarn.sh 
  • 在slave2节点上面执行
sbin/yarn-daemon.sh start resourcemanager

至此,hadoop 分布式集群搭建完毕。

查看集群状态

bin/hdfs dfsadmin -report

显示整个集群的信息

Starting namenodes on [slave2 lk]
lk: starting namenode, logging to /usr/hadoop/app/hadoop/logs/hadoop-qsb-namenode-lk.out
slave2: namenode running as process 13351. Stop it first.
slave3: datanode running as process 10874. Stop it first.
slave4: datanode running as process 10773. Stop it first.
slave5: datanode running as process 2446. Stop it first.
Starting journal nodes [lk slave2 slave3 slave4 slave5]
lk: journalnode running as process 8508. Stop it first.
slave4: journalnode running as process 10875. Stop it first.
slave5: journalnode running as process 2548. Stop it first.
slave2: journalnode running as process 13456. Stop it first.
slave3: journalnode running as process 10978. Stop it first.
Starting ZK Failover Controllers on NN hosts [slave2 lk]
lk: zkfc running as process 8795. Stop it first.
slave2: zkfc running as process 13672. Stop it first.
[qsb@lk hadoop]$ /bin/hdfs dfsadmin -report
-bash: /bin/hdfs: No such file or directory
[qsb@lk hadoop]$ bin/hdfs dfsadmin -report
Configured Capacity: 133037051904 (123.90 GB)
Present Capacity: 100757676032 (93.84 GB)
DFS Remaining: 100757311488 (93.84 GB)
DFS Used: 364544 (356 KB)
DFS Used%: 0.00%
Under replicated blocks: 0
Blocks with corrupt replicas: 0
Missing blocks: 0
Missing blocks (with replication factor 1): 0

-------------------------------------------------
Live datanodes (3):

Name: 10.113.10.4:50010 (slave4)
Hostname: slave4
Decommission Status : Normal
Configured Capacity: 44345683968 (41.30 GB)
DFS Used: 118784 (116 KB)
Non DFS Used: 10791297024 (10.05 GB)
DFS Remaining: 33554268160 (31.25 GB)
DFS Used%: 0.00%
DFS Remaining%: 75.67%
Configured Cache Capacity: 0 (0 B)
Cache Used: 0 (0 B)
Cache Remaining: 0 (0 B)
Cache Used%: 100.00%
Cache Remaining%: 0.00%
Xceivers: 1
Last contact: Sun Nov 05 22:01:14 CST 2017


Name: 10.113.10.3:50010 (slave3)
Hostname: slave3
Decommission Status : Normal
Configured Capacity: 44345683968 (41.30 GB)
DFS Used: 122880 (120 KB)
Non DFS Used: 10496921600 (9.78 GB)
DFS Remaining: 33848639488 (31.52 GB)
DFS Used%: 0.00%
DFS Remaining%: 76.33%
Configured Cache Capacity: 0 (0 B)
Cache Used: 0 (0 B)
Cache Remaining: 0 (0 B)
Cache Used%: 100.00%
Cache Remaining%: 0.00%
Xceivers: 1
Last contact: Sun Nov 05 22:01:13 CST 2017


Name: 10.113.10.5:50010 (slave5)
Hostname: slave5
Decommission Status : Normal
Configured Capacity: 44345683968 (41.30 GB)
DFS Used: 122880 (120 KB)
Non DFS Used: 10991157248 (10.24 GB)
DFS Remaining: 33354403840 (31.06 GB)
DFS Used%: 0.00%
DFS Remaining%: 75.21%
Configured Cache Capacity: 0 (0 B)
Cache Used: 0 (0 B)
Cache Remaining: 0 (0 B)
Cache Used%: 100.00%
Cache Remaining%: 0.00%
Xceivers: 1
Last contact: Sun Nov 05 22:01:14 CST 2017

出现问题

首先还是推荐看日志,因为很多问题都在日志上写出来了

注意看网上教程的时候要根据自己本机的设置更改文件

我在hadoop配置的时候的问题主要是:

  1. java环境的问题(包括zookeeper和hadoop)
    nohup: failed to run command ‘java’: No such file or directory
    明明没有问题,为什么报错?
    hadoop需要自己再指明java路径,在hadoop-env.sh
    JAVA_HOME=你自己的java路径
  2. zookeeper 启动之后没有QuorumPeerMain进程
    看看日志的——就是zookeeper主目录下的zookeeper.out
    我当时出现错误的原因是
2017-11-20 08:26:00,090 [myid:] - INFO  [main:QuorumPeerConfig@134] - Reading configuration from: /usr/hadoop/app/zookeeper/bin/../conf/zoo.cfg
2017-11-20 08:26:00,110 [myid:] - INFO  [main:QuorumPeer$QuorumServer@167] - Resolved hostname: 10.113.10.3 to address: /10.113.10.3
2017-11-20 08:26:00,110 [myid:] - INFO  [main:QuorumPeer$QuorumServer@167] - Resolved hostname: 10.113.10.2 to address: /10.113.10.2
2017-11-20 08:26:00,113 [myid:] - INFO  [main:QuorumPeer$QuorumServer@167] - Resolved hostname: 10.113.10.1 to address: /10.113.10.1
2017-11-20 08:26:00,113 [myid:] - INFO  [main:QuorumPeerConfig@396] - Defaulting to majority quorums
2017-11-20 08:26:00,115 [myid:] - ERROR [main:QuorumPeerMain@85] - Invalid config, exiting abnormally

是myid文件出错

重新配置一下就可以了

  1. 上传文档的时候,显示是处于安全模式导致无法上传
    关闭安全模式:
hdfs dfsadmin -safemode leave

获取安全模式的状态:
hdfs dfsadmin -safemode get

你可能感兴趣的:(实验,大数据实验,课程学习,hadoop配置,大数据实验)