前戏
四台虚拟机要免密钥
先启动zookeeper
启动hadoop;hbase要四台虚拟机所有的文件都放到hdfs上
开整
配置文件:(conf/regionservers )(配置的是小弟)
node7-1
node7-3
node7-4
配置文件:(conf/backup-masters )(配置的是二哥,大哥挂掉,二哥顶上)(复制的regionservers 新建的)
node7-1
node7-3
配置文件:(conf/hbase-site.xml )(配置的是小弟)
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<configuration>
<property>
<name>hbase.rootdir</name>
<!--
file://表示的是本地目录
hdfs://表示的是hdfs的目录;
hdfs://namenode.example.org:8020/hbase(一定是active的namenode)
-->
<value>hdfs://node7-1:8020/data/hbase</value>
</property>
<property>
<name>hbase.unsafe.stream.capability.enforce</name>
<value>false</value>
<description>
检查兼容性,如果设置为false,数据有可能丢失(这是一个警告)
Controls whether HBase will check for stream capabilities (hflush/hsync).
Disable this if you intend to run on LocalFileSystem, denoted by a rootdir
with the 'file://' scheme, but be mindful of the NOTE below.
WARNING: Setting this to false blinds you to potential data loss and
inconsistent system state in the event of process and/or node failures. If
HBase is complaining of an inability to use hsync or hflush it's most
likely not a false positive.
</description>
</property>
<!--配置 zookeepr-->
<property>
<name>hbase.zookeeper.quorum</name>
<value>node7-1:2181,node7-2:2181,node7-3:2181</value>
</property>
<property>
<name>hbase.zookeeper.property.dataDir</name>
<!-- zookeeper的目录:data目录 -->
<value>/data/hbase/zookeeper_data</value>
</property>
<!-- 开启集群模式 -->
<property>
<name>hbase.cluster.distributed</name>
<value>true</value>
</property>
</configuration>
配置文件:(conf/hbase-env.sh )
配置jdk路径,将hbase自带的zookeeper关掉
在想当大哥的服务器启动hbase;(node7-2)
bin/start-hbase.sh
关掉
bin/stop-hbase.sh
访问
http://node7-2:16010/
注:1.因为Hbase连接hadoop是通过hdfs协议的,所有hadoop的配置文件是无法读取的;
我们要把hadoop所有的配置文件拷贝过来;就可以生效;
2.如果想清空hbase的所有数据重新来一遍
清空hdfs
清空zookeeper