hbase的HA搭建文件部署

hadoop高可用性集群配置(HA):
配置环境文件
hadoop-env.sh
mapred-env.sh
yarn-env.sh

export JAVA_HOME=/opt/modules/jdk


配置4个?_site.xml文件

1.========core-site.xml========


fs.defaultFS
hdfs://[node1:hostname]




hadoop.tmp.dir
/opt/modules/hadoop/data



2.=================hdfs-site.xml=============


        dfs.replication
        3
       



dfs.nameservices
[node1:hostname]




dfs.ha.namenodes.node1
nn1,nn2




dfs.namenode.rpc-address.node1.nn1
hadoop.cdh:8020



dfs.namenode.http-address.node1.nn1
hadoop.cdh:50070




dfs.namenode.rpc-address.node1.nn2
hadoop.cdh2:8020



dfs.namenode.http-address.node1.nn2
hadoop.cdh2:50070




dfs.namenode.shared.edits.dir
qjournal://hadoop.cdh:8485;hadoop.cdh2:8485;hadoop.cdh3:8485;hadoop.cdh4:8485;hadoop.cdh5:8485/node1



dfs.journalnode.edits.dir
/opt/modules/hadoop/journal




dfs.ha.fencing.methods

sshfence
shell(/bin/true)





dfs.ha.fencing.ssh.private-key-files
/home/hadoop/.ssh/id_rsa




dfs.ha.fencing.ssh.connect-timeout
30000







        dfs.permissions.enabled
        false
   



3.=============mapred-site.xml

        mapreduce.framework.name
        yarn
   



        mapreduce.jobhistory.address
        hadoop.cdh:10020
   



        mapreduce.jobhistory.webapp.address
        hadoop.cdh:19888
   



4.============yarn-site.xml
     

        
    yarn.nodemanager.aux-services
        
    mapreduce_shuffle
    






        
    yarn.log-aggregation-enable
        
    true
    






        
    yarn.log-aggregation.retain-seconds
        
    86400
    













   
    yarn.resourcemanager.ha.enabled
   
    true









   
    yarn.resourcemanager.cluster-id
   
    rmcluster










   
    yarn.resourcemanager.ha.rm-ids
   
    rm1,rm2










   
    yarn.resourcemanager.hostname.rm1
   
    hadoop.cdh










   
    yarn.resourcemanager.hostname.rm2
   
    hadoop.cdh2





======slaves
hadoop.cdh3
hadoop.cdh4
hadoop.cdh5


分发配置
$ scp etc/hadoop/core-site.xml etc/hadoop/hdfs-site.xml  hadoop.cdh2:/opt/modules/hadoop/etc/hadoop/


启动HDFS HA

1.删除data和logs目录(所有节点,有必须删掉)
$ rm -rf data logs


2.启动zk集群
$ bin/zkServer.sh start


3.启动journalnode(所有节点)
$ sbin/hadoop-daemon.sh start journalnode

3908 JournalNode
2740 QuorumPeerMain


4.格式化namenode(PC1 也就是nn1)
$ bin/hdfs namenode -format   
$ sbin/hadoop-daemon.sh start namenode


5.同步nn1的元数据(PC2 也就是nn2)
$ bin/hdfs namenode -bootstrapStandby
$ sbin/hadoop-daemon.sh start namenode




开启故障自动转移
1.配置故障转移
        =====core-site.xml

ha.zookeeper.quorum
hadoop.cdh:2181,hadoop.cdh2:2181,hadoop.cdh3:2181,hadoop.cdh4:2181,hadoop.cdh5:2181



2)====hdfs-site.xml

dfs.ha.automatic-failover.enabled
true



dfs.client.failover.proxy.provider.ns1
org.apache.hadoop.hdfs.server.namenode.ha.ConfiguredFailoverProxyProvider



2.分发配置文件
$ scp etc/hadoop/core-site.xml  etc/hadoop/hdfs-site.xml hadoop.senior02:/opt/modules/hadoop/etc/hadoop/
3.启动故障转移服务
首先停止hdfs和zk
$ sbin/stop-dfs.sh

$ bin/zkServer.sh stop ##关闭zk集群
重启
$ bin/zkServer.sh start ##启动zk集群


初始化zkfc[PC1也就是nn1]
$ bin/hdfs zkfc -formatZK  ##初始化ZKFC
        
初始化成功显示: INFO ha.ActiveStandbyElector: Successfully created /hadoop-ha/ns1 in ZK.

$ sbin/start-dfs.sh ##启动hdfs

bin/hdfs haadmin -getServiceState nn1     #查看nn1状态
bin/hdfs haadmin -getServiceState nn2     #查看nn2状态


Hbase高可用性集群配置(HA):
1##解压配置hbase(在PC01进行)
##配置hbase-env.sh

export JAVA_HOME=/opt/modules/jdk

export HBASE_MANAGES_ZK=false


2## 配置hbase-site.xml




hbase.rootdir
hdfs://hadoop.cdh/hbase



hbase.cluster.distributed
true



hbase.zookeeper.quorum
hadoop.cdh:2181,hadoop.cdh2:2181,hadoop.cdh3:2181





hbase.master
hdfs://hadoop.cdh:60000



3##配置hbase副hmaster(在hbase安装目录下的conf目录下--$HBASE_HOME/conf),新建一个名称为backup-masters的文件(固定的,必须是这个名字)
vi conf/backup-masters
hadoop.cdh2


4.##配置regionservers
hadoop.cdh3
hadoop.cdh4
hadoop.cdh5


5.拷贝$HADOOP_HOME/etc/hadoop下的core-site.xml和hdfs-site.xml文件到$HBASE_HOME/conf目录下
cp  /opt/modules/cdh/hadoop/etc/hadoop/hdfs-site.xml /opt/modules/cdh/hadoop/etc/hadoop/core-site.xml  /opt/modules/cdh/hbase/conf
**如果hadoop集群配置了多主节点,则必须要拷贝hadoop集群的core-site.xml和hdfs-site.xml这两个配置到hbase的安装目录下的conf下


6.分发配置文件
scp -r hbase/ hadoop.cdh2:/opt/modules/cdh/
scp -r hbase/ hadoop.cdh3:/opt/modules/cdh/
        scp -r hbase/ hadoop.cdh4:/opt/modules/cdh/ 
scp -r hbase/ hadoop.cdh5:/opt/modules/cdh/


7.启动hbase(PC01)---注意启动顺序:zookeeper->hadoop->hbase
## 启动zk(三台分别启动)
bin/zkServer.sh start
## 启动hadoop-dfs
sbin/start-dfs.sh;
## 启动hadoop-yarn
sbin/start-yarn.sh;
## 启动hbase(PC01)
bin/start-hbase.sh

你可能感兴趣的:(hbase的HA搭建文件部署)