本次配置延续上次的hadoop伪分布式安装部署


资源下载

http://mirrors.hust.edu.cn/apache/zookeeper/zookeeper-3.4.12/zookeeper-3.4.12.tar.gz

http://mirror.bit.edu.cn/apache/hbase/stable/hbase-1.2.6-bin.tar.gz 


1、为hadoop管理用户配置suduers权限并做主机名解析

[root@master1 hadoop]# vi /etc/sudoers

添加

hadoop  ALL=(ALL)       NOPASSWD:       ALL


[root@master1 hadoop]# su hadoop

主机名解析

[hadoop@master1 ~]$ sudo vi /etc/hosts

添加

192.168.120.131 master1


2、zookeeper环境配置

[hadoop@master1 src]$ pwd

/home/hadoop/src

[hadoop@master1 src]$ tar -xf zookeeper-3.4.12.tar -C /home/hadoop

[hadoop@master1 src]$ cd ..

[hadoop@master1 ~]$ mv zookeeper-3.4.12 zookeeper


修改环境变量

[hadoop@master1 ~]$ vi ~/.bashrc

添加

export ZOOKEEPER_HOME=/home/hadoop/zookeeper

修改

export PATH=$PATH:$HADOOP_HOME/sbin:$HADOOP_HOME/bin:$ZOOKEEPER_HOME/bin


使文件生效

[hadoop@master1 ~]$ source ~/.bashrc


修改zookeeper配置文件

[hadoop@master1 ~]$ cd zookeeper/conf

[hadoop@master1 conf]$ cp zoo_sample.cfg zoo.cfg

修改

dataDir=/home/hadoop/zookeeper/data

添加

dataLogDir=/home/hadoop/zookeeper/datalog


[hadoop@master1 conf]$ mkdir /home/hadoop/zookeeper/data

[hadoop@master1 conf]$ mkdir /home/hadoop/zookeeper/datalog


启动ZK服务

[hadoop@master1 conf]$ zkServer.sh start

ZooKeeper JMX enabled by default

Using config: /home/hadoop/zookeeper/bin/../conf/zoo.cfg

Starting zookeeper ... STARTED


3、Hbase环境配置

[hadoop@master1 src]$ pwd

/home/hadoop/src

[hadoop@master1 src]$ tar zxf hbase-1.2.6-bin.tar -C ../

[hadoop@master1 ~]$ mv hbase-1.2.6 hbase


修改环境变量

[hadoop@master1 ~]$ vi ~/.bashrc

添加

export HBASE_HOME=/home/hadoop/hbase

修改

export PATH=$PATH:$HADOOP_HOME/sbin:$HADOOP_HOME/bin:$ZOOKEEPER_HOME/bin:$HBASE_HOME/bin


使文件生效

[hadoop@master1 ~]$ source ~/.bashrc


拷贝hadoop配置文件到hbase

[hadoop@master1 ~]$ cp hadoop/etc/hadoop/core-site.xml hbase/conf/

[hadoop@master1 ~]$ cp hadoop/etc/hadoop/hdfs-site.xml hbase/conf/


编辑hbase配置文件

[hadoop@master1 ~]$ cd hbase/conf

[hadoop@master1 conf]$ vi hbase-env.sh

添加

export JAVA_HOME=/home/hadoop/dk

export HBASE_MANAGES_ZK=false


[hadoop@master1 conf]$ vi hbase-site.xml

<configuration>

<property>

<name>hbase.rootdir</name>

<value>hdfs://master1:9000/hbase</value>

</property>

<property>

<name>hbase.cluster.distributed</name>

<value>false</value>

</property>

<property>

<name>hbase.zookeeper.quorum</name>

<value>master1:2181</value>

</property>

<property>

<name>hbase.master.info.port</name>

<value>60010</value>

</property>

</configuration>


说明:

hbase.master.info.port参数配置的是hbase的web界面,不配置的话默认是不开启的。


启动Hbase服务

[hadoop@master1 conf]$ start-hbase.sh

starting master, logging to /home/hadoop/hbase/logs/hbase-hadoop-master-master1.out

Java HotSpot(TM) 64-Bit Server VM warning: ignoring option PermSize=128m; support was removed in 8.0

Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=128m; support was removed in 8.0


对于出现的警告信息做以下处理

[hadoop@master1 conf]$ vi hbase-env.sh

注释

#export HBASE_MASTER_OPTS="$HBASE_MASTER_OPTS -XX:PermSize=128m -XX:MaxPermSize=128m"

#export HBASE_REGIONSERVER_OPTS="$HBASE_REGIONSERVER_OPTS -XX:PermSize=128m -XX:MaxPermSize=128m"


查看服务

[hadoop@master1 conf]$ jps

1632 SecondaryNameNode

1793 ResourceManager

1362 NameNode

1491 DataNode

1913 NodeManager

5374 QuorumPeerMain

5966 HMaster

6255 Jps


可以通过http://192.168.120.131:60010打开hbase的web界面了。