暗能星系

    • 登录
    • 搜索

    Hbase 集群安装和部署

    大数据
    1
    5
    23
    正在加载更多帖子
    • 从旧到新
    • 从新到旧
    • 最多赞同
    回复
    • 在新帖中回复
    登录后回复
    此主题已被删除。只有拥有主题管理权限的用户可以查看。
    • A
      anneng 最后由 anneng 编辑

      1.配置免密登录
      参考http://an.forum.genostack.com/topic/256/hdfs-%E5%AE%89%E8%A3%85%E5%92%8C%E9%83%A8%E7%BD%B2/8

      2.下载安装 下载最新的stable版本
      HBASE依赖HDFS 需要先安装和配置HDFS
      wget https://mirrors.tuna.tsinghua.edu.cn/apache/hbase/stable/hbase-2.3.4-bin.tar.gz
      sudo tar -zxvf hbase-2.3.4-bin.tar.gz
      cd hbase-2.3.4
      whereis java
      修改conf/hbase-env.sh 配置java目录
      export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-amd64/

      3.配置
      vi conf/regionservers
      master
      slave1

      zookeeper conf/hbase-site.xml
      <property>
      <name>hbase.cluster.distributed</name>
      <value>true</value>
      </property>
      <property>
      <name>hbase.rootdir</name>
      <value>hdfs://master:7000/hbase</value>
      </property>
      <property>
      <name>hbase.zookeeper.quorum</name>
      <value>master,slave1</value>
      </property>
      <property>
      <name>hbase.zookeeper.property.dataDir</name>
      <value>/opt/hadoop/zookeeper_dir</value>
      </property>

      4.启动
      bin/start-hbase.sh
      sudo jps 检查 Hmaster HRegionServer HQuorumPeer是否正常
      50497 SecondaryNameNode
      37969 Jps
      50018 DataNode
      36676 HMaster
      37270 HRegionServer
      49724 NameNode
      36350 HQuorumPeer

      1 条回复 最后回复 回复 引用 0
      • A
        anneng 最后由 编辑

        基本操作

        Connect to HBase.

        Connect to your running instance of HBase using the hbase shell command, located in the bin/ directory of your HBase install. In this example, some usage and version information that is printed when you start HBase Shell has been omitted. The HBase Shell prompt ends with a > character.

        $ ./bin/hbase shell
        hbase(main):001:0>
        Display HBase Shell Help Text.

        Type help and press Enter, to display some basic usage information for HBase Shell, as well as several example commands. Notice that table names, rows, columns all must be enclosed in quote characters.

        Create a table.

        Use the create command to create a new table. You must specify the table name and the ColumnFamily name.

        hbase(main):001:0> create 'test', 'cf'
        0 row(s) in 0.4170 seconds
        

        => Hbase::Table - test
        List Information About your Table

        Use the list command to confirm your table exists

        hbase(main):002:0> list 'test'
        TABLE
        test
        1 row(s) in 0.0180 seconds
        

        => ["test"]
        Now use the describe command to see details, including configuration defaults

        hbase(main):003:0> describe 'test'
        Table test is ENABLED
        test
        COLUMN FAMILIES DESCRIPTION
        {NAME => 'cf', VERSIONS => '1', EVICT_BLOCKS_ON_CLOSE => 'false', NEW_VERSION_BEHAVIOR => 'false', KEEP_DELETED_CELLS => 'FALSE', CACHE_DATA_ON_WRITE =>
        'false', DATA_BLOCK_ENCODING => 'NONE', TTL => 'FOREVER', MIN_VERSIONS => '0', REPLICATION_SCOPE => '0', BLOOMFILTER => 'ROW', CACHE_INDEX_ON_WRITE => 'f
        alse', IN_MEMORY => 'false', CACHE_BLOOMS_ON_WRITE => 'false', PREFETCH_BLOCKS_ON_OPEN => 'false', COMPRESSION => 'NONE', BLOCKCACHE => 'true', BLOCKSIZE
         => '65536'}
        1 row(s)
        Took 0.9998 seconds
        

        Put data into your table.

        To put data into your table, use the put command.

        hbase(main):003:0> put 'test', 'row1', 'cf:a', 'value1'
        0 row(s) in 0.0850 seconds
        
        hbase(main):004:0> put 'test', 'row2', 'cf:b', 'value2'
        0 row(s) in 0.0110 seconds
        
        hbase(main):005:0> put 'test', 'row3', 'cf:c', 'value3'
        0 row(s) in 0.0100 seconds
        

        Here, we insert three values, one at a time. The first insert is at row1, column cf:a, with a value of value1. Columns in HBase are comprised of a column family prefix, cf in this example, followed by a colon and then a column qualifier suffix, a in this case.

        Scan the table for all data at once.

        One of the ways to get data from HBase is to scan. Use the scan command to scan the table for data. You can limit your scan, but for now, all data is fetched.

        hbase(main):006:0> scan 'test'
        ROW                                      COLUMN+CELL
         row1                                    column=cf:a, timestamp=1421762485768, value=value1
         row2                                    column=cf:b, timestamp=1421762491785, value=value2
         row3                                    column=cf:c, timestamp=1421762496210, value=value3
        3 row(s) in 0.0230 seconds
        

        Get a single row of data.

        To get a single row of data at a time, use the get command.

        hbase(main):007:0> get 'test', 'row1'
        COLUMN                                   CELL
         cf:a                                    timestamp=1421762485768, value=value1
        1 row(s) in 0.0350 seconds
        Disable a table.
        

        If you want to delete a table or change its settings, as well as in some other situations, you need to disable the table first, using the disable command. You can re-enable it using the enable command.

        hbase(main):008:0> disable 'test'
        0 row(s) in 1.1820 seconds
        
        hbase(main):009:0> enable 'test'
        0 row(s) in 0.1770 seconds
        

        Disable the table again if you tested the enable command above:

        hbase(main):010:0> disable 'test'
        0 row(s) in 1.1820 seconds
        

        Drop the table.

        To drop (delete) a table, use the drop command.

        hbase(main):011:0> drop 'test'
        0 row(s) in 0.1370 seconds
        

        Exit the HBase Shell.

        To exit the HBase Shell and disconnect from your cluster, use the quit command. HBase is still running in the background.

        1 条回复 最后回复 回复 引用 0
        • A
          anneng 最后由 anneng 编辑

          启动rest服务

          Foreground

          $ bin/hbase rest start -p 7777

          Background, logging to a file in $HBASE_LOGS_DIR

          $ bin/hbase-daemon.sh start rest -p 7777

          $ bin/hbase-daemon.sh stop rest
          以下示例使用占位符服务器http://example.com:8000,并且可以使用curl或wget命令运行以下命令。您可以通过不为纯文本添加头信息来请求纯文本(默认),XML或JSON输出,或者为XML添加头信息“Accept:text / xml”,为JSON添加“Accept:application / json”或为协议缓冲区添加“Accept: application/x-protobuf”。
          curl -vi -X GET -H "Accept:application / json" "http://192.168.1.2:7777/nt/schema“

          1 条回复 最后回复 回复 引用 0
          • A
            anneng 最后由 编辑

            web地址:
            http://103.114.101.5:16010
            可以查看系统信息

            1 条回复 最后回复 回复 引用 0
            • A
              anneng 最后由 编辑

              final 字段的含义
              Configuration parameters may be declared final. Once a resource declares a value final, no subsequently-loaded resource can alter that value

              1 条回复 最后回复 回复 引用 0
              • First post
                Last post
              Powered by 暗能星系