HBase – Hadoop Database,是一个高可靠性、高性能、面向列、可伸缩的分布式存储系统,利用HBase技术可在廉价PC Server上搭建起大规模结构化存储集群。
Hbase安装包点击下载
[root@master-tz src]# vim /etc/profile
//最后添加下面两行
export HBASE_HOME=/usr/local/src/hbase
export PATH=$PATH:$HBASE_HOME/bin
[root@master-tz src]# source /etc/profile
[root@master-tz src]# scp /etc/profile slave01-tz:/etc/profile
root@slave01-tz's password:
profile 100% 2704 1.7MB/s 00:00
[root@master-tz src]# scp /etc/profile slave02-tz:/etc/profile
root@slave02-tz's password:
profile
[root@slave01-tz ~]# source /etc/profile
[root@slave02-tz ~]# source /etc/profile
[root@master-tz conf]# vim hbase-env.sh
//添加如下
export JAVA_HOME=/usr/local/src/java
export HADOOP_HOME=/usr/local/src/hadoop
export HADOOP_CONF_DIR=${HADOOP_HOME}/etc/hadoop
export HBASE_MANAGES_ZK=false
export HBASE_LOG_DIR=${HBASE_HOME}/logs
export HBASE_PID_DIR=${HBASE_HOME}/pid
[root@master-tz conf]# vim hbase-site.xml
//添加如下,<configuration></configuration>中间
<property>
<name>hbase.rootdir</name>
<value>hdfs://master-tz:8020/hbase</value>
</property>
<property>
<name>hbase.master.info.port</name>
<value>16010</value>
</property>
<property>
<name>hbase.zookeeper.property.clientPort</name>
<value>2181</value>
</property>
<property>
<name>hbase.tmp.dir</name>
<value>/usr/local/src/hbase/tmp</value>
</property>
<property>
<name>zookeeper.session.timeout</name>
<value>120000</value>
</property>
<property>
<name>hbase.cluster.distributed</name>
<value>true</value>
</property>
<property>
<name>hbase.zookeeper.quorum</name>
<value>master-tz,slave01-tz,slave02-tz</value>
</property>
<property>
<name>hbase.zookeeper.property.dataDir</name>
<value>/usr/local/src/hbase/tmp/zookeeperhbase
</value>
</property>
[root@master-tz conf]# vim regionservers
[root@master-tz conf]# cat regionservers
master-tz
slave01-tz
slave02-tz
[root@master-tz conf]# scp -r /usr/local/src/hbase slave01-tz:/usr/local/src
[root@master-tz conf]# scp -r /usr/local/src/hbase slave02-tz:/usr/local/src
[root@slave01-tz ~]# chown -R hadoop:hadoop /usr/local/src/hbase/
[root@slave02-tz ~]# chown -R hadoop:hadoop /usr/local/src/hbase/
三台关闭防火墙
首先开启zookeeper,在开启集群
[hadoop@master-tz ~]$ zkServer.sh start //三台都需要开启
[hadoop@master-tz ~]$ start-all.sh //只需要在master开启集群
[hadoop@master-tz ~]$ start-hbase.sh //开启hbase
安装教程查看百度即可
运行CMD(以管理员方式打开)
mysql -uroot -p
创建数据表
mysql> CREATE TABLE info (
-> name varchar(32) comment '名称',
-> url char(50) comment '地址',
-> tip varchar(255) comment '描述'
-> );
mysql> INSERT INTO info(name,url,tip) VALUE('雄安host','https://www.xiongan.host','xiongan');