博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Hadoop环境搭建之Zookeeper、Hbase安装
阅读量:6864 次
发布时间:2019-06-26

本文共 5778 字,大约阅读时间需要 19 分钟。

hot3.png

一、说明

1、环境说明

11、3台服务器(h1、h2、h3)的SSH配置见:

12、hadoop的安装配置见:

2、软件说明

zookeeper:zookeeper-3.3.1.tar.gz , 下载地址:https://yunpan.cn/cS45WHyjTIR2c (提取码:92d4)

hbase:hbase-0.94.12.tar,下载地址:https://yunpan.cn/cS455DsCMYiyV (提取码:fbe6)

二、安装zookeeper

由于hbase需要zookeeper做协同服务,所以得先安装zookeeper

21、将zookeeper-3.3.1.tar.gz在/bdata/中解压,解压后的文件为zookeeper-3.3.1,命令如下:

tar -zxvf zookeeper-3.3.1.tar.gz

22、配置zookeeper

221、切换到zookeeper-3.3.1的conf目录,将zoo_sample.cfg复制为zoo.cfg

cp zoo_sample.cfg zoo.cfg

222、修改zoo.cfg的内容为:

# The number of milliseconds of each ticktickTime=2000# The number of ticks that the initial # synchronization phase can takeinitLimit=10# The number of ticks that can pass between # sending a request and getting an acknowledgementsyncLimit=5# the directory where the snapshot is stored.dataDir=/bdata/zookeeper-3.3.1/server/data# the port at which the clients will connectclientPort=2181server.1=h1:2888:3888server.2=h2:2888:3888server.3=h3:2888:3888

其中h1、h2、h3是三个服务器

223、创建/bdata/zookeeper-3.3.1/server/data目录,并在目录创建myid的文件,h1、h2、h3相应目录下的文件内容依次为1、2、3

140205_UEmh_948369.png

140234_ak4Q_948369.png

140303_SpZ0_948369.png

23、将配置好的zookeeper-3.3.1发送给h2、h3的/bdata目录下,分别执行以下命令

scp -r /bdata/zookeeper-3.3.1 root@h2:/bdata/
scp -r /bdata/zookeeper-3.3.1 root@h3:/bdata/

24、修改h2、h3  /bdata/zookeeper-3.3.1/server/data/myid的内容为2、3

三、安装Hbase

31、将hbase-0.94.12.tar在/bdata目录下解压,解压后的文件名为hbase-0.94.12,目录如下

tar -zxvf hbase-0.94.12.tar

32、配置文件

321、修改/bdata/hbase-0.94.12/conf/hbase-env.sh,将其内容修改为

##/**# * Copyright 2007 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.# */# Set environment variables here.# The java implementation to use.  Java 1.6 required.#export JAVA_HOME=/usr/java/jdk.1.6.0_45export JAVA_HOME=/usr/java/jdk1.6.0_45# Extra Java CLASSPATH elements.  Optional.# export HBASE_CLASSPATH=# The maximum amount of heap to use, in MB. Default is 1000.# export HBASE_HEAPSIZE=1000# Extra Java runtime options.# Below are what we set by default.  May only work with SUN JVM.# For more on why as well as other possible settings,# see http://wiki.apache.org/hadoop/PerformanceTuningexport HBASE_OPTS="-ea -XX:+UseConcMarkSweepGC -XX:+CMSIncrementalMode"# Uncomment below to enable java garbage collection logging.# export HBASE_OPTS="$HBASE_OPTS -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCDateStamps -Xloggc:$HBASE_HOME/logs/gc-hbase.log" # Uncomment and adjust to enable JMX exporting# See jmxremote.password and jmxremote.access in $JRE_HOME/lib/management to configure remote password access.# More details at: http://java.sun.com/javase/6/docs/technotes/guides/management/agent.html## export HBASE_JMX_BASE="-Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false"# export HBASE_MASTER_OPTS="$HBASE_JMX_BASE -Dcom.sun.management.jmxremote.port=10101 -javaagent:lib/HelloWorldAgent.jar"# export HBASE_REGIONSERVER_OPTS="$HBASE_JMX_BASE -Dcom.sun.management.jmxremote.port=10102"# export HBASE_THRIFT_OPTS="$HBASE_JMX_BASE -Dcom.sun.management.jmxremote.port=10103"# export HBASE_ZOOKEEPER_OPTS="$HBASE_JMX_BASE -Dcom.sun.management.jmxremote.port=10104"# File naming hosts on which HRegionServers will run.  $HBASE_HOME/conf/regionservers by default.# export HBASE_REGIONSERVERS=${HBASE_HOME}/conf/regionservers# Extra ssh options.  Empty by default.# export HBASE_SSH_OPTS="-o ConnectTimeout=1 -o SendEnv=HBASE_CONF_DIR"# Where log files are stored.  $HBASE_HOME/logs by default.# export HBASE_LOG_DIR=${HBASE_HOME}/logs# A string representing this instance of hbase. $USER by default.# export HBASE_IDENT_STRING=$USER# The scheduling priority for daemon processes.  See 'man nice'.# export HBASE_NICENESS=10# The directory where pid files are stored. /tmp by default.# export HBASE_PID_DIR=/var/hadoop/pids# Seconds to sleep between slave commands.  Unset by default.  This# can be useful in large clusters, where, e.g., slave rsyncs can# otherwise arrive faster than the master can service them.# export HBASE_SLAVE_SLEEP=0.1# Tell HBase whether it should manage it's own instance of Zookeeper or not.export HBASE_MANAGES_ZK=true

此文件主要配置了jdk的安装路径,以及“HBASE_MANAGES_ZK”是否管理一个zookeeper集群,其值是“true”表示启动hbase的时候,他会去启动zookeeper

322、配置hbase-site.xml,将其内容该为

hbase.rootdir
hdfs://h1:9000/hbase
hbase.cluster.distributed
true
hbase.master.port
60000
hbase.zookeeper.quorum
h1,h2,h3

33、将配置好的hbase-0.94.12发送到h2、h3的/bdata/目录下,在h1下分别执行以下命令

scp -r /bdata/hbase-0.94.12 root@h2:/
scp -r /bdata/hbase-0.94.12 root@h3:/

34、启动hbase

在/bdata/hbase-0.94.12/bin目录下执行./start-hbase

cd /bdata/hbase-0.94.12/bin
./start-hbase

4、简单玩玩hbase

如果前边几个步骤执行顺利的话,接下来我们就进入hbase的shell控制台,去hbase进行简单的操作吧

41、进入控制台

cd /bdata/hbase-0.94.12/bin/./hbase shell

42、创建一张表

142807_p3xF_948369.png

创建了表,名称为t_user,列簇为name,other

43、插入两条条数据

143230_HUSg_948369.png

143319_2sVu_948369.png

行键为liw,在列簇name下边建了列firstname、lastname

44、查看插入的数据

143541_dyLL_948369.png

 

转载于:https://my.oschina.net/u/948369/blog/685994

你可能感兴趣的文章
Lua学习总结
查看>>
mysql 创建函数问题
查看>>
es了解集群中属性 4
查看>>
百万级访问量网站的技术准备工作
查看>>
使用批处理实现mysql数据库备份与上传
查看>>
SpringMVC和Dubbo的整合
查看>>
1.15 克隆虚拟机
查看>>
python入门(三)-- 基本运算符
查看>>
Centos7设置网络
查看>>
Class com.googlecode.jsonplugin.JSONWriter ca...
查看>>
windows下react-native环境搭建
查看>>
高性能Server---Reactor模型
查看>>
nodejs安装jsdom模块出现MSB4025错误
查看>>
read-sequence的返回值
查看>>
线程同步的方法
查看>>
F7-Vue1.0与2.0不兼容列表
查看>>
TextView 添加Onclick 无效
查看>>
UML 类图
查看>>
win7 + vs2013 + zlib 编译
查看>>
ubuntu workerman kaer
查看>>