首页 > 其他分享 >Hbase小白快速安装

Hbase小白快速安装

时间:2023-01-02 12:33:41浏览次数:32  
标签:log HBASE .# log4j 小白 export hbase 安装 Hbase

准备:

1.jdk

/opt/rdx/jdk      #jdk放置路径
复制代码

2.用户创建

groupadd hbase
useradd hbase -g hbase
复制代码

3.防火墙关掉

systemctl stop firewalld
复制代码

4.下载包

http://archive.apache.org/dist/hbase/hbase-0.98.6/   //下载的是hadoop相关包
复制代码

注意:这个是非分布式的,所以配置文件没有加入zookeeper的节点ip,如果是分布式要配置zk和分布式开关

安装:

1.创建文件安装路径

mkdir /opt/rdx/ 
cd /opt/rdx/
tar -xvf hbase-0.98.6-hadoop1-bin.tar.gz
mv hbase-0.98.6-hadoop1 /opt/rdx/hbase
cd /opt/rdx/hbase
mkdir data
复制代码

2.修改配置文件 hbase-env.sh

# Set environment variables here.


# This script sets variables multiple times over the course of starting an hbase process,
# so try to keep things idempotent unless you want to take an even deeper look
# into the startup scripts (bin/hbase, etc.)


# The java implementation to use. Java 1.7+ required.
export JAVA_HOME=/opt/rdx/jdk


# Extra Java CLASSPATH elements. Optional.
# export HBASE_CLASSPATH=


# The maximum amount of heap to use. Default is left to JVM default.
# export HBASE_HEAPSIZE=1G


# Uncomment below if you intend to use off heap cache. For example, to allocate 8G of
# offheap, set the value to "8G".
# export HBASE_OFFHEAPSIZE=1G


# 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/PerformanceTuning
export HBASE_OPTS="-XX:+UseConcMarkSweepGC"


# Configure PermSize. Only needed in JDK7. You can safely remove it for JDK8+
export HBASE_MASTER_OPTS="$HBASE_MASTER_OPTS -XX:PermSize=128m -XX:MaxPermSize=128m -XX:ReservedCodeCacheSize=256m"
export HBASE_REGIONSERVER_OPTS="$HBASE_REGIONSERVER_OPTS -XX:PermSize=128m -XX:MaxPermSize=128m -XX:ReservedCodeCacheSize=256m"


# Uncomment one of the below three options to enable java garbage collection logging for the server-side processes.


# This enables basic gc logging to the .out file.
# export SERVER_GC_OPTS="-verbose:gc -XX:+PrintGCDetails -XX:+PrintGCDateStamps"


# This enables basic gc logging to its own file.
# If FILE-PATH is not replaced, the log file(.gc) would still be generated in the HBASE_LOG_DIR .
# export SERVER_GC_OPTS="-verbose:gc -XX:+PrintGCDetails -XX:+PrintGCDateStamps -Xloggc:<FILE-PATH>"


# This enables basic GC logging to its own file with automatic log rolling. Only applies to jdk 1.6.0_34+ and 1.7.0_2+.
# If FILE-PATH is not replaced, the log file(.gc) would still be generated in the HBASE_LOG_DIR .
# export SERVER_GC_OPTS="-verbose:gc -XX:+PrintGCDetails -XX:+PrintGCDateStamps -Xloggc:<FILE-PATH> -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=1 -XX:GCLogFileSize=512M"


# Uncomment one of the below three options to enable java garbage collection logging for the client processes.


# This enables basic gc logging to the .out file.
# export CLIENT_GC_OPTS="-verbose:gc -XX:+PrintGCDetails -XX:+PrintGCDateStamps"


# This enables basic gc logging to its own file.
# If FILE-PATH is not replaced, the log file(.gc) would still be generated in the HBASE_LOG_DIR .
# export CLIENT_GC_OPTS="-verbose:gc -XX:+PrintGCDetails -XX:+PrintGCDateStamps -Xloggc:<FILE-PATH>"


# This enables basic GC logging to its own file with automatic log rolling. Only applies to jdk 1.6.0_34+ and 1.7.0_2+.
# If FILE-PATH is not replaced, the log file(.gc) would still be generated in the HBASE_LOG_DIR .
# export CLIENT_GC_OPTS="-verbose:gc -XX:+PrintGCDetails -XX:+PrintGCDateStamps -Xloggc:<FILE-PATH> -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=1 -XX:GCLogFileSize=512M"


# See the package documentation for org.apache.hadoop.hbase.io.hfile for other configurations
# needed setting up off-heap block caching.


# 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
# NOTE: HBase provides an alternative JMX implementation to fix the random ports issue, please see JMX
# section in HBase Reference Guide for instructions.


# export HBASE_JMX_BASE="-Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false"
# export HBASE_MASTER_OPTS="$HBASE_MASTER_OPTS $HBASE_JMX_BASE -Dcom.sun.management.jmxremote.port=10101"
# export HBASE_REGIONSERVER_OPTS="$HBASE_REGIONSERVER_OPTS $HBASE_JMX_BASE -Dcom.sun.management.jmxremote.port=10102"
# export HBASE_THRIFT_OPTS="$HBASE_THRIFT_OPTS $HBASE_JMX_BASE -Dcom.sun.management.jmxremote.port=10103"
# export HBASE_ZOOKEEPER_OPTS="$HBASE_ZOOKEEPER_OPTS $HBASE_JMX_BASE -Dcom.sun.management.jmxremote.port=10104"
# export HBASE_REST_OPTS="$HBASE_REST_OPTS $HBASE_JMX_BASE -Dcom.sun.management.jmxremote.port=10105"


# File naming hosts on which HRegionServers will run. $HBASE_HOME/conf/regionservers by default.
# export HBASE_REGIONSERVERS=${HBASE_HOME}/conf/regionservers


# Uncomment and adjust to keep all the Region Server pages mapped to be memory resident
#HBASE_REGIONSERVER_MLOCK=true
#HBASE_REGIONSERVER_UID="hbase"


# File naming hosts on which backup HMaster will run. $HBASE_HOME/conf/backup-masters by default.
# export HBASE_BACKUP_MASTERS=${HBASE_HOME}/conf/backup-masters


# 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


# Enable remote JDWP debugging of major HBase processes. Meant for Core Developers
# export HBASE_MASTER_OPTS="$HBASE_MASTER_OPTS -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8070"
# export HBASE_REGIONSERVER_OPTS="$HBASE_REGIONSERVER_OPTS -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8071"
# export HBASE_THRIFT_OPTS="$HBASE_THRIFT_OPTS -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8072"
# export HBASE_ZOOKEEPER_OPTS="$HBASE_ZOOKEEPER_OPTS -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8073"


# 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


# The default log rolling policy is RFA, where the log file is rolled as per the size defined for the
# RFA appender. Please refer to the log4j.properties file to see more details on this appender.
# In case one needs to do log rolling on a date change, one should set the environment property
# HBASE_ROOT_LOGGER to "<DESIRED_LOG LEVEL>,DRFA".
# For example:
# HBASE_ROOT_LOGGER=INFO,DRFA
# The reason for changing default to RFA is to avoid the boundary case of filling out disk space as
# DRFA doesn't put any cap on the log size. Please refer to HBase-5655 for more context.
复制代码

3.修改配置文件 hbase-site.xml 注意的是: 这个端口设定,在 0.98.6这个版本中是没有问题的,版本高了就会失效,他会自定义端口,安装完成以后要自己区找

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>


<configuration>
<property>
<name>hbase.tmp.dir</name>
<value>/opt/rdx/hbase/data</value>
</property>


<property>
<name>hbase.zookeeper.property.clientPort</name>
<value>2182</value>
</property>
<property>
<name>hbase.master.port</name>
<value>16000</value>
</property>
<property>
<name>hbase.master.info.port</name>
<value>16010</value>
</property>
<property>
<name>hbase.regionserver.port</name>
<value>16020</value>
</property>
<property>
<name>hbase.regionserver.info.port</name>
<value>16030</value>
</property>
</configuration>
4.修改配置文件 log4j.properties
# 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.


# Define some default values that can be overridden by system properties
hbase.root.logger=INFO,console
hbase.security.logger=INFO,console
hbase.log.dir=.
hbase.log.file=hbase.log


# Define the root logger to the system property "hbase.root.logger".
log4j.rootLogger=${hbase.root.logger}


# Logging Threshold
log4j.threshold=ALL


#
# Daily Rolling File Appender
#
log4j.appender.DRFA=org.apache.log4j.DailyRollingFileAppender
log4j.appender.DRFA.File=${hbase.log.dir}/${hbase.log.file}


# Rollver at midnight
log4j.appender.DRFA.DatePattern=.yyyy-MM-dd


# 30-day backup
#log4j.appender.DRFA.MaxBackupIndex=30
log4j.appender.DRFA.layout=org.apache.log4j.PatternLayout


# Pattern format: Date LogLevel LoggerName LogMessage
log4j.appender.DRFA.layout.ConversionPattern=%d{ISO8601} %-5p [%t] %c{2}: %.1000m%n


# Rolling File Appender properties
hbase.log.maxfilesize=256MB
hbase.log.maxbackupindex=20


# Rolling File Appender
log4j.appender.RFA=org.apache.log4j.RollingFileAppender
log4j.appender.RFA.File=${hbase.log.dir}/${hbase.log.file}


log4j.appender.RFA.MaxFileSize=${hbase.log.maxfilesize}
log4j.appender.RFA.MaxBackupIndex=${hbase.log.maxbackupindex}


log4j.appender.RFA.layout=org.apache.log4j.PatternLayout
log4j.appender.RFA.layout.ConversionPattern=%d{ISO8601} %-5p [%t] %c{2}: %.1000m%n


#
# Security audit appender
#
hbase.security.log.file=SecurityAuth.audit
hbase.security.log.maxfilesize=256MB
hbase.security.log.maxbackupindex=20

log4j.appender.RFAS=org.apache.log4j.RollingFileAppender
log4j.appender.RFAS.File=${hbase.log.dir}/${hbase.security.log.file}
log4j.appender.RFAS.MaxFileSize=${hbase.security.log.maxfilesize}
log4j.appender.RFAS.MaxBackupIndex=${hbase.security.log.maxbackupindex}
log4j.appender.RFAS.layout=org.apache.log4j.PatternLayout
log4j.appender.RFAS.layout.ConversionPattern=%d{ISO8601} %p %c: %.1000m%n
log4j.category.SecurityLogger=${hbase.security.logger}
log4j.additivity.SecurityLogger=false
#log4j.logger.SecurityLogger.org.apache.hadoop.hbase.security.access.AccessController=TRACE
#log4j.logger.SecurityLogger.org.apache.hadoop.hbase.security.visibility.VisibilityController=TRACE


#
# Null Appender
#
log4j.appender.NullAppender=org.apache.log4j.varia.NullAppender


#
# console
# Add "console" to rootlogger above if you want to use this
#
log4j.appender.console=org.apache.log4j.ConsoleAppender
log4j.appender.console.target=System.err
log4j.appender.console.layout=org.apache.log4j.PatternLayout
log4j.appender.console.layout.ConversionPattern=%d{ISO8601} %-5p [%t] %c{2}: %.1000m%n


log4j.appender.asyncconsole=org.apache.hadoop.hbase.AsyncConsoleAppender
log4j.appender.asyncconsole.target=System.err


# Custom Logging levels


log4j.logger.org.apache.zookeeper=INFO
#log4j.logger.org.apache.hadoop.fs.FSNamesystem=DEBUG
log4j.logger.org.apache.hadoop.hbase=INFO
# Make these two classes INFO-level. Make them DEBUG to see more zk debug.
log4j.logger.org.apache.hadoop.hbase.zookeeper.ZKUtil=INFO
log4j.logger.org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher=INFO
#log4j.logger.org.apache.hadoop.dfs=DEBUG
# Set this class to log INFO only otherwise its OTT
# Enable this to get detailed connection error/retry logging.
# log4j.logger.org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation=TRACE




# Uncomment this line to enable tracing on _every_ RPC call (this can be a lot of output)
#log4j.logger.org.apache.hadoop.ipc.HBaseServer.trace=DEBUG


# Uncomment the below if you want to remove logging of client region caching'
# and scan of hbase:meta messages
# log4j.logger.org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation=INFO
# log4j.logger.org.apache.hadoop.hbase.client.MetaScanner=INFO


# EventCounter
# Add "EventCounter" to rootlogger if you want to use this
# Uncomment the line below to add EventCounter information
# log4j.appender.EventCounter=org.apache.hadoop.log.metrics.EventCounter


# Prevent metrics subsystem start/stop messages (HBASE-17722)
log4j.logger.org.apache.hadoop.metrics2.impl.MetricsConfig=WARN
log4j.logger.org.apache.hadoop.metrics2.impl.MetricsSinkAdapter=WARN
log4j.logger.org.apache.hadoop.metrics2.impl.MetricsSystemImpl=WARN
复制代码

5.更改所有配置文件的权限

chown  -R  hbase:hbase  /opt/rdx/hbase
复制代码

6.创建服务进程 /etc/systemd/system/rdx-hbase.service

[Unit]
Description=HBase
After=network.target


[Service]
Type=forking #注意这个forking是后台运行,simple是直接运行
User=hbase #写了运行的所属者和所属组我们就要创建相应的用户和组,否则起不来
Group=hbase
Environment="JAVA_HOME=/opt/rdx/jdk"
WorkingDirectory=/opt/rdx/hbase
ExecStart=/opt/rdx/hbase/bin/start-hbase.sh
ExecStop=/opt/rdx/hbase/bin/stop-hbase.sh
SyslogIdentifier=hbase
Restart=no


[Install]
WantedBy=multi-user.target
复制代码

7.起服务

systemctl start rdx-hbase
复制代码

8.安装后测试

http://172.20.3.58:16010/     //web界面访问
./hbase shell //进入hbase数据库
list //显示表
create 'user1','info1' //创建两个表
describe 'user1' //显示表结构
drop 'user1' //删除表之前要设置disable如下
disable 'user1'
put 'zhangsan1','zhangsan2','zhangsan3' //插入表格
scan 'user1' //全表扫描
count 'user1'

标签:log,HBASE,.#,log4j,小白,export,hbase,安装,Hbase
From: https://blog.51cto.com/u_12668934/5983588

相关文章

  • 安装maven(Maven 下载地址:http://maven.apache.org/download.cgi)
    1.解压apache-maven-3.2.5文件(bin需在下一级目录)2.进入环境变量:打开-此电脑-右键属性-高级系统设置-环境变量   3.新增用户变量:新建MAVEN_HOME变量变量名;MAVEN_......
  • 使用 Helm 安装 MQTT 服务器-EMQX
    EMQXℹ️Info:使用EMQX通过Helm3在Kubernetes上部署EMQX4.0集群|EMQemqx/deploy/charts/emqxatmain-v4.4·emqx/emqx(github.com)emqx/values.yamlat......
  • [转载]安装.Net Framework 出现“无法建立到信任根颁发机构的证书链”解决方法
    一、错误1、尚未安装.net4.6,无法建立到信任根颁发机构的证书链的错误,如图所示:  2、出现错误的原因:在安装Microsoft.NETFramework4.6.2脱机包时提示无法建立到信......
  • 使用 Helm 安装 MQTT 服务器-EMQX
    EMQXℹ️Info:使用EMQX通过Helm3在Kubernetes上部署EMQX4.0集群|EMQemqx/deploy/charts/emqxatmain-v4.4·emqx/emqx(github.com)emqx/values.yamlat......
  • OpenFace 2.2.0安装步骤
    本文是安装OpenFace2.2.0的过程,以及安装时可能遇见的一系列问题。下载源码以及脚本对应的文件下载源码压缩包解压后,执行文件夹中的脚本download_libraries.ps1。该......
  • Centos7安装Mysql8
    Centos7安装Mysql8一、环境预备1.1首先查看系统是否存在mysql,无则不返回rpm-qa|grepmysql1.2安装wgetyum-yinstallwget1.3抓取mariadb并删除包,无则不返回......
  • 如何免费获取并安装Office软件?
    首先说,这是完全免费而且合法的。无论是word、excel还是其他。大家可能不知道,微软官方是提供office各种版本的激活密钥的。在以下地址可以查看激活密钥:https://learn.......
  • 安装Docker——镜像加速
    Docker的安装Docker的官网必须是Centos7版本,最好是7.7的内核,docker目前不支持Centos8Docker源路径的寻找因为官网的Docker的repo源是通过走国外的网站来获取的,对于网......
  • 【疑难杂症】 lanms-proper的安装问题
    问题:pip一直install不了,去pypi看可知这东西版本很老,且只支持Linux平台。解决方法:改成安装lanms-neo,这是作者专门搞的兼容Windows版本的lanms,其接口函数与lanms-proper......
  • Metagenome宏基因组 singularity 容器安装使用 2022.12.29 -2022.01.01
    exportPATH=/home/ubuntu/software:$PATH#PATH=PWD:$PATHcondacreat-cbioconda-nname_envsfastqc#conda子环境安装fastqccondaactivatename_envs#切换到子环境......