公司项目组需要在异地机房进行测试,买的是阿里云的机器,领导一句话花最少的钱办最大的事情,所以预算是一台机器,一core的cpu,4G内存,20G硬盘,想在这上面搭建一套高大上的HBase
,这就好比给你一包方便面想让你做出一桌满汉全席出来, 尼玛这不是为难我吗!!
好吧,吐槽完之后该搬砖还得搬砖,最开始想法是搭建最简单的standlone版本的HBase,只需要基于local file,结果按照guide折腾半天起不来,感觉这种方案非常不靠谱的样子,只好退而
求其次,搭建伪分布环境的HBase,好吧,下面是搭建过程。
1. 前戏-版本依赖
hbase和hadoop是两个专情又有强迫症的二货,对于兼容性要求很高,安装之前请自行关注版本是否匹配,我这次使用的是hbase-0.94.12和hadoop-0.20,如果版本不对后续会遇到各种莫名其
妙的坑爹错误
2. 过程-HBase配置文件修改
hbase-env.sh 需要改的地方
JAVA_HOME=/opt/taobao/java
export JAVA_HOME=${JAVA_HOME}
export HBASE_CLASSPATH=/home/admin/hadoop-0.20/conf/
export HBASE_MANAGES_ZK=true
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!--
/**
* Copyright 2010 The Apache Software Foundation
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-->
<configuration>
<property>
<name>hbase.cluster.distributed</name>
<value>true</value>
</property>
<property>
<name>hbase.rootdir</name>
<value>hdfs://localhost:9000/hbase</value>
</property>
</configuration>
3. 过程-Hadoop配置文件修改
core-site.xml
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!-- Put site-specific property overrides in this file. -->
<configuration>
<property>
<name>hadoop.tmp.dir</name>
<value>/home/admin/hadoop-1.2.1/hadoopfs/tmp</value>
</property>
<property>
<name>fs.default.name</name>
<value>hdfs://localhost:9000</value>
</property>
</configuration>
4. 注意事项
如果发现本机可以访问,但远程主机无法访问,检查一下/etc/hosts,可能需要绑定hosts