• 虚拟机zookeeper和hbase集群搭建


    集群zookeeper

    dataDir=/usr/local/zookeeper/dataDir
    dataLogDir=/usr/local/zookeeper/dataLogDir
    # the port at which the clients will connect
    clientPort=2181
    # master
    server.1=sjck-node01:2888:3888
    server.2=sjck-node02:2888:3888
    server.3=sjck-node03:2888:3888
    

    myid

    [root@sjck-node01 dataDir]# cat /usr/local/zookeeper/dataDir/myid 
    1
    [root@sjck-node02 dataDir]# cat /usr/local/zookeeper/dataDir/myid 
    2
    [root@sjck-node03 dataDir]# cat /usr/local/zookeeper/dataDir/myid 
    3
    

    环境配置

    export ZK_HOME=/usr/local/zookeeper
    export PATH=$PATH:$ZK_HOME/bin
    
    source  /etc/profile
    

    集群启动,在每台机子上都执行

    /usr/local/zookeeper/bin/zkServer.sh start
    /usr/local/zookeeper/bin/zkServer.sh stop
    

    查看集群状态

    [root@sjck-node01 dataDir]# /usr/local/zookeeper/bin/zkServer.sh status
    ZooKeeper JMX enabled by default
    Using config: /usr/local/zookeeper/bin/../conf/zoo.cfg
    Mode: follower
    [root@sjck-node02 dataDir]# /usr/local/zookeeper/bin/zkServer.sh status
    ZooKeeper JMX enabled by default
    Using config: /usr/local/zookeeper/bin/../conf/zoo.cfg
    Mode: follower
    [root@sjck-node03 dataDir]# /usr/local/zookeeper/bin/zkServer.sh status
    ZooKeeper JMX enabled by default
    Using config: /usr/local/zookeeper/bin/../conf/zoo.cfg
    Mode: leader
    

    hbase环境配置

    export HBASE_HOME=/usr/local/hbase
    export PATH=$PATH:$HBASE_HOME/bin
    
    source  /etc/profile
    

    查看版本

    [root@sjck-node01 hbase]# hbase version
    HBase 1.3.1
    Source code repository git://mantonov-mbp1/Users/mantonov/hbase revision=930b9a55528fe45d8edce7af42fef2d35e77677a
    Compiled by mantonov on Thu Apr  6 19:36:54 PDT 2017
    From source with checksum a34b810bed77b3a56af797405bea7c78
    

    hbase-env.sh

    export JAVA_HOME=/usr/local/src/jdk/jdk1.8
    export HBASE_MANAGES_ZK=false
    export HADOOP_HOME=/usr/local/hadoop
    export HBASE_HOME=/usr/local/hbase
    export HBASE_CLASSPATH=/usr/local/hadoop/etc/hadoop/
    

    hbase-site.xml

    <configuration>
        <property>
            <name>hbase.rootdir</name>
            <value>hdfs://sjck-node01:9000/hbase</value>
        </property>
        <property>
            <name>hbase.master</name>
            <value>sjck-node01:60000</value>
        </property>
        <property>
            <name>hbase.cluster.distributed</name>
            <value>true</value>
        </property>
        <property>
            <name>hbase.zookeeper.property.clientPort</name>
            <value>2181</value>
        </property>
        <property>
            <name>hbase.zookeeper.quorum</name>
            <value>sjck-node01,sjck-node02,sjck-node03</value>
        </property>
        <property>
            <name>zookeeper.session.timeout</name>
            <value>120000</value>
        </property>
        <property>
            <name>dfs.support.append</name>
            <value>true</value>
        </property>
    </configuration>
    

    regionservers

    sjck-node02
    sjck-node03
    

    master启动hbase

    start-hbase.sh
    stop-hbase.sh
    

    集群启动状态,主节点是HMaster,其余是HRegionServer

    [root@sjck-node01 bin]# jps
    3104 NameNode
    3893 HMaster
    4133 Jps
    3273 SecondaryNameNode
    3739 QuorumPeerMain
    3455 ResourceManager
    [root@sjck-node02 local]# jps
    3157 DataNode
    3477 HRegionServer
    3270 NodeManager
    3403 QuorumPeerMain
    3679 Jps
    [root@sjck-node03 local]# jps
    3731 HRegionServer
    3923 Jps
    3399 DataNode
    3656 QuorumPeerMain
    3517 NodeManager
    

    web管理页面

    http://172.16.92.128:16010/master-status

    hbase shell

    [root@sjck-node01 bin]# hbase shell
    SLF4J: Class path contains multiple SLF4J bindings.
    SLF4J: Found binding in [jar:file:/usr/local/hbase/lib/slf4j-log4j12-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]
    hbase(main):001:0> 
    
  • 相关阅读:
    get请求中文乱码及get,post编码探究
    spring使用redis做缓存
    tomcat中session在两个webapp中实现共享
    JDK8 HashMap 源码解析
    Windows Apache服务器配置
    怎么使用IDEA
    面试中的Java链表
    设计模式解密(12)- 桥接模式
    Caused by: org.apache.catalina.LifecycleException: A child container failed during start
    设计模式解密(11)- 命令模式
  • 原文地址:https://www.cnblogs.com/wanli002/p/10706816.html
Copyright © 2020-2023  润新知