安装hbas_史上最详细的CentOS 7 安装 HBase教程

本文详细介绍了如何在CentOS 7上安装HBase,包括依赖项JDK、Zookeeper和Hadoop的安装配置,以及解决过程中遇到的JAVA_HOME、端口冲突等错误。
摘要由CSDN通过智能技术生成

标签:

1.根据官方文档,安装hbase依赖项的版本可以选择JDK1.8, zookeeper 3.4. x, hadoop 2.7.7, Hbase hbase-2.0.2-bin.tar.gz

2. 安装zookeeper(standalone模式)

从https://mirrors.tuna.tsinghua.edu.cn/apache/zookeeper/ 下载 zookeeper 3.4.x

将下载的zookeeper-3.4.10.tar.gz解压缩,复制一份/conf/zoosample.cfg  重命名为zoo.cfg

3.修改zoo.cfg 文件的datadir

4.启动zookeeper zkServer.sh start

5 检查zookeeper的状态 zkServer.sh status

此时出现了一个错误

原来是log的目录设置问题

更新log目录设置后重启服务,发现还是不行,不过幸好log文件生成了 原来是JAVA_HOME的问题

更新JAVA_HOME后服务恢复正常

5 安装Hadoop

从https://mirrors.tuna.tsinghua.edu.cn/apache/hadoop/ 下载 hadoop-2.7.7.tar.gz

6 拷贝tar文件到 /usr/local/bin 并解压缩 tar -xzvf  hadoop-2.7.7.tar.gz

7 创建一个新账户 useradd hadoop

8 切换到hadoop账户生成sshkey

ssh-keygen -t rsa

9 使用此密钥启用SSH访问本地计算机

cat /home/hadoop/.ssh/id_rsa.pub >> /home/hadoop/.ssh/authorized_keys

10 测试ssh

ssh localhost

11 更新环境变量

vim /etc/profile

添加

export HADOOP_HOME=/usr/local/bin/hadoop-2.7.7

export PATH=${HADOOP_HOME}/bin:${HADOOP_HOME}/sbin:$PATH

12 更新core-site.xml

hadoop.tmp.dir

/app/hadoop/tmp

Parent directory for other temporary directories.

fs.defaultFS

hdfs://localhost:54310

The name of the default file system.

13  复制一份 mapred-site.xml.template文件

并更新配置

mapreduce.jobtracker.address

localhost:54311

MapReduce job tracker runs at this host and port.

14 更新 hdfs-site.xml

dfs.replication

1

Default block replication.

dfs.datanode.data.dir

/home/hduser_/hdfs

15  格式化 hdfs

hdfs namenode -format

16 启动hadoop

start-dfs.sh

出现错误JAVA_HOME not set

纳尼?不是在/etc/profile里设置过了么?

继续设置/etc/bashrc

export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.181-3.b13.el7_5.x86_64/jre

重新启动

成功

17 下载HBase-2.0.2.tar.gz 解压到 /usr/local/bin下

18 更新 hbase-site.xml

hbase.rootdir

hdfs://namenode.example.org:8020/hbase

hbase.cluster.distributed

false

19 更新Hbase的zookeeper设置

hbase.zookeeper.property.clientPort

2182

Property from ZooKeeper's config zoo.cfg.

The port at which the clients will connect.

hbase.zookeeper.quorum

localhost

Comma separated list of servers in the ZooKeeper Quorum.

For example, "host1.mydomain.com,host2.mydomain.com,host3.mydomain.com".

By default this is set to localhost for local and pseudo-distributed modes

of operation. For a fully-distributed setup, this should be set to a full

list of ZooKeeper quorum servers. If HBASE_MANAGES_ZK is set in hbase-env.sh

this is the list of servers which we will start/stop ZooKeeper on.

hbase.zookeeper.property.dataDir

/mnt/zkdata

Property from ZooKeeper's config zoo.cfg.

The directory where the snapshot is stored.

20 编辑profile /etc/profile 添加HBASE_HOME环境变量

export HBASE_HOME=/usr/local/bin/hbase-2.0.2/

export PATH=${HBASE_HOME}/bin:${HBASE_HOME}/sin:$PATH

21 启用环境变量

source /etc/profile

22 启动Hbase

start-hbase.sh

似乎没启动成功

查看hbase目录下的 log

原来是host设置问题

更改host设置 vim /conf/hbase-site.xml

结果还是报错

Could not start ZK at requested port of 2181.  ZK was started at port: 2182.

查看端口2181占用情况 netstat -nap | grep 2181 发现是Java进程,看不出来具体是什么

因此怀疑是Hbase启用了自带的zookeeper 导致默认端口占用冲突

23 修改 hbase-env.sh文件 禁用自带的zookeeper

export HBASE_MANAGES_ZK=false

修改hbase-site.xml

hbase.cluster.distributed

true

24 启动Hbase 和shell

start-hbase.sh

启动shell

hbase shell

启动成功

标签:

来源: https://www.cnblogs.com/miwtony/p/9682617.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值