1.导入包并配置环境变量(master)
建立在hadoop完全分布式和zookeeper上
需先导入HBase包
解压上传的包到指定文件:tar -zxvf hbase-1.2.1-bin.tar.gz -C /opt/software/
然后进入文件夹下改名:mv hbase-1.2.1 hbase
配置环境变量:vi /etc/profile
插入:
export HBASE_HOME=/opt/software/hbase
export PATH=$PATH:$HBASE_HOME/bin
然后source一下:source /etc/profile
2.配置HBase(master)
创建目录:mkdir /opt/software/hbase/tmp
进入目录:cd /opt/software/hbase/conf/
编辑:vi hbase-env.sh
插入:使用hbase自带的zook就设置为true
export JAVA_HOME=/opt/software/jdk
export HBASE_MANAGES_ZK=false
export HBASE_CLASSPATH=/opt/software/hbase
编辑:vi hbase-site.xml
插入:
<property>
<name>hbase.rootdir</name>
<value>hdfs://master:9000/hbase</value> # 使用 9000 端口
<description>The directory shared by region servers.</description>
</property>
<property>
<name>hbase.master.info.port</name>
<value>60010</value> # 使用 master 节点 60010 端口
</property>
<property>
<name>hbase.zookeeper.property.clientPort</name>
<value>2181</value> # 使用 master 节点 2181 端口
<description>Property from ZooKeeper's config zoo.cfg. The port at
which the clients will connect.
</description>
</property>
<property>
<name>zookeeper.session.timeout</name>
<value>120000</value> # ZooKeeper 超时时间
</property>
<property>
<name>hbase.zookeeper.quorum</name>
<value>master,node1,node2</value> # ZooKeeper 管理节点
</property>
<property>
<name>hbase.tmp.dir</name>
<value>/opt/software/hbase/tmp</value> # HBase 临时文件路径
</property>
<property>
<name>hbase.cluster.distributed</name>
<value>true</value> # 使用分布式 HBase
</property>
编辑:vi regionservers
插入:
node1
node2
3.文件同步
scp -r /opt/software/hbase node1:/opt/software/
scp -r /opt/software/hbase node2:/opt/software/
scp -r /etc/profile node1:/etc/
scp -r /etc/profile node2:/etc/
每个节点source一下:source /etc/profile
4.启动
先启动hadoop(master):
start-all.sh start
再启动zookeeper(三台都需要):
zkServer.sh start
最后启动hbase(master)
start-hbase.sh
关闭逆序关闭即可
5.查看:
jps
master:
4144 SecondaryNameNode
14596 HMaster
4295 ResourceManager
14711 Jps
3960 NameNode
14443 QuorumPeerMain
node1:
10721 QuorumPeerMain
1746 DataNode
10472 NodeManager
10826 Jps
10795 HRegionServer
node2:
10643 QuorumPeerMain
1717 DataNode
10741 Jps
10711 HRegionServer
10395 NodeManager
在浏览器输入 192.168.200.10:60010