zoukankan      html  css  js  c++  java
  • hbase搭建伪分布式集群

    在单机集成的基础上继续。

    下载hadoop 解压,修改hadoop-env.sh java的HOME地址

    我的目录在: /root/hadoop-2.9.1/etc/hadoop

     一个单机伪分布式的hadoop会在一个机器把所需要的进程分别启动,搭建步骤如下:

    编辑etc/hadoop/core-site.xml

    <configuration>     
    <property>         
    <name>fs.defaultFS</name>         
    <value>hdfs://localhost:9000</value>     
    </property>
    </configuration>

    编辑etc/hadoop/hdfs-site.xml文件

    <configuration>     
    <property>         
    <name>dfs.replication</name>         
    <value>1</value>     
    </property> 
    </configuration>

    接着需要设置本机的ssh免密码登录

     ssh-keygen -t rsa

     cd /root/.ssh/

    chmod 0600 authorized_keys 

    都配置完毕之后,正式开始启动单机伪分布式hadoop集群

    $ bin/hdfs namenode -format

    $ sbin/start-dfs.sh

    http://192.168.31.117:50070/dfshealth.html#tab-overview

    接着需要编辑hbase的配置文件:hbase-site.xml,让hbase用分布式模式启动,也就是说把每个组件都用单独的进程来启动,同时需要修改hbase数据存储地址为指向hdfs,同时把hbase.unsafe.stream.capability.enforce这个配置设置为true

    更改后:

    <?xml version="1.0"?>
    <?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
    <!--
    /*
     * 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.
     */
    -->
    <configuration>

    <property>  

    <name>hbase.cluster.distributed</name>  

    <value>true</value>

    </property>

    <property>  

    <name>hbase.rootdir</name>  

    <value>hdfs://localhost:9000/hbase</value>

    </property>

    <property>  

    <name>hbase.unsafe.stream.capability.enforce</name>  

    <value>true</value>

    </property>

    </configuration>

    接着重新启动hbase,bin/start-hbase.sh,启动之后用jps就可以看到HMaster和HRegionServer进程都是独立在运行了

    同时可以检查hbase是否在hdfs上建立了自己需要的所有目录,./bin/hadoop fs -ls /hbase

    接着用下面的命令可以在hbase里创建一个表,然后在里面做一些数据的增删改查操作,检查一下基于hdfs存储数据的hbase是否一切运行正常

     我们创建的表在default的test里面

    点进去里面的test,cf是列族

     我们发现建表后立马能在hdfs看到目录,每个列族都有对应目录,列数据单独存放,插入一行数据没有显示。

    HMaster是用于控制整个hbase集群的,包括所有的HRegionServer,所以必须要做成高可用的,HMaster是可以启动多个的,用下面的命令就可以启动多个HMaster进程,意思是16002/16012格式的端口号后面的数字

     . local-master-backup.sh start 2 3 5  (启动了几个?)

     后面的数字:2 是16002-1012,3是16003-16013,4是16004-16014,一共可以9个备用的hmaster

    干掉端口末尾为2的端口

    cat /tmp/hbase-root-2-master.pid |xargs kill -9

    本文来自博客园,作者:三号小玩家,转载请注明原文链接:https://www.cnblogs.com/q1359720840/p/15732779.html

  • 相关阅读:
    GdiPlus[34]: IGPGraphicsPath (一)
    GdiPlus[33]: 基本绘图与填充命令
    GdiPlus[29]: IGPPen: 虚线样式
    [征询意见]博客园logo
    [公告]网站恢复正常运行
    [公告]博客园将与博文视点合作推出一系列.NET图书
    [公告]由Bruce Zhang负责博客园的出书工作
    通过Windows Live Alerts订阅博客园首页RSS
    [征询意见]博客园新logo
    [新功能]新闻管理
  • 原文地址:https://www.cnblogs.com/q1359720840/p/15732779.html
Copyright © 2011-2022 走看看