Hadoop2.7实战v1.0之HDFS HA

简介: HDFS HA实战v1.0 当前环境:hadoop+zookeeper(namenode,resourcemanager HA)  namenode  serviceId ...

HDFS HA实战v1.0


当前环境: hadoop+zookeeper(namenode,resourcemanager HA)
 namenode  serviceId  Init status
 sht-sgmhadoopnn-01  nn1  active
 sht-sgmhadoopnn-02  nn2  standby

参考: http://blog.csdn.net/u011414200/article/details/50336735

.查看namenodeactive还是standby

1.打开网页


2.查看zkfc日志 

点击(此处)折叠或打开

  1. [root@sht-sgmhadoopnn-01 logs]# more hadoop-root-zkfc-sht-sgmhadoopnn-01.telenav.cn.log

  2. …………………..

  3. 2016-02-28 00:24:00,692 INFO org.apache.hadoop.ha.ZKFailoverController: Trying to make NameNode at sht-sgmhadoopnn-01/172.16.101.55:8020 active...

  4. 2016-02-28 00:24:01,762 INFO org.apache.hadoop.ha.ZKFailoverController: Successfully transitioned NameNode at sht-sgmhadoopnn-01/172.16.101.55:8020 to active state
  5.  

  6. [root@sht-sgmhadoopnn-02 logs]# more hadoop-root-zkfc-sht-sgmhadoopnn-01.telenav.cn.log

  7. …………………..

  8. 2016-02-28 00:24:01,186 INFO org.apache.hadoop.ha.ZKFailoverController: ZK Election indicated that NameNode at sht-sgmhadoopnn-02/172.16.101.56:8020 should become standby

  9. 2016-02-28 00:24:01,209 INFO org.apache.hadoop.ha.ZKFailoverController: Successfully transitioned NameNode at sht-sgmhadoopnn-02/172.16.101.56:8020 to standby state


 3. 通过命令hdfs haadmin –getServiceState      

###$HADOOP_HOME/etc/hadoop/hdfs-site.xml, dfs.ha.namenodes.[dfs.nameservices]

               

                                <!--设置NameNode IDs 此版本最大只支持两个NameNode -->

                                dfs.ha.namenodes.mycluster

                                nn1,nn2

               


 

点击(此处)折叠或打开

  1. [root@sht-sgmhadoopnn-02 logs]# hdfs haadmin -getServiceState nn1

  2. active

  3.  [root@sht-sgmhadoopnn-02 logs]# hdfs haadmin -getServiceState nn2

  4. standby
 

.基本命令

点击(此处)折叠或打开

[root@sht-sgmhadoopnn-02 logs]# hdfs --help

Usage: hdfs [--config confdir] [--loglevel loglevel] COMMAND

       where COMMAND is one of:

  dfs run a filesystem command on the file systems supported in Hadoop.

  classpath prints the classpath

  namenode -format format the DFS filesystem

  secondarynamenode run the DFS secondary namenode

  namenode run the DFS namenode

  journalnode run the DFS journalnode

  zkfc run the ZK Failover Controller daemon

  datanode run a DFS datanode

  dfsadmin run a DFS admin client

  haadmin run a DFS HA admin client

  fsck run a DFS filesystem checking utility

  balancer run a cluster balancing utility

  jmxget get JMX exported values from NameNode or DataNode.

  mover run a utility to move block replicas across

                               storage types

  oiv apply the offline fsimage viewer to an fsimage

  oiv_legacy apply the offline fsimage viewer to an legacy fsimage

  oev apply the offline edits viewer to an edits file

  fetchdt fetch a delegation token from the NameNode

  getconf get config values from configuration

  groups get the groups which users belong to

  snapshotDiff diff two snapshots of a directory or diff the

                       current directory contents with a snapshot

  lsSnapshottableDir list all snapshottable dirs owned by the current user

                                                Use -help to see options

  portmap run a portmap service

  nfs3 run an NFS version 3 gateway

  cacheadmin configure the HDFS cache

  crypto configure HDFS encryption zones

  storagepolicies list/get/set block storage policies

  version print the version

###########################################################################

[root@sht-sgmhadoopnn-02 logs]# hdfs namenode --help

Usage: java NameNode [-backup] |

        [-checkpoint] |

        [-format [-clusterid cid ] [-force] [-nonInteractive] ] |

        [-upgrade [-clusterid cid] [-renameReserved<k-v pairs>] ] |

        [-upgradeOnly [-clusterid cid] [-renameReserved<k-v pairs>] ] |

        [-rollback] |

        [-rollingUpgrade <rollback|downgrade|started> ] |

        [-finalize] |

        [-importCheckpoint] |

        [-initializeSharedEdits] |

        [-bootstrapStandby] |

        [-recover [ -force] ] |

        [-metadataVersion ] ]




###########################################################################

[root@sht-sgmhadoopnn-02 logs]# hdfs haadmin --help

-help: Unknown command

Usage: haadmin

    [-transitionToActive [--forceactive] <serviceId>]

    [-transitionToStandby <serviceId>]

    [-failover [--forcefence] [--forceactive] <serviceId> <serviceId>]

    [-getServiceState <serviceId>]

    [-checkHealth <serviceId>]

    [-help <command>]
transitionToActive  

  

 



 

  
































  1.  












 

   















  1.  













   




























  1.  











目录
相关文章
|
1月前
|
分布式计算 Kubernetes Hadoop
大数据-82 Spark 集群模式启动、集群架构、集群管理器 Spark的HelloWorld + Hadoop + HDFS
大数据-82 Spark 集群模式启动、集群架构、集群管理器 Spark的HelloWorld + Hadoop + HDFS
129 6
|
1月前
|
SQL 分布式计算 监控
Hadoop-20 Flume 采集数据双写至本地+HDFS中 监控目录变化 3个Agent MemoryChannel Source对比
Hadoop-20 Flume 采集数据双写至本地+HDFS中 监控目录变化 3个Agent MemoryChannel Source对比
59 3
|
1月前
|
SQL 分布式计算 Hadoop
Hadoop-14-Hive HQL学习与测试 表连接查询 HDFS数据导入导出等操作 逻辑运算 函数查询 全表查询 WHERE GROUP BY ORDER BY(一)
Hadoop-14-Hive HQL学习与测试 表连接查询 HDFS数据导入导出等操作 逻辑运算 函数查询 全表查询 WHERE GROUP BY ORDER BY(一)
31 4
|
1月前
|
SQL 分布式计算 Hadoop
Hadoop-19 Flume Agent批量采集数据到HDFS集群 监听Hive的日志 操作则把记录写入到HDFS 方便后续分析
Hadoop-19 Flume Agent批量采集数据到HDFS集群 监听Hive的日志 操作则把记录写入到HDFS 方便后续分析
42 2
|
1月前
|
SQL 分布式计算 关系型数据库
Hadoop-24 Sqoop迁移 MySQL到Hive 与 Hive到MySQL SQL生成数据 HDFS集群 Sqoop import jdbc ETL MapReduce
Hadoop-24 Sqoop迁移 MySQL到Hive 与 Hive到MySQL SQL生成数据 HDFS集群 Sqoop import jdbc ETL MapReduce
79 0
|
1月前
|
SQL 分布式计算 关系型数据库
Hadoop-23 Sqoop 数据MySQL到HDFS(部分) SQL生成数据 HDFS集群 Sqoop import jdbc ETL MapReduce
Hadoop-23 Sqoop 数据MySQL到HDFS(部分) SQL生成数据 HDFS集群 Sqoop import jdbc ETL MapReduce
34 0
|
1月前
|
SQL 分布式计算 关系型数据库
Hadoop-22 Sqoop 数据MySQL到HDFS(全量) SQL生成数据 HDFS集群 Sqoop import jdbc ETL MapReduce
Hadoop-22 Sqoop 数据MySQL到HDFS(全量) SQL生成数据 HDFS集群 Sqoop import jdbc ETL MapReduce
44 0
|
1月前
|
存储 分布式计算 资源调度
大数据-04-Hadoop集群 集群群起 NameNode/DataNode启动 3台公网云 ResourceManager Yarn HDFS 集群启动 UI可视化查看 YarnUI(一)
大数据-04-Hadoop集群 集群群起 NameNode/DataNode启动 3台公网云 ResourceManager Yarn HDFS 集群启动 UI可视化查看 YarnUI(一)
71 5
|
1月前
|
资源调度 数据可视化 大数据
大数据-04-Hadoop集群 集群群起 NameNode/DataNode启动 3台公网云 ResourceManager Yarn HDFS 集群启动 UI可视化查看 YarnUI(二)
大数据-04-Hadoop集群 集群群起 NameNode/DataNode启动 3台公网云 ResourceManager Yarn HDFS 集群启动 UI可视化查看 YarnUI(二)
34 4
|
1月前
|
XML 分布式计算 资源调度
大数据-02-Hadoop集群 XML配置 超详细 core-site.xml hdfs-site.xml 3节点云服务器 2C4G HDFS Yarn MapRedece(一)
大数据-02-Hadoop集群 XML配置 超详细 core-site.xml hdfs-site.xml 3节点云服务器 2C4G HDFS Yarn MapRedece(一)
134 5