先安装好Hadoop
Hadoop-完全分布式安装步骤 - 简书 (jianshu.com)
再安装好Zookeeper
Zookeeper集群搭建带启停脚本 - 简书 (jianshu.com)
HBase安装步骤
下载
http://archive.apache.org/dist/hbase/1.3.1/
[server@hadoop102 bin]$ cd /opt/software/
[server@hadoop102 software]$ pwd
/opt/software
[server@hadoop102 software]$ tar -zxvf hbase-1.3.1-bin.tar.gz -C /opt/module/
[server@hadoop102 software]$ cd /opt/module/
[server@hadoop102 module]$ mv hbase-1.3.1/ hbase
[server@hadoop102 module]$ cd hbase/
[server@hadoop102 hbase]$ cd conf
[server@hadoop102 conf]$ pwd
/opt/module/hbase/conf
[server@hadoop102 conf]$ vim hbase-env.sh
改自己的jdk
export JAVA_HOME=/opt/module/jdk1.8.0_65
禁用HBase自带ZK
export HBASE_MANAGES_ZK=false
注释
# export HBASE_MASTER_OPTS="$HBASE_MASTER_OPTS -XX:PermSize=128m -XX:MaxPermSize=128m"
# export HBASE_REGIONSERVER_OPTS="$HBASE_REGIONSERVER_OPTS -XX:PermSize=128m -XX:MaxPermSize=128m"
[server@hadoop102 conf]$ vim hbase-site.xml
注意第一个配置,distributed,否则java.io.IOException: Could not start ZK with 3 ZK servers in local mode deployment. Aborting as clients (e.g. shell) will not be able to find this ZK quorum.
注意hbase.rootdir,这个是hdfs的路径,不要写端口,写端口代表单台机器
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!--
/**
*
* 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://hadoop102/hbase/</value>
</property>
<property>
<name>hbase.zookeeper.quorum</name>
<value>hadoop102,hadoop103,hadoop104</value>
</property>
<property>
<name>hbase.zookeeper.property.clientPort</name>
<value>2181</value>
</property>
<property>
<name>hbase.zookeeper.property.dataDir</name>
<value>/opt/module/zookeeper-3.5.7/zkData</value>
</property>
<property>
<name>hbase.master.port</name>
<value>16000</value>
</property>
</configuration>
[server@hadoop102 conf]$ vim regionservers
hadoop102
hadoop103
hadoop104
[server@hadoop102 conf]$ cd ..
[server@hadoop102 hbase]$ cd ..
[server@hadoop102 module]$ pwd
/opt/module
[server@hadoop102 module]$ ln -s /opt/module/hadoop-3.1.3/etc/hadoop/core-site.xml /opt/module/hbase/conf/core-site.xml
[server@hadoop102 module]$ ln -s /opt/module/hadoop-3.1.3/etc/hadoop/hdfs-site.xml /opt/module/hbase/conf/hdfs-site.xml
[server@hadoop102 module]$ xsync hbase/
[server@hadoop103 bin]$ myhadoop.sh start
=================启动 Hadoop集群========================
------------------启动 hdfs-----------------------------
Starting namenodes on [hadoop102]
Starting datanodes
Starting secondary namenodes [hadoop104]
------------------启动 yarn-----------------------------
Starting resourcemanager
Starting nodemanagers
------------------启动 historyserver--------------------
在集群创建/hbase目录
[server@hadoop103 hbase]$ hadoop fs -mkdir /hbase
[server@hadoop103 jdk1.8.0_65]$ zk.sh start
------------------------- zookeeper hadoop102 启动 ---------------------------
ZooKeeper JMX enabled by default
Using config: /opt/module/zookeeper-3.5.7/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
------------------------- zookeeper hadoop103 启动 ---------------------------
ZooKeeper JMX enabled by default
Using config: /opt/module/zookeeper-3.5.7/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
------------------------- zookeeper hadoop104 启动 ---------------------------
ZooKeeper JMX enabled by default
Using config: /opt/module/zookeeper-3.5.7/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
[server@hadoop102 module]$ cd hbase/
[server@hadoop102 hbase]$ pwd
/opt/module/hbase
[server@hadoop102 hbase]$ bin/start-hbase.sh
[server@hadoop102 module]$ cd hbase/
[server@hadoop102 hbase]$ pwd
/opt/module/hbase
[server@hadoop102 hbase]$ bin/start-hbase.sh
starting master, logging to /opt/module/hbase/bin/../logs/hbase-server-master-hadoop102.out
hadoop104: starting regionserver, logging to /opt/module/hbase/bin/../logs/hbase-server-regionserver-hadoop104.out
hadoop103: starting regionserver, logging to /opt/module/hbase/bin/../logs/hbase-server-regionserver-hadoop103.out
hadoop102: starting regionserver, logging to /opt/module/hbase/bin/../logs/hbase-server-regionserver-hadoop102.out
[server@hadoop102 hbase]$ bin/start-hbase.sh
starting master, logging to /opt/module/hbase/bin/../logs/hbase-server-master-hadoop102.out
hadoop104: starting regionserver, logging to /opt/module/hbase/bin/../logs/hbase-server-regionserver-hadoop104.out
hadoop103: starting regionserver, logging to /opt/module/hbase/bin/../logs/hbase-server-regionserver-hadoop103.out
hadoop102: starting regionserver, logging to /opt/module/hbase/bin/../logs/hbase-server-regionserver-hadoop102.out
[server@hadoop102 hbase]$ bin/hbase shell
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/opt/module/hbase/lib/slf4j-log4j12-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/opt/module/hadoop-3.1.3/share/hadoop/common/lib/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]
HBase Shell; enter 'help<RETURN>' for list of supported commands.
Type "exit<RETURN>" to leave the HBase Shell
Version 1.3.1, r930b9a55528fe45d8edce7af42fef2d35e77677a, Thu Apr 6 19:36:54 PDT 2017
hbase(main):001:0> list
TABLE
0 row(s) in 1.3010 seconds
=> []
hbase(main):002:0> quit
[server@hadoop102 ~]$ cd /opt/module/zookeeper-3.5.7/
[server@hadoop102 zookeeper-3.5.7]$ bin/zkCli.sh
[zk: localhost:2181(CONNECTED) 0] ls /
[hbase, zookeeper]
网友评论