HBase部署之官网翻译

本文详细介绍了HBase的部署过程,从单机模式开始,逐步过渡到伪分布式和全分布式模式。内容涵盖环境配置、HBase Shell的使用,以及HBase在HDFS上的数据存储。此外,还讲解了如何配置免密SSH访问,以实现多节点间的通信,以及如何启动和测试分布式集群。
摘要由CSDN通过智能技术生成
Quick Start - Standalone HBase

This section describes the setup of a single-node standalone HBase. A standalone instance has all HBase daemons — the Master, RegionServers, and ZooKeeper — running in a single JVM persisting to the local filesystem. It is our most basic deploy profile. We will show you how to create a table in HBase using the hbase shell CLI, insert rows into the table, perform put and scan operations against the table, enable or disable the table, and start and stop HBase.

这一部分描述HBase单节点模式(本地模式)的创建。该模式下拥有HBase的所有守护进程,包括 Master,RegionServers 和 ZooKeeper ----- 在单个JVM中运行,并把数据持久化到本地文件系统。这是我们最基本的部署配置文件。我们将向你展示如何运用 hbase shell CLI 在hbase中创建一个表,向表中插入一行,在表的基础上执行 put 和 scan 操作,enable(使表可用)或 disable(使表不可用),开启 和 结束 HBase.

2.2. Get Started with HBase

Procedure: Download, Configure, and Start HBase in Standalone Mode

步骤:下载,配置 本地模式,并启动

Choose a download site from this list of Apache Download Mirrors. Click on the suggested top link. This will take you to a mirror of HBase Releases. Click on the folder named stable and then download the binary file that ends in .tar.gz to your local filesystem. Do not download the file ending in src.tar.gz for now.

从apach的下载镜像列表中选择一个下载地址,点击链接。这将把你带到HBASE版本的镜像中。单击命名为“稳定”的文件夹,然后下载以.t.gz结尾的二进制文件到本地文件系统。现在不要下载以src.tar.gz结束的文件

Extract the downloaded file, and change to the newly-created directory.

提取下载的文件,并将其更改为新创建的目录。

$ tar xzvf hbase-3.0.0-SNAPSHOT-bin.tar.gz
$ cd hbase-3.0.0-SNAPSHOT/

You are required to set the JAVA_HOME environment variable before starting HBase. You can set the variable via your operating system’s usual mechanism, but HBase provides a central mechanism, conf/hbase-env.sh. Edit this file, uncomment the line starting with JAVA_HOME, and set it to the appropriate location for your operating system. The JAVA_HOME variable should be set to a directory which contains the executable file bin/java. Most modern Linux operating systems provide a mechanism, such as /usr/bin/alternatives on RHEL or CentOS, for transparently switching between versions of executables such as Java. In this case, you can set JAVA_HOME to the directory containing the symbolic link to bin/java, which is usually /usr

在启动HBase之前,你需要设置JAVA_HOME环境变量。你可以在电脑上设置这个环境变量,但是HBase提供了一个配置文件:conf/hbase-env.sh。编辑这个文件,把以JAVA_HOME开头的哪行注释解开,并且设置值为你本地电脑上包含可以执行bin/java的目录(简单说,就是改为你电脑上配置的JAVA_HOME的值)。大多数现代Linux操作系统提供了一种机制,例如RHEL或CENTOS上的/Ur/bin/替代品,用于透明地切换可执行文件的版本,例如Java。在这种情况下,可以将JAVA_HOME设置为包含bin/java的符号链接的目录,该目录通常是/usr。

Edit conf/hbase-site.xml, which is the main HBase configuration file. At this time, you need to specify the directory on the local filesystem where HBase and ZooKeeper write data and acknowledge some risks. By default, a new directory is created under /tmp. Many servers are configured to delete the contents of /tmp upon reboot, so you should store the data elsewhere. The following configuration will store HBase’s data in the hbase directory, in the home directory of the user called testuser. Paste the <property> tags beneath the <configuration> tags, which should be empty in a new HBase install.

编辑HBase的主要配置文件:conf/hbase-site.xml。这次我们需要设置HBase 和 ZooKeeper将要把数据写入到本地的哪个目录下。许多服务器被配置为在重新启动时删除/tMP的内容,因此您应该将数据存储在别处。下面的配置将把HBase的数据存储在hbase特用的目录中,被称为testuser的用户的主目录中。将下面 标签中的内容,粘贴到该文件的 (默认情况下这里应该是空白的) 标签中。



<configuration>
  <property>
    <name>hbase.rootdir</name>
    <value>file:///home/testuser/hbase</value>
  </property>
  <property>
    <name>hbase.zookeeper.property.dataDir</name>
    <value>/home/testuser/zookeeper</value>
  </property>
  <property>
    <name>hbase.unsafe.stream.capability.enforce</name>
    <value>false</value>
    <description>
      Controls whether HBase will check for stream capabilities (hflush/hsync).

      Disable this if you intend to run on LocalFileSystem, denoted by a rootdir
      with the 'file://' scheme, but be mindful of the NOTE below.

      WARNING: Setting this to false blinds you to potential data loss and
      inconsistent system state in the event of process and/or node failures. If
      HBase is complaining of an inability to use hsync or hflush it's most
      likely not a false positive.
    </description>
  </property>
</configuration>


You do not need to create the HBase data directory. HBase will do this for you. If you create the directory, HBase will attempt to do a migration, which is not what you want.

您不需要创建HBase数据目录。HBase会为你做这件事。如果创建目录,HBase将尝试进行迁移,而这不是您想要的。

note:

The hbase.rootdir in the above example points to a directory in the local filesystem. The 'file://' prefix is how we denote local filesystem. You should take the WARNING present in the configuration example to heart. In standalone mode HBase makes use of the local filesystem abstraction from the Apache Hadoop project. That abstraction doesn’t provide the durability promises that HBase needs to operate safely. This is fine for local development and testing use cases where the cost of cluster failure is well contained. It is not appropriate for production deployments; eventually you will lose data.

上面例子中的hbase.rootdir指向本地文件系统中的一个目录。“文件://'前缀是我们如何表示本地文件系统。你应该把配置示例中的警告放在心上。在独立模式下,hbase使用来自Apache Hadoop项目的本地文件系统抽象。这种抽象并不提供hbase需要安全操作的耐久性承诺。这对于本地开发和测试用例来说是很好的,其中集群故障的成本被很好地控制。它不适合生产部署,否则最终会丢失数据。

To home HBase on an existing instance of HDFS, set the hbase.rootdir to point at a directory up on your instance: e.g. hdfs://namenode.example.org:8020/hbase. For more on this variant, see the section below on Standalone HBase over HDFS.

要将HBase放在HDFS的现有实例上,请设置hbase.rootdir指向实例上的目录:例如,hdfs://namenode.example.org:8020/hbase.有关此变体的更多内容,请参见下面的基于HDFS的HBASE的部分。

The bin/start-hbase.sh script is provided as a convenient way to start HBase. Issue the command, and if all goes well, a message is logged to standard output showing that HBase started successfully. You can use the jps command to verify that you have one running process called HMaster. In standalone mode HBase runs all daemons within this single JVM, i.e. the HMaster, a single HRegionServer, and the ZooKeeper daemon. Go to http://localhost:16010 to view the HBase Web UI.

bin/start-hbase.sh脚本可以方便的启动HBase,打印信息可以看出HBase成功启动了。你可以使用 jps 命令来确认后天有一个 HMaster的进程。在 本地模式HBase在JVM中运行所有的守护进程, HMaster , HRegionServer , ZooKeeper 等进程,你可以到http://localhost:16010查看HBase的web 界面。

Procedure: Use HBase For the First Time

Connect to HBase.

Connect to your running instance of HBase using the hbase shell command, located in the bi

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值