Hadoop+HBase+ZooKeeper分布式集群环境搭建

Hadoop+HBase+ZooKeeper分布式集群环境搭建

概述

本次 Hadoop 集群安装实验,采用在 VMware 虚拟机下安装多个 CentOS 系统的
方式进行;3 个 CentOS 系统中,其中,1 个为 Master 机,作为 NameNode;另外 3
个为 Slave 机,作为 DataNode,均采用独立静态 IP 地址配置。

1. 安装准备

1.1 软件系统清单

序号 名称 描述
1 jdk-8u171-linux-i586.tar.gz 所有环境都需要的配置 地址
2 VMware 虚拟机安装程序,这里采用 VMware12 模拟测试 地址
3 CentOS-7-x86_64-DVD-1804.iso 集群操作系统 地址
4 hadoop-2.8.3.tar.gz Hadoop 安装程序 地址
5 hbase-2.0.0-bin.tar.gz HBase 安装程序 地址
6 zookeeper-3.4.12.tar.gz 集群分布式应用程序协调服务 地址

以下是hbase官网提供的Hbase和Hadoop版本兼容信息 参考

  • “S” = supported(支持)
  • “X” = not supported(不支持)
  • “NT” = Not tested(未测试)
HBase-1.2.x HBase-1.3.x HBase-1.5.x HBase-2.0.x HBase-2.1.x
Hadoop-2.4.x S S X X X
Hadoop-2.5.x S S X X X
Hadoop-2.6.0 X X X X X
Hadoop-2.6.1+ S S X S X
Hadoop-2.7.0 X X X X X
Hadoop-2.7.1+ S S S S S
Hadoop-2.8.[0-1] X X X X X
Hadoop-2.8.2 NT NT NT NT NT
Hadoop-2.8.3+ NT NT NT S S
Hadoop-2.9.0 X X X X X
Hadoop-2.9.1+ NT NT NT NT NT
Hadoop-3.0.x X X X X X
Hadoop-3.1.0 X X X X X

1.2 IP 地址配置清单

集群环境至少需要3个节点(也就是3台服务器设备):1个Master,2个Slave,节点之间局域网连接,可以相互ping通,下面举例说明,配置节点IP分配如下:

Hostname IP User Password
master 192.168.1.60 root root
weiqi1 192.168.1.61 root root
weiqi2 192.168.1.62 root root

三个节点均使用CentOS-7系统,为了便于维护,集群环境配置项最好使用相同用户名、用户密码、相同hadoop、hbase、zookeeper目录结构。

^注: 可以通过编辑/etc/sysconfig/network文件来修改 hostname 。

2. 准备工作

^注: 本人习惯了使用nano编辑器,所有编辑文件都是用的是:nano+文件名称,习惯vim的可将nano替换为 vim或者vi

2.1 关闭防火墙

关闭firewalld防火墙:

1
2
3
$ systemctl status firewalld.service	#检查防火墙状态
$ systemctl stop firewalld.service #关闭防火墙
$ systemctl disable firewalld.service #禁止开机启动防火墙

关闭iptables防火墙:

1
2
3
$ systemctl status iptables				#检查防火墙状态
$ systemctl stop iptables #关闭防火墙
$ systemctl disable iptables #禁止开机启动防火墙

2.2 安装JDK

上传jdk-8u171-linux-i586.tar.gz安装包到根目录下新建的weiqi文件夹中,

进去到weiqi目录下,解压安装包:

1
$ tar -zxvf jdk-8u171-linux-i586.tar.gz

配置java环境变量,打开/etc/profile 文件

1
$ nano /etc/profile 

添加如下配置:

1
2
3
export JAVA_HOME=/weiqi/jdk1.8.0_171
export PATH=$JAVA_HOME/bin:$PATH export
CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar

然后重新加载配置文件使之生效:

1
$ source /etc/profile 

若提示 :-bash: /weiqi/jdk1.8.0_171/bin/javac: /lib/ld-linux.so.2: bad ELF interpreter: 没有那个文件或目录

1
安装 :yum install glibc.i686

检查java环境是否配置成功:

1
$ java -version

看到如下响应说明环境OK:

1
2
3
java version "1.8.0_171"
Java(TM) SE Runtime Environment (build 1.8.0_171-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.171-b11, mixed mode)

2.3 添加Hosts映射关系

分别在三个节点上修改hosts映射关系:

1
$ nano /etc/hosts     

添加的内容如下:

1
2
3
192.168.1.60 master
192.168.1.61 weiqi1
192.168.1.62 weiqi2

2.4 集群之间SSH无密码登陆

CentOS默认安装了ssh,如果没有你需要先安装ssh 。

集群环境的使用必须通过ssh无密码登陆来执行,本机登陆本机必须无密码登陆,主机与从机之间必须可以双向无密码登陆,从机与从机之间无限制。

主要有三步:①生成公钥和私钥、②导入公钥到认证文件、③更改权限

分别在各个主机上生成密钥:

1
$ ssh-keygen -t rsa 								//生成秘钥  

在weiqi1上:

1
2
$ cp ~/.ssh/id_rsa.pub ~/.ssh/weiqi1.id_rsa.pub		//复制备份
$ scp ~/.ssh/weiqi1.id_rsa.pub master:~/.ssh //拷贝到master准备认证

在weiqi2上:

1
2
$ cp ~/.ssh/id_rsa.pub ~/.ssh/weiqi2.id_rsa.pub		//复制备份
$ scp ~/.ssh/weiqi2.id_rsa.pub master:~/.ssh //拷贝到master准备认证

在master 上:

1
2
3
4
5
6
$ cd ~/.ssh
$ cat id_rsa.pub >> authorized_keys
$ cat weiqi1.id_rsa.pub >>authorized_keys //导入到认证文件
$ cat weiqi2.id_rsa.pub >>authorized_keys //导入到认证文件
$ scp authorized_keys weiqi1:~/.ssh //更改权限
$ scp authorized_keys weiqi2:~/.ssh //更改权限

测试:

1
2
3
4
5
6
7
[root@master ~]# ssh weiqi1
Last login: Tue Jul 10 16:50:05 2018 from 192.168.1.97
[root@weiqi1 ~]#

[root@master ~]# ssh weiqi2
Last login: Tue Jul 10 16:50:06 2018 from 192.168.1.97
[root@weiqi2 ~]#

可通过exit退回到master上

3. Hadoop集群安装配置

3.1 安装置配置Hadoop

3.1.1 安装Hadoop

上传hadoop-2.8.3.tar.gz安装包到weiqi文件夹下

解压安装包:

1
$ tar -zxvf hadoop-2.8.3.tar.gz

进入到hadoop-2.8.3下:

分别创建如下相关文件:

1
2
3
4
$ mkdir hdfs
$ mkdir hdfs/data //DataNode存放文件夹
$ mkdir hdfs/name //NameNode存放文件夹
$ mkdir hdfs/tmp //数据临时存放文件夹

进入到etc/hadoop目录下,分别修改如下配置文件

3.1.2 配置core-site.xml

nano core-site.xml

1
2
3
4
5
6
7
8
9
10
11
12
<configuration>
<!-- 指定hdfs的nameservice为master -->
<property>
<name>fs.defaultFS</name>
<value>hdfs://master:9000</value>
</property>
<!--指定hadoop数据临时存放目录-->
<property>
<name>hadoop.tmp.dir</name>
<value>/weiqi/hadoop-2.8.3/hdfs/tmp</value>
</property>
</configuration>

3.1.3 配置hadoop-env.sh

$ nano hadoop-env.sh

1
2
#添加JDK路径
export JAVA_HOME=/home/java/jdk1.8.0_171

3.1.4 配置hdfs-site.xml

$ nano hdfs-site.xml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<configuration>
<!-- 设置hdfs中存放NameNode的文件路径 -->
<property>
<name>dfs.namenode.name.dir</name>
<value>file:/weiqi/hadoop-2.8.3/hdfs/name</value>
</property>
<!-- 设置hdfs中存放DataNode的文件路径 -->
<property>
<name>dfs.datanode.data.dir</name>
<value>file:/weiqi/hadoop-2.8.3/hdfs/data</value>
</property>
<!-- 指定hdfs保存数据的副本数量 数据版本-->
<property>
<name>dfs.replication</name>
<value>2</value>
</property>
</configuration>

3.1.5 配置mapred-site.xml

$ nano mapred-site.xml

1
2
3
4
5
6
7
8
9
10
11
12
13
<configuration>
<!-- 连接jobtrack服务器的配置项 -->
<property>
<name>mapred.job.tracker</name>
<value>master:9001</value>
</property>
<!-- 告诉hadoop以后MR(Map/Reduce)运行在YARN上 -->
<property>
<name>mapreduce.framework.name</name>
<value>yarn</value>
</property>
</configuration>

3.1.6 配置yarn-env.sh

$ nano yarn-env.sh

1
2
#添加JDK路径
export JAVA_HOME=/home/java/jdk1.8.0_171

3.1.7 配置yarn-site.xml

$ nano yarn-site.xml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<configuration>
<!--nomenodeManager获取数据的方式是shuffle-->
<property>
<name>yarn.nodemanager.aux-services</name>
<value>mapreduce_shuffle</value>
</property>
<!--指定Yarn的老大(ResourceManager)的地址-->
<property>
<name>yarn.resourcemanager.hostname</name>
<value>master</value>
</property>
<!--Yarn打印工作日志-->
<property>
<name>yarn.log-aggregation-enable</name>
<value>true</value>
</property>
</configuration>

3.1.8 配置 slaves

$ nano slaves

1
2
weiqi1
weiqi2

3.2 部署他其他节点

1
2
$ scp -r /weiqi/hadoop-2.8.3 weiqi1:/weiqi/hadoop-2.8.3
$ scp -r /weiqi/hadoop-2.8.3 weiqi2:/weiqi/hadoop-2.8.3

3.3 分别配置Hadoop环境变量

$ nano /etc/profile

添加:

1
2
3
4
5
6
7
8
#配置Hadoop环境变量
export HADOOP_HOME=/weiqi/hadoop-2.8.3
export HADOOP_COMMON_HOME=$HADOOP_HOME
export HADOOP_HDFS_HOME=$HADOOP_HOME
export HADOOP_MAPRED_HOME=$HADOOP_HOME
export HADOOP_YARN_HOME=$HADOOP_HOME
export HADOOP_CONF_DIR=$HADOOP_HOME/etc/hadoop
export PATH=$HADOOP_HOME/bin:$HADOOP_HOME/sbin:$PATH

然后重新加载配置文件使之生效:

1
$ source /etc/profile 

3.4 格式化namenode

进入master,格式化namenode,第一次启动服务前执行的操作,以后不需要执行。

1
$ hdfs namenode -format

如出现包含以下结果,说明格式化成功了:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
[root@master ~]# hdfs namenode -format
18/07/14 15:09:05 INFO namenode.NameNode: STARTUP_MSG:
/************************************************************
STARTUP_MSG: Starting NameNode
STARTUP_MSG: user = root
STARTUP_MSG: host = master/192.168.1.60
STARTUP_MSG: args = [-format]
STARTUP_MSG: version = 2.8.3
STARTUP_MSG: classpath = /weiqi/hadoop-2.8.3/etc/hadoop:/weiqi/hadoop-2.8.3/share/hadoop/common/lib/activation-1.1.jar:/weiqi/hadoop-2.8.3/share/hadoop/common/lib/apacheds-i18n-2.0.0-M15.jar:/weiqi/hadoop-2.8.3/share/hadoop/common/lib/apacheds-kerberos-codec-2.0.0-M15.jar:/weiqi/hadoop-2.8.3/share/hadoop/common/lib/api-asn1-api-1.0.0-M20.jar:/weiqi/hadoop-2.8.3/share/hadoop/common/lib/api-util-1.0.0-M20.jar:/weiqi/hadoop-2.8.3/share/hadoop/common/lib/asm-3.2.jar:/weiqi/hadoop-2.8.3/share/hadoop/common/lib/avro-1.7.4.jar:/weiqi/hadoop-2.8.3/share/hadoop/common/lib/commons-beanutils-1.7.0.jar:/weiqi/hadoop-2.8.3/share/hadoop/common/lib/commons-beanutils-core-1.8.0.jar:/weiqi/hadoop-2.8.3/share/hadoop/common/lib/commons-cli-1.2.jar:/weiqi/hadoop-2.8.3/share/hadoop/common/lib/commons-codec-1.4.jar:/weiqi/hadoop-2.8.3/share/hadoop/common/lib/commons-collections-3.2.2.jar:/weiqi/hadoop-2.8.3/share/hadoop/common/lib/commons-compress-1.4.1.jar:/weiqi/hadoop-2.8.3/share/hadoop/common/lib/commons-configuration-1.6.jar:/weiqi/hadoop-2.8.3/share/hadoop/common/lib/commons-digester-1.8.jar:/weiqi/hadoop-2.8.3/share/hadoop/common/lib/commons-io-2.4.jar:/weiqi/hadoop-2.8.3/share/hadoop/common/lib/commons-lang-2.6.jar:/weiqi/hadoop-2.8.3/share/hadoop/common/lib/commons-logging-1.1.3.jar:/weiqi/hadoop-2.8.3/share/hadoop/common/lib/commons-math3-3.1.1.jar:/weiqi/hadoop-2.8.3/share/hadoop/common/lib/commons-net-3.1.jar:/weiqi/hadoop-2.8.3/share/hadoop/common/lib/curator-client-2.7.1.jar:/weiqi/hadoop-2.8.3/share/hadoop/common/lib/curator-framework-2.7.1.jar:/weiqi/hadoop-2.8.3/share/hadoop/common/lib/curator-recipes-2.7.1.jar:/weiqi/hadoop-2.8.3/share/hadoop/common/lib/gson-2.2.4.jar:/weiqi/hadoop-2.8.3/share/hadoop/common/lib/guava-11.0.2.jar:/weiqi/hadoop-2.8.3/share/hadoop/common/lib/hadoop-annotations-2.8.3.jar:/weiqi/hadoop-2.8.3/share/hadoop/common/lib/hadoop-auth-2.8.3.jar:/weiqi/hadoop-2.8.3/share/hadoop/common/lib/hamcrest-core-1.3.jar:/weiqi/hadoop-2.8.3/share/hadoop/common/lib/htrace-core4-4.0.1-incubating.jar:/weiqi/hadoop-2.8.3/share/hadoop/common/lib/httpclient-4.5.2.jar:/weiqi/hadoop-2.8.3/share/hadoop/common/lib/httpcore-4.4.4.jar:/weiqi/hadoop-2.8.3/share/hadoop/common/lib/jackson-core-asl-1.9.13.jar:/weiqi/hadoop-2.8.3/share/hadoop/common/lib/jackson-jaxrs-1.9.13.jar:/weiqi/hadoop-2.8.3/share/hadoop/common/lib/jackson-mapper-asl-1.9.13.jar:/weiqi/hadoop-2.8.3/share/hadoop/common/lib/jackson-xc-1.9.13.jar:/weiqi/hadoop-2.8.3/share/hadoop/common/lib/java-xmlbuilder-0.4.jar:/weiqi/hadoop-2.8.3/share/hadoop/common/lib/jaxb-api-2.2.2.jar:/weiqi/hadoop-2.8.3/share/hadoop/common/lib/jaxb-impl-2.2.3-1.jar:/weiqi/hadoop-2.8.3/share/hadoop/common/lib/jcip-annotations-1.0.jar:/weiqi/hadoop-2.8.3/share/hadoop/common/lib/jersey-core-1.9.jar:/weiqi/hadoop-2.8.3/share/hadoop/common/lib/jersey-json-1.9.jar:/weiqi/hadoop-2.8.3/share/hadoop/common/lib/jersey-server-1.9.jar:/weiqi/hadoop-2.8.3/share/hadoop/common/lib/jets3t-0.9.0.jar:/weiqi/hadoop-2.8.3/share/hadoop/common/lib/jettison-1.1.jar:/weiqi/hadoop-2.8.3/share/hadoop/common/lib/jetty-6.1.26.jar:/weiqi/hadoop-2.8.3/share/hadoop/common/lib/jetty-sslengine-6.1.26.jar:/weiqi/hadoop-2.8.3/share/hadoop/common/lib/jetty-util-6.1.26.jar:/weiqi/hadoop-2.8.3/share/hadoop/common/lib/jsch-0.1.54.jar:/weiqi/hadoop-2.8.3/share/hadoop/common/lib/json-smart-1.1.1.jar:/weiqi/hadoop-2.8.3/share/hadoop/common/lib/jsp-api-2.1.jar:/weiqi/hadoop-2.8.3/share/hadoop/common/lib/jsr305-3.0.0.jar:/weiqi/hadoop-2.8.3/share/hadoop/common/lib/junit-4.11.jar:/weiqi/hadoop-2.8.3/share/hadoop/common/lib/log4j-1.2.17.jar:/weiqi/hadoop-2.8.3/share/hadoop/common/lib/mockito-all-1.8.5.jar:/weiqi/hadoop-2.8.3/share/hadoop/common/lib/netty-3.6.2.Final.jar:/weiqi/hadoop-2.8.3/share/hadoop/common/lib/nimbus-jose-jwt-3.9.jar:/weiqi/hadoop-2.8.3/share/hadoop/common/lib/paranamer-2.3.jar:/weiqi/hadoop-2.8.3/share/hadoop/common/lib/protobuf-java-2.5.0.jar:/weiqi/hadoop-2.8.3/share/hadoop/common/lib/servlet-api-2.5.jar:/weiqi/hadoop-2.8.3/share/hadoop/common/lib/slf4j-api-1.7.10.jar:/weiqi/hadoop-2.8.3/share/hadoop/common/lib/slf4j-log4j12-1.7.10.jar:/weiqi/hadoop-2.8.3/share/hadoop/common/lib/snappy-java-1.0.4.1.jar:/weiqi/hadoop-2.8.3/share/hadoop/common/lib/stax-api-1.0-2.jar:/weiqi/hadoop-2.8.3/share/hadoop/common/lib/xmlenc-0.52.jar:/weiqi/hadoop-2.8.3/share/hadoop/common/lib/xz-1.0.jar:/weiqi/hadoop-2.8.3/share/hadoop/common/lib/zookeeper-3.4.6.jar:/weiqi/hadoop-2.8.3/share/hadoop/common/hadoop-common-2.8.3-tests.jar:/weiqi/hadoop-2.8.3/share/hadoop/common/hadoop-common-2.8.3.jar:/weiqi/hadoop-2.8.3/share/hadoop/common/hadoop-nfs-2.8.3.jar:/weiqi/hadoop-2.8.3/share/hadoop/hdfs:/weiqi/hadoop-2.8.3/share/hadoop/hdfs/lib/asm-3.2.jar:/weiqi/hadoop-2.8.3/share/hadoop/hdfs/lib/commons-cli-1.2.jar:/weiqi/hadoop-2.8.3/share/hadoop/hdfs/lib/commons-codec-1.4.jar:/weiqi/hadoop-2.8.3/share/hadoop/hdfs/lib/commons-daemon-1.0.13.jar:/weiqi/hadoop-2.8.3/share/hadoop/hdfs/lib/commons-io-2.4.jar:/weiqi/hadoop-2.8.3/share/hadoop/hdfs/lib/commons-lang-2.6.jar:/weiqi/hadoop-2.8.3/share/hadoop/hdfs/lib/commons-logging-1.1.3.jar:/weiqi/hadoop-2.8.3/share/hadoop/hdfs/lib/guava-11.0.2.jar:/weiqi/hadoop-2.8.3/share/hadoop/hdfs/lib/hadoop-hdfs-client-2.8.3.jar:/weiqi/hadoop-2.8.3/share/hadoop/hdfs/lib/htrace-core4-4.0.1-incubating.jar:/weiqi/hadoop-2.8.3/share/hadoop/hdfs/lib/jackson-core-asl-1.9.13.jar:/weiqi/hadoop-2.8.3/share/hadoop/hdfs/lib/jackson-mapper-asl-1.9.13.jar:/weiqi/hadoop-2.8.3/share/hadoop/hdfs/lib/jersey-core-1.9.jar:/weiqi/hadoop-2.8.3/share/hadoop/hdfs/lib/jersey-server-1.9.jar:/weiqi/hadoop-2.8.3/share/hadoop/hdfs/lib/jetty-6.1.26.jar:/weiqi/hadoop-2.8.3/share/hadoop/hdfs/lib/jetty-util-6.1.26.jar:/weiqi/hadoop-2.8.3/share/hadoop/hdfs/lib/jsr305-3.0.0.jar:/weiqi/hadoop-2.8.3/share/hadoop/hdfs/lib/leveldbjni-all-1.8.jar:/weiqi/hadoop-2.8.3/share/hadoop/hdfs/lib/log4j-1.2.17.jar:/weiqi/hadoop-2.8.3/share/hadoop/hdfs/lib/netty-3.6.2.Final.jar:/weiqi/hadoop-2.8.3/share/hadoop/hdfs/lib/netty-all-4.0.23.Final.jar:/weiqi/hadoop-2.8.3/share/hadoop/hdfs/lib/okhttp-2.4.0.jar:/weiqi/hadoop-2.8.3/share/hadoop/hdfs/lib/okio-1.4.0.jar:/weiqi/hadoop-2.8.3/share/hadoop/hdfs/lib/protobuf-java-2.5.0.jar:/weiqi/hadoop-2.8.3/share/hadoop/hdfs/lib/servlet-api-2.5.jar:/weiqi/hadoop-2.8.3/share/hadoop/hdfs/lib/xercesImpl-2.9.1.jar:/weiqi/hadoop-2.8.3/share/hadoop/hdfs/lib/xml-apis-1.3.04.jar:/weiqi/hadoop-2.8.3/share/hadoop/hdfs/lib/xmlenc-0.52.jar:/weiqi/hadoop-2.8.3/share/hadoop/hdfs/hadoop-hdfs-2.8.3-tests.jar:/weiqi/hadoop-2.8.3/share/hadoop/hdfs/hadoop-hdfs-2.8.3.jar:/weiqi/hadoop-2.8.3/share/hadoop/hdfs/hadoop-hdfs-client-2.8.3-tests.jar:/weiqi/hadoop-2.8.3/share/hadoop/hdfs/hadoop-hdfs-client-2.8.3.jar:/weiqi/hadoop-2.8.3/share/hadoop/hdfs/hadoop-hdfs-native-client-2.8.3-tests.jar:/weiqi/hadoop-2.8.3/share/hadoop/hdfs/hadoop-hdfs-native-client-2.8.3.jar:/weiqi/hadoop-2.8.3/share/hadoop/hdfs/hadoop-hdfs-nfs-2.8.3.jar:/weiqi/hadoop-2.8.3/share/hadoop/yarn/lib/activation-1.1.jar:/weiqi/hadoop-2.8.3/share/hadoop/yarn/lib/aopalliance-1.0.jar:/weiqi/hadoop-2.8.3/share/hadoop/yarn/lib/asm-3.2.jar:/weiqi/hadoop-2.8.3/share/hadoop/yarn/lib/commons-cli-1.2.jar:/weiqi/hadoop-2.8.3/share/hadoop/yarn/lib/commons-codec-1.4.jar:/weiqi/hadoop-2.8.3/share/hadoop/yarn/lib/commons-collections-3.2.2.jar:/weiqi/hadoop-2.8.3/share/hadoop/yarn/lib/commons-compress-1.4.1.jar:/weiqi/hadoop-2.8.3/share/hadoop/yarn/lib/commons-io-2.4.jar:/weiqi/hadoop-2.8.3/share/hadoop/yarn/lib/commons-lang-2.6.jar:/weiqi/hadoop-2.8.3/share/hadoop/yarn/lib/commons-logging-1.1.3.jar:/weiqi/hadoop-2.8.3/share/hadoop/yarn/lib/commons-math-2.2.jar:/weiqi/hadoop-2.8.3/share/hadoop/yarn/lib/curator-client-2.7.1.jar:/weiqi/hadoop-2.8.3/share/hadoop/yarn/lib/curator-test-2.7.1.jar:/weiqi/hadoop-2.8.3/share/hadoop/yarn/lib/fst-2.50.jar:/weiqi/hadoop-2.8.3/share/hadoop/yarn/lib/guava-11.0.2.jar:/weiqi/hadoop-2.8.3/share/hadoop/yarn/lib/guice-3.0.jar:/weiqi/hadoop-2.8.3/share/hadoop/yarn/lib/guice-servlet-3.0.jar:/weiqi/hadoop-2.8.3/share/hadoop/yarn/lib/jackson-core-asl-1.9.13.jar:/weiqi/hadoop-2.8.3/share/hadoop/yarn/lib/jackson-jaxrs-1.9.13.jar:/weiqi/hadoop-2.8.3/share/hadoop/yarn/lib/jackson-mapper-asl-1.9.13.jar:/weiqi/hadoop-2.8.3/share/hadoop/yarn/lib/jackson-xc-1.9.13.jar:/weiqi/hadoop-2.8.3/share/hadoop/yarn/lib/java-util-1.9.0.jar:/weiqi/hadoop-2.8.3/share/hadoop/yarn/lib/javassist-3.18.1-GA.jar:/weiqi/hadoop-2.8.3/share/hadoop/yarn/lib/javax.inject-1.jar:/weiqi/hadoop-2.8.3/share/hadoop/yarn/lib/jaxb-api-2.2.2.jar:/weiqi/hadoop-2.8.3/share/hadoop/yarn/lib/jaxb-impl-2.2.3-1.jar:/weiqi/hadoop-2.8.3/share/hadoop/yarn/lib/jersey-client-1.9.jar:/weiqi/hadoop-2.8.3/share/hadoop/yarn/lib/jersey-core-1.9.jar:/weiqi/hadoop-2.8.3/share/hadoop/yarn/lib/jersey-guice-1.9.jar:/weiqi/hadoop-2.8.3/share/hadoop/yarn/lib/jersey-json-1.9.jar:/weiqi/hadoop-2.8.3/share/hadoop/yarn/lib/jersey-server-1.9.jar:/weiqi/hadoop-2.8.3/share/hadoop/yarn/lib/jettison-1.1.jar:/weiqi/hadoop-2.8.3/share/hadoop/yarn/lib/jetty-6.1.26.jar:/weiqi/hadoop-2.8.3/share/hadoop/yarn/lib/jetty-util-6.1.26.jar:/weiqi/hadoop-2.8.3/share/hadoop/yarn/lib/json-io-2.5.1.jar:/weiqi/hadoop-2.8.3/share/hadoop/yarn/lib/jsr305-3.0.0.jar:/weiqi/hadoop-2.8.3/share/hadoop/yarn/lib/leveldbjni-all-1.8.jar:/weiqi/hadoop-2.8.3/share/hadoop/yarn/lib/log4j-1.2.17.jar:/weiqi/hadoop-2.8.3/share/hadoop/yarn/lib/netty-3.6.2.Final.jar:/weiqi/hadoop-2.8.3/share/hadoop/yarn/lib/protobuf-java-2.5.0.jar:/weiqi/hadoop-2.8.3/share/hadoop/yarn/lib/servlet-api-2.5.jar:/weiqi/hadoop-2.8.3/share/hadoop/yarn/lib/stax-api-1.0-2.jar:/weiqi/hadoop-2.8.3/share/hadoop/yarn/lib/xz-1.0.jar:/weiqi/hadoop-2.8.3/share/hadoop/yarn/lib/zookeeper-3.4.6-tests.jar:/weiqi/hadoop-2.8.3/share/hadoop/yarn/lib/zookeeper-3.4.6.jar:/weiqi/hadoop-2.8.3/share/hadoop/yarn/hadoop-yarn-api-2.8.3.jar:/weiqi/hadoop-2.8.3/share/hadoop/yarn/hadoop-yarn-applications-distributedshell-2.8.3.jar:/weiqi/hadoop-2.8.3/share/hadoop/yarn/hadoop-yarn-applications-unmanaged-am-launcher-2.8.3.jar:/weiqi/hadoop-2.8.3/share/hadoop/yarn/hadoop-yarn-client-2.8.3.jar:/weiqi/hadoop-2.8.3/share/hadoop/yarn/hadoop-yarn-common-2.8.3.jar:/weiqi/hadoop-2.8.3/share/hadoop/yarn/hadoop-yarn-registry-2.8.3.jar:/weiqi/hadoop-2.8.3/share/hadoop/yarn/hadoop-yarn-server-applicationhistoryservice-2.8.3.jar:/weiqi/hadoop-2.8.3/share/hadoop/yarn/hadoop-yarn-server-common-2.8.3.jar:/weiqi/hadoop-2.8.3/share/hadoop/yarn/hadoop-yarn-server-nodemanager-2.8.3.jar:/weiqi/hadoop-2.8.3/share/hadoop/yarn/hadoop-yarn-server-resourcemanager-2.8.3.jar:/weiqi/hadoop-2.8.3/share/hadoop/yarn/hadoop-yarn-server-sharedcachemanager-2.8.3.jar:/weiqi/hadoop-2.8.3/share/hadoop/yarn/hadoop-yarn-server-tests-2.8.3.jar:/weiqi/hadoop-2.8.3/share/hadoop/yarn/hadoop-yarn-server-timeline-pluginstorage-2.8.3.jar:/weiqi/hadoop-2.8.3/share/hadoop/yarn/hadoop-yarn-server-web-proxy-2.8.3.jar:/weiqi/hadoop-2.8.3/share/hadoop/mapreduce/lib/aopalliance-1.0.jar:/weiqi/hadoop-2.8.3/share/hadoop/mapreduce/lib/asm-3.2.jar:/weiqi/hadoop-2.8.3/share/hadoop/mapreduce/lib/avro-1.7.4.jar:/weiqi/hadoop-2.8.3/share/hadoop/mapreduce/lib/commons-compress-1.4.1.jar:/weiqi/hadoop-2.8.3/share/hadoop/mapreduce/lib/commons-io-2.4.jar:/weiqi/hadoop-2.8.3/share/hadoop/mapreduce/lib/guice-3.0.jar:/weiqi/hadoop-2.8.3/share/hadoop/mapreduce/lib/guice-servlet-3.0.jar:/weiqi/hadoop-2.8.3/share/hadoop/mapreduce/lib/hadoop-annotations-2.8.3.jar:/weiqi/hadoop-2.8.3/share/hadoop/mapreduce/lib/hamcrest-core-1.3.jar:/weiqi/hadoop-2.8.3/share/hadoop/mapreduce/lib/jackson-core-asl-1.9.13.jar:/weiqi/hadoop-2.8.3/share/hadoop/mapreduce/lib/jackson-mapper-asl-1.9.13.jar:/weiqi/hadoop-2.8.3/share/hadoop/mapreduce/lib/javax.inject-1.jar:/weiqi/hadoop-2.8.3/share/hadoop/mapreduce/lib/jersey-core-1.9.jar:/weiqi/hadoop-2.8.3/share/hadoop/mapreduce/lib/jersey-guice-1.9.jar:/weiqi/hadoop-2.8.3/share/hadoop/mapreduce/lib/jersey-server-1.9.jar:/weiqi/hadoop-2.8.3/share/hadoop/mapreduce/lib/junit-4.11.jar:/weiqi/hadoop-2.8.3/share/hadoop/mapreduce/lib/leveldbjni-all-1.8.jar:/weiqi/hadoop-2.8.3/share/hadoop/mapreduce/lib/log4j-1.2.17.jar:/weiqi/hadoop-2.8.3/share/hadoop/mapreduce/lib/netty-3.6.2.Final.jar:/weiqi/hadoop-2.8.3/share/hadoop/mapreduce/lib/paranamer-2.3.jar:/weiqi/hadoop-2.8.3/share/hadoop/mapreduce/lib/protobuf-java-2.5.0.jar:/weiqi/hadoop-2.8.3/share/hadoop/mapreduce/lib/snappy-java-1.0.4.1.jar:/weiqi/hadoop-2.8.3/share/hadoop/mapreduce/lib/xz-1.0.jar:/weiqi/hadoop-2.8.3/share/hadoop/mapreduce/hadoop-mapreduce-client-app-2.8.3.jar:/weiqi/hadoop-2.8.3/share/hadoop/mapreduce/hadoop-mapreduce-client-common-2.8.3.jar:/weiqi/hadoop-2.8.3/share/hadoop/mapreduce/hadoop-mapreduce-client-core-2.8.3.jar:/weiqi/hadoop-2.8.3/share/hadoop/mapreduce/hadoop-mapreduce-client-hs-2.8.3.jar:/weiqi/hadoop-2.8.3/share/hadoop/mapreduce/hadoop-mapreduce-client-hs-plugins-2.8.3.jar:/weiqi/hadoop-2.8.3/share/hadoop/mapreduce/hadoop-mapreduce-client-jobclient-2.8.3-tests.jar:/weiqi/hadoop-2.8.3/share/hadoop/mapreduce/hadoop-mapreduce-client-jobclient-2.8.3.jar:/weiqi/hadoop-2.8.3/share/hadoop/mapreduce/hadoop-mapreduce-client-shuffle-2.8.3.jar:/weiqi/hadoop-2.8.3/share/hadoop/mapreduce/hadoop-mapreduce-examples-2.8.3.jar:/weiqi/hadoop-2.8.3/contrib/capacity-scheduler/*.jar
STARTUP_MSG: build = https://git-wip-us.apache.org/repos/asf/hadoop.git -r b3fe56402d908019d99af1f1f4fc65cb1d1436a2; compiled by 'jdu' on 2017-12-05T03:43Z
STARTUP_MSG: java = 1.8.0_171
************************************************************/
18/07/14 15:09:05 INFO namenode.NameNode: registered UNIX signal handlers for [TERM, HUP, INT]
18/07/14 15:09:05 INFO namenode.NameNode: createNameNode [-format]
Formatting using clusterid: CID-9cec2c3a-6c09-443d-8cb0-f994d49b9d73
18/07/14 15:09:06 INFO namenode.FSEditLog: Edit logging is async:true
18/07/14 15:09:06 INFO namenode.FSNamesystem: KeyProvider: null
18/07/14 15:09:06 INFO namenode.FSNamesystem: fsLock is fair: true
18/07/14 15:09:06 INFO namenode.FSNamesystem: Detailed lock hold time metrics enabled: false
18/07/14 15:09:06 INFO blockmanagement.DatanodeManager: dfs.block.invalidate.limit=1000
18/07/14 15:09:06 INFO blockmanagement.DatanodeManager: dfs.namenode.datanode.registration.ip-hostname-check=true
18/07/14 15:09:06 INFO blockmanagement.BlockManager: dfs.namenode.startup.delay.block.deletion.sec is set to 000:00:00:00.000
18/07/14 15:09:06 INFO blockmanagement.BlockManager: The block deletion will start around 2018 七月 14 15:09:06
18/07/14 15:09:06 INFO util.GSet: Computing capacity for map BlocksMap
18/07/14 15:09:06 INFO util.GSet: VM type = 64-bit
18/07/14 15:09:06 INFO util.GSet: 2.0% max memory 966.7 MB = 19.3 MB
18/07/14 15:09:06 INFO util.GSet: capacity = 2^21 = 2097152 entries
18/07/14 15:09:06 INFO blockmanagement.BlockManager: dfs.block.access.token.enable=false
18/07/14 15:09:06 INFO blockmanagement.BlockManager: defaultReplication = 2
18/07/14 15:09:06 INFO blockmanagement.BlockManager: maxReplication = 512
18/07/14 15:09:06 INFO blockmanagement.BlockManager: minReplication = 1
18/07/14 15:09:06 INFO blockmanagement.BlockManager: maxReplicationStreams = 2
18/07/14 15:09:06 INFO blockmanagement.BlockManager: replicationRecheckInterval = 3000
18/07/14 15:09:06 INFO blockmanagement.BlockManager: encryptDataTransfer = false
18/07/14 15:09:06 INFO blockmanagement.BlockManager: maxNumBlocksToLog = 1000
18/07/14 15:09:06 INFO namenode.FSNamesystem: fsOwner = root (auth:SIMPLE)
18/07/14 15:09:06 INFO namenode.FSNamesystem: supergroup = supergroup
18/07/14 15:09:06 INFO namenode.FSNamesystem: isPermissionEnabled = true
18/07/14 15:09:06 INFO namenode.FSNamesystem: HA Enabled: false
18/07/14 15:09:06 INFO namenode.FSNamesystem: Append Enabled: true
18/07/14 15:09:06 INFO util.GSet: Computing capacity for map INodeMap
18/07/14 15:09:06 INFO util.GSet: VM type = 64-bit
18/07/14 15:09:06 INFO util.GSet: 1.0% max memory 966.7 MB = 9.7 MB
18/07/14 15:09:06 INFO util.GSet: capacity = 2^20 = 1048576 entries
18/07/14 15:09:06 INFO namenode.FSDirectory: ACLs enabled? false
18/07/14 15:09:06 INFO namenode.FSDirectory: XAttrs enabled? true
18/07/14 15:09:06 INFO namenode.NameNode: Caching file names occurring more than 10 times
18/07/14 15:09:06 INFO util.GSet: Computing capacity for map cachedBlocks
18/07/14 15:09:06 INFO util.GSet: VM type = 64-bit
18/07/14 15:09:06 INFO util.GSet: 0.25% max memory 966.7 MB = 2.4 MB
18/07/14 15:09:06 INFO util.GSet: capacity = 2^18 = 262144 entries
18/07/14 15:09:06 INFO namenode.FSNamesystem: dfs.namenode.safemode.threshold-pct = 0.9990000128746033
18/07/14 15:09:06 INFO namenode.FSNamesystem: dfs.namenode.safemode.min.datanodes = 0
18/07/14 15:09:06 INFO namenode.FSNamesystem: dfs.namenode.safemode.extension = 30000
18/07/14 15:09:06 INFO metrics.TopMetrics: NNTop conf: dfs.namenode.top.window.num.buckets = 10
18/07/14 15:09:06 INFO metrics.TopMetrics: NNTop conf: dfs.namenode.top.num.users = 10
18/07/14 15:09:06 INFO metrics.TopMetrics: NNTop conf: dfs.namenode.top.windows.minutes = 1,5,25
18/07/14 15:09:06 INFO namenode.FSNamesystem: Retry cache on namenode is enabled
18/07/14 15:09:06 INFO namenode.FSNamesystem: Retry cache will use 0.03 of total heap and retry cache entry expiry time is 600000 millis
18/07/14 15:09:06 INFO util.GSet: Computing capacity for map NameNodeRetryCache
18/07/14 15:09:06 INFO util.GSet: VM type = 64-bit
18/07/14 15:09:06 INFO util.GSet: 0.029999999329447746% max memory 966.7 MB = 297.0 KB
18/07/14 15:09:06 INFO util.GSet: capacity = 2^15 = 32768 entries
18/07/14 15:09:06 INFO namenode.FSImage: Allocated new BlockPoolId: BP-1678938125-192.168.1.60-1531552146623
18/07/14 15:09:06 INFO common.Storage: Storage directory /weiqi/hadoop-2.8.3/hdfs/name has been successfully formatted.
18/07/14 15:09:06 INFO namenode.FSImageFormatProtobuf: Saving image file /weiqi/hadoop-2.8.3/hdfs/name/current/fsimage.ckpt_0000000000000000000 using no compression
18/07/14 15:09:06 INFO namenode.FSImageFormatProtobuf: Image file /weiqi/hadoop-2.8.3/hdfs/name/current/fsimage.ckpt_0000000000000000000 of size 321 bytes saved in 0 seconds.
18/07/14 15:09:06 INFO namenode.NNStorageRetentionManager: Going to retain 1 images with txid >= 0
18/07/14 15:09:06 INFO util.ExitUtil: Exiting with status 0
18/07/14 15:09:06 INFO namenode.NameNode: SHUTDOWN_MSG:
/************************************************************
SHUTDOWN_MSG: Shutting down NameNode at master/192.168.1.60
************************************************************/
[root@master ~]#

同时,也能在master的/weiqi/hadoop-2.8.3/hdfs/name生成了current文件夹

3.5 启动Hadoop

进入master

1
2
3
4
5
6
7
#若配置了环境变量
$ start-all.sh
-------------------------------------
若没有配置环境变量
进入:/weiqi/hadoop-2.8.3/
$ sbin/start-all.sh

3.6 启动成功标志

在master上使用jps命令:

$ jps

1
2
3
4
5
[root@master ~]# jps
10499 Jps
1511 SecondaryNameNode
1321 NameNode
1659 ResourceManager

在weiqi1和weiqi2上使用jps命令

$ jps

1
2
3
4
[root@weiqi1 ~]# jps
1234 DataNode
1336 NodeManager
6524 Jps

同时也能在浏览器上通过http://192.168.1.60:50070web端查看Hadoop信息

或者通过http://192.168.1.60:8088web端查看Hadoop信息

3.7 关闭Hadoop

关闭 master 节点上的 hadoop

1
[root@master sbin]# stop-all.sh

4. ZooKeeper集群安装配置

4.1 安装配置 Zookeeper

上传zookeeper-3.4.12.tar.gz安装包到weiqi文件夹下

解压安装包:

1
$ tar -zxvf zookeeper-3.4.12.tar.gz

进入到zookeeper-3.4.12下:

分别创建如下相关文件:

1
2
$ mkdir data		//zookeeper数据存放文件夹
$ mkdir logs //zookeeper日志存放文件夹

进入到conf目录下,复制zoo_sample.cfgzoo.cfg

1
$ cp zoo_sample.cfg zoo.cfg

zoo.cfg文件下修改添加如下配置:

1
2
3
4
5
6
dataDir=/weiqi/zookeeper-3.4.12/data
dataLogDir=/weiqi/zookeeper-3.4.12/logs

server.0=master:2888:3888
server.1=weiqi1:2888:3888
server.2=weiqi2:2888:3888

配置zookeeper 日志输出

编辑 zookeeper bin目录下的 zkEnv.sh

nano zkEnv.sh

修改如下配置

1
2
3
4
if [ "x${ZOO_LOG_DIR}" = "x" ]
then
ZOO_LOG_DIR="."
fi

修改为

1
2
3
4
if [ "x${ZOO_LOG_DIR}" = "x" ]
then
ZOO_LOG_DIR="/weiqi/zookeeper-3.4.12/logs"
fi

4.2 部署其他节点

分别复制zookeeper-3.4.12到其他节点下:

1
2
$ scp -r /weiqi/zookeeper-3.4.12 weiqi1:/weiqi/zookeeper-3.4.12
$ scp -r /weiqi/zookeeper-3.4.12 weiqi2:/weiqi/zookeeper-3.4.12

分别配置每台主机的zookeeper环境变量:

1
$ nano /etc/profile

添加:

1
2
3
#配置zookeeper环境变量
export ZOOKEEPER_HOME=/weiqi/zookeeper-3.4.12
export PATH=$PATH:$ZOOKEEPER_HOME/bin:$ZOOKEEPER_HOME/conf

然后重新加载配置文件使之生效:

1
$ source /etc/profile 

分别在每台主机的/weiqi/zookeeper-3.4.12/data目录下创建myid 文件,同时和zoo.cfg文件中的server对应,mastermyid 中填0weiqi1myid 1weiqi2myid 2,

如下:

master下:

1
2
3
4
[root@master ~]# nano /weiqi/zookeeper-3.4.12/data/myid
GNU nano 2.3.1 文件: /weiqi/zookeeper-3.4.12/data/myid
0

weiqi1下:

1
2
3
4
[root@weiqi1  ~]# nano /weiqi/zookeeper-3.4.12/data/myid
GNU nano 2.3.1 文件: /weiqi/zookeeper-3.4.12/data/myid
1

weiqi2下:

1
2
3
4
[root@weiqi2 ~]# nano /weiqi/zookeeper-3.4.12/data/myid
GNU nano 2.3.1 文件: /weiqi/zookeeper-3.4.12/data/myid
2

4.3 启动ZooKeeper集群

在ZooKeeper集群的每个节点上,执行启动ZooKeeper服务的脚本:

1
2
3
4
5
6
#若配置了环境变量
$ zkServer.sh start
-------------------------------------
若没有配置环境变量
进入:/weiqi/zookeeper-3.4.12
$ /bin/zkServer.sh start

查看服务是否启动成功:

1
2
3
4
5
6
#若配置了环境变量
$ zkServer.sh status
-------------------------------------
若没有配置环境变量
进入:/weiqi/zookeeper-3.4.12
$ /bin/zkServer.sh status

成功状态如下:

貌似leader节点是随机分配的:

1
2
3
4
[root@master ~]# zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /weiqi/zookeeper-3.4.12/bin/../conf/zoo.cfg
Mode: leader

follower

1
2
3
4
[root@weiqi1 ~]# zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /weiqi/zookeeper-3.4.12/bin/../conf/zoo.cfg
Mode: follower

4.4 启动成功标志

在master上使用jps命令:

$ jps

1
2
[root@master ~]# jps
2063 QuorumPeerMain

在weiqi1和weiqi2上使用jps命令

$ jps

1
2
[root@weiqi1 ~]# jps
1593 QuorumPeerMain

4.5 关闭Zookeeper

关闭 master 节点上的 zookeeper 和 weiqi1,weiqi2节点的 zookeeper 的命令式一样的。
命令如下:

1
[root@master bin]# zkServer.sh stop

5. HBase集群安装配置

5.1 安装配置HBase

5.1.1 安装 HBase

上传hbase-2.0.0-bin.tar.gz安装包到weiqi文件夹下

解压安装包:

1
$ tar -zxvf hbase-2.0.0-bin.tar.gz

进入到hbase-2.0.0-bin下:

进入到conf目录下,分别修改如下配置文件

5.1.2 配置hbase-env.sh

$ nano hbase-env.sh

1
2
3
4
5
6
7
8
#指定Java路径
export JAVA_HOME=/home/java/jdk1.8.0_171
#配置hbase日志输出地址
export HBASE_LOG_DIR=${HBASE_HOME}/logs
#指定Hadoop配置
export HBASE_CLASSPATH=/weiqi/hadoop-2.8.3/etc/hadoop
#禁用默认的zookeeper,使用单独的zookeeper
export HBASE_MANAGES_ZK=false

5.1.3 配置hbase-site.xml

$ nano hbase-site.xml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<configuration>
<!-- HBase集群中所有RegionServer共享目录,用来持久化HBase的数据,
一般设置的是hdfs的文件目录-->
<property>
<name>hbase.rootdir</name>
<value>hdfs://master:9000/hbase</value>
</property>
<!-- 集群的模式,分布式还是单机模式,如果设置成false的话,
HBase进程和Zookeeper进程在同一个JVM进程 -->
<property>
<name>hbase.cluster.distributed</name>
<value>true</value>
</property>
<!--默认HMaster HTTP访问端口-->
<property>
<name>hbase.master.info.port</name>
<value>16010</value>
</property>
<!--默认HRegionServer HTTP访问端口-->
<property>
<name>hbase.regionserver.info.port</name>
<value>16030</value>
</property>
<!--指定zookeeper访问端口-->
<property>
<name>hbase.zookeeper.property.clientPort</name>
<value>2181</value>
</property>
<!-- zookeeper集群的URL配置,多个host中间用逗号(,)分割 -->
<property>
<name>hbase.zookeeper.quorum</name>
<value>master,weiqi1,weiqi2</value>
</property>
<!-- 客户端与zk连接超时时间 -->
<property>
<name>zookeeper.session.timeout</name>
<value>60000000</value>
</property>
<!-- -->
<property>
<name>dfs.support.append</name>
<value>true</value>
</property>
</configuration>

5.1.4 更改 regionservers

分别把每个节点下的hostname填写到该文件中

$ nano regionservers

1
2
weiqi1
weiqi2

5.2 部署他其他节点

1
2
$ scp -r /weiqi/hbase-2.0.0-bin weiqi1:/weiqi/hbase-2.0.0-bin
$ scp -r /weiqi/hbase-2.0.0-bin weiqi2:/weiqi/hbase-2.0.0-bin

5.3 分别配置Hbase环境变量

$ nano /etc/profile

添加:

1
2
3
#配置hbase环境变量
export HBASE_HOME=/weiqi/hbase-2.0.0
export PATH=$PATH:$HBASE_HOME/bin

然后重新加载配置文件使之生效:

1
$ source /etc/profile 

5.4 启动Hbase集群

进入master

1
2
3
4
5
6
7
#若配置了环境变量
$ start-hbase.sh
-------------------------------------
若没有配置环境变量
进入:/weiqi/hbase-2.0.0/
$ bin/start-hbase.sh

5.5 启动成功标志

在master上使用jps命令:

$ jps

1
2
3
4
5
6
7
[root@master ~]# jps
2880 HMaster #hbase master进程
1511 SecondaryNameNode #hadoop进程
1321 NameNode #hadoop master进程
1659 ResourceManager #hadoop进程
16029 Jps
2063 QuorumPeerMain #zookeeper进程

在weiqi1和weiqi2上使用jps命令

$ jps

1
2
3
4
5
6
[root@weiqi1 ~]# jps
9953 Jps
1234 DataNode #hadoop slave进程
1336 NodeManager #hadoop slave进程
1593 QuorumPeerMain #zookeeper进程
1900 HRegionServer #hbase slave进程

同时也能在浏览器上通过http://192.168.1.60:16010web端查看Hbase信息

5.6 关闭Hbase集群

关闭 master 节点上的 hbase

1
[root@master ~]# stop-hbase.sh

5.7 进入hbase shell进行验证

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
[root@master ~]# hbase shell
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/weiqi/hbase-2.0.0/lib/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/weiqi/hadoop-2.8.3/share/hadoop/common/lib/slf4j-log4j12-1.7.10.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]
HBase Shell
Use "help" to get list of supported commands.
Use "exit" to quit this interactive shell.
Version 2.0.0, r7483b111e4da77adbfc8062b3b22cbe7c2cb91c1, Sun Apr 22 20:26:55 PDT 2018
Took 0.0018 seconds
hbase(main):001:0> list
TABLE
0 row(s)
Took 0.8049 seconds
=> []
hbase(main):002:0> status
1 active master, 0 backup masters, 2 servers, 0 dead, 2.0000 average load
Took 0.3276 seconds
hbase(main):003:0>