HBase安装
修改公共包服务器
echo"[c6-media]" > /etc/yum.repos.d/CentOS-Media.repo
echo"name=CentOS-$releasever - Media" >>/etc/yum.repos.d/CentOS-Media.repo
echo"baseurl=http://192.168.157.250/centos/6.4/" >>/etc/yum.repos.d/CentOS-Media.repo
echo"gpgcheck=0" >> /etc/yum.repos.d/CentOS-Media.repo
echo"enabled=1" >> /etc/yum.repos.d/CentOS-Media.repo
安装SSH 等依赖
yum -yinstall openssh-clients gcc-c++ vim make gcc unzip wget subversion openssh zlib zlib-devel rsync
查看ssh版本
ssh-version
关闭防火墙
serviceiptables stop
此命令立即生效,重启后失效
chkconfigiptables off
关闭防火墙,重启系统生效
修改本机sshd配置
vi /etc/ssh/sshd_config
找到以下内容,并去掉注释符”#“
RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile .ssh/authorized_keys
重启ssh
servicesshd restart
测试ssh
ssh localhost
生成公私钥
ssh-keygen-t dsa -P '' -f ~/.ssh/id_dsa
cat~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys
测试
ssh localhost
安装单机模式HBase
修改conf/hbase-env.sh
将export JAVA_HOME=指向正确的javahome
在http://apache.fayea.com/apache-mirror/hbase/stable/目录下载文档版
$ tar xfz hbase-0.95-SNAPSHOT.tar.gz
$ cd hbase-0.95-SNAPSHOT
修改conf/hbase-site.xml
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<configuration>
<property>
<name>hbase.rootdir</name>
<value>file:///DIRECTORY/hbase</value>
</property>
<property>
<name>hbase.zookeeper.property.dataDir</name>
<value>/Directory/zookeeper</value>
</property>
</configuration>
启动hbase
$ ./bin/start-hbase.sh
starting Master, logging to logs/hbase-user-master-example.org.out
执行jps
应该有HMaster进程
通过shell连接
$ ./bin/hbase shell
HBase Shell; enter 'help<RETURN>' for list of supported commands.
Type "exit<RETURN>" to leave the HBase Shell
Version: 0.90.0, r1001068, Fri Sep 24 13:55:42 PDT 2010
hbase(main):001:0>
分布式搭建
所需软件
Java oracle java6除了u18
Sshd必须运行,集群之间可以无密码登录,sshpasswordless login;
安装Ntp
rpm-q ntp || yum -y install ntp
伪分布式搭建
cd/export/servers/hbase/lib/
ls lib |grep '^hadoop*'
rm -rfhadoop-*2.2.0.jar
find/export/servers/hadoop-2.6.0/share/hadoop -name "hadoop*jar" | xargs-i cp {} /export/servers/hbase/lib/
Conf/hbase-site.xml
<property>
<name>hbase.rootdir</name>
<value>hdfs://master:9000/hbase</value>
</property>
<property>
<name>hbase.master</name>
<value>hdfs://master:60000</value>
</property>
<property>
<name>hbase.cluster.distributed</name>
<value>true</value>
</property>
<property>
<name>hbase.zookeeper.property.clientPort</name>
<value>2181</value>
</property>
<property>
<name>hbase.zookeeper.quorum</name>
<value>master</value>
</property>
<property>
<name>hbase.zookeeper.property.dataDir</name>
<value>/home/hadoop/zookeeper</value>
</property>
<property>
<name>dfs.replication</name>
<value>1</value>
</property>
分布式搭建
conf/hbase-env.sh
exportJAVA_HOME=/export/servers/jdk1.6.0_25
exportHBASE_MANAGES_ZK=false
conf/hbase-site.xml
<property>
<name>hbase.rootdir</name>
<value>hdfs://master:9000/hbase</value>
</property>
<property>
<name>hbase.cluster.distributed</name>
<value>true</value>
</property>
<property>
<name>hbase.zookeeper.quorum</name>
<value>master</value>
</property>
<property>
<name>hbase.zookeeper.property.dataDir</name>
<value>/export/servers/zookeeper-3.4.6/data</value>
</property>
将hadoop的hbase-site.xml拷贝到conf目录
conf/regionservers
在这只跑了本机
master
启动
启动zookeeper(自己管理集群的情况)
zkServer.shstart
启动hbase查看日志
bin/start-hbase.sh;tail-f ./logs/hbase-hadoop-master-master.log
启动成功的话
[hadoop@master hbase0.96]$ jps
24855 HRegionServer
24530 QuorumPeerMain
25132 Jps
22325 NameNode
22691 ResourceManager
24720 HMaster
22522 SecondaryNameNode
访问master:60010/master-status可以看到hbase的管理页面
自己装的时候遇到一个特别恶心的bug一直在报
org/htrace/Trace找不到
最后
htrace-core-2.04.jar
htrace-core-3.0.4.jar
解决的问题,这个地方有疑问.
运行和确认你的安装
create 'test', 'cf'
hbase(main):003:0> list 'table'
test
hbase(main):004:0> put 'test', 'row1', 'cf:a', 'value1
hbase(main):007:0> scan 'test'
hbase(main):008:0> get 'test', 'row1'
运维:
遇到问题的时候先要确认问题是否在hadoop身上