当前位置:   article > 正文

Hbase本地模式、伪分布模式、全分布模式、HA的搭建_doop集群可以运行的3个模式是() a. 本地模式 b. 伪分布模式 c. 全分布模式 d. 离

doop集群可以运行的3个模式是() a. 本地模式 b. 伪分布模式 c. 全分布模式 d. 离

一、搭建HBase本地模式

 

解压:                                                                                              

tar -zxvf hbase-1.3.1-bin.tar.gz -C ~/training/                                                               

设置环境变量  vi ~/.bash_profile                                                                                    

 HBASE_HOME=/root/training/hbase-1.3.1                                                                        

 export HBASE_HOME                                                                                                                                                                                  

PATH=$HBASE_HOME/bin:$PATH                                                                                   

 export PATH      

生效环境变量                                                                                            

 source ~/.bash_profile                                                                                       

                                                                                                              

由于本地模式:不需要HDFS,保存在Linux的文件系统                                                                                

    在bigdata11上配置                                                                                              

                                                                                                            

建个目录: mkdir data                                                                                            

修改文件:conf/hbase-env.sh                                                                                      

export JAVA_HOME=/root/training/jdk1.8.0_144                                                              

                                                                                                            

核心配置文件:  conf/hbase-site.xml                                                                                

<property>                                                                                                

  <name>hbase.rootdir</name>                                                                              

  <value>file:///root/training/hbase-1.3.1/data</value>                                                   

</property>                                                                                               

                                                                                                              

启动HBase:start-hbase.sh                                                                                      

starting master, logging to /root/training/hbase-1.3.1/logs/hbase-root-master-bigdata11.out                

只有HMaster ,没有RegionServer                                                                                          

                                                                                                              

                                                                                                            

2、伪分布模式(bigdata11)                                                                                           

修改文件:hbase-env.sh                                                                                           

HBASE_MANAGES_ZK =true     ## 使用HBase自带的ZK                                                                 

                                                                                                          

核心配置文件:  conf/hbase-site.xml                                                                                                                                                                                        

<!--HBase的数据保存在HDFS对应目录-->                                                                                

<property>                                                                                                

  <name>hbase.rootdir</name>                                                                              

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

</property>                                                                                               

                                                                                                              

<!--是否是分布式环境-->                                                                                           

<property>                                                                                                

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

  <value>true</value>                                                                                     

</property>                                                                                           

                                                                                                              

<!--配置ZK的地址-->                                                                                            

<property>                                                                                                

  <name>hbase.zookeeper.quorum</name>                                                                     

  <value>192.168.100.11</value>                                                                          

</property>                                                                                         

                                                                                                              

<!--冗余度-->                                                                                                

<property>                                                                                                

  <name>dfs.replication</name>                                                                            

  <value>1</value>                                                                                        

</property>                                                                                               

                                                                                                          

文件regionservers:配置从节点地址                                                                                     

bigdata11                                                                                          

启动Hbase

在HDFS上查看自动生成的hbase目录

 

用网页的方式查看Hbase

192.168.100.11:16010

 

创建’emp’表

create 'emp','depto','ename','job'  

查看表结构  describe 'emp'

或者通过网页查看

                                                                                                          

3、全分布模式:

在bigdata12 、 bigdata13 、 bigdata14  上搭建                                                                   

      解压:tar -zxvf hbase-1.3.1-bin.tar.gz -C /root/training/

                                                                                                        

修改文件:hbase-env.sh                                                                                           

export JAVA_HOME=/root/training/jdk1.8.0_144                                                              

HBASE_MANAGES_ZK true  ---> 使用HBase自带的ZK                                                                 

                                                                                                              

核心配置文件:  conf/hbase-site.xml                                                                                

                                                                                                            

<!--HBase的数据保存在HDFS对应目录-->                                                                                

<property>                                                                                                

  <name>hbase.rootdir</name>                                                                              

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

</property>                                                                                               

                                                                                                              

<!--是否是分布式环境-->                                                                                           

<property>                                                                                                

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

  <value>true</value>                                                                                     

</property>                                                                                           

                                                                                                              

<!--配置ZK的地址-->                                                                                            

<property>                                                                                                

  <name>hbase.zookeeper.quorum</name>                                                                     

  <value>192.168.100.12</value>                                                                          

</property>                                                                                         

                                                                                                              

<!--冗余度-->                                                                                                

<property>                                                                                                

  <name>dfs.replication</name>                                                                            

  <value>2</value>                                                                                        

</property>                                                                                               

                                                                                                              

<!--主节点和从节点允许的最大时间误差-->                                                                                   

<property>                                                                                                

  <name>hbase.master.maxclockskew</name>                                                                  

  <value>180000</value>                                                                                   

</property>                                                                                               

                                                                                                          

文件regionservers:配置从节点地址                                                                                     

192.168.100.13                                                                                           

192.168.100.14                                                                                           

                                                                                                          

复制到其他节点上                                                                                                    

scp -r /root/training/hbase-1.3.1/ root@bigdata13:/root/training                                                        

scp -r /root/training/hbase-1.3.1/ root@bigdata14:/root/training                                                        

启动 Hbase集群

 通过Web Console查看

                                                                                                                                                     4、 Hbase HA 的实现               

在bigdata13再手动启动一个HMaster                                                                                   

hbase-daemon.sh start master                                                                               

     

查看网页状态

bigdata13是Buckup Master

bigdata12是Master

 

把bigdata12的Master   kill掉,然后查看bigdata13的状态,发现已经自动切换到Master状态

                                                                                                         

                                                                                      

 

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/盐析白兔/article/detail/621830
推荐阅读
相关标签
  

闽ICP备14008679号