ty9919 发表于 2019-1-8 10:33:54

namenode ha by zookeeper

  tickTime=2000
  initLimit=10
  syncLimit=5
  clientPort=2181
  dataDir=/home/tim/zkdata
  server.1=tim-dn1:2888:3888
  server.2=tim-dn2:2888:3888
  server.3=tim-dn3:2888:3888
  

  

  

  core-site.xml
  
  
  
  fs.defaultFS
  hdfs://mycluster
  
  
  

  hdfs-site.xml
  tim@tim-dn2:~/hadoop/etc/hadoop$ cat hdfs-site.xml
  
  
  
  

  
  

  
  
  dfs.replication
  3
  
  
  dfs.nameservices
  mycluster
  
  
  dfs.ha.namenodes.mycluster
  nn1,nn2
  
  
  dfs.namenode.rpc-address.mycluster.nn1
  tim-nn:8020
  
  
  dfs.namenode.rpc-address.mycluster.nn2
  tim-2nn:8020
  
  
  dfs.namenode.http-address.mycluster.nn1
  tim-nn:50070
  
  
  dfs.namenode.http-address.mycluster.nn2
  tim-2nn:50070
  
  
  dfs.namenode.shared.edits.dir
  qjournal://tim-nn:8485;tim-2nn:8485/mycluster
  
  
  dfs.client.failover.proxy.provider.mycluster
  org.apache.hadoop.hdfs.server.namenode.ha.ConfiguredFailoverProxyProvider
  
  
  
  dfs.journalnode.edits.dir
  /home/tim/hadoop/journal
  
  
  停掉hdfs集群后
启用自动容灾
hdfs-site

   dfs.ha.automatic-failover.enabled
   true
his specifies that the cluster should be set up for automatic failover. In your core-site.xml file, add:

   ha.zookeeper.quorum
   zk1.example.com:2181,zk2.example.com:2181,zk3.example.com:2181
  

  

  tim@tim-dn2:~/hadoop/etc/hadoop$ nano core-site.xml
  

  GNU nano 2.5.3                                           File: core-site.xml                                                                                 Modified
  

  -->
  

  
  

  
  
  
  fs.defaultFS
  hdfs://mycluster
  
  
  ha.zookeeper.quorum
  tim-dn1:2181,tim-dn2:2181,tim-dn3:2181
  
  
  

  

  

  启动zk集群后
  tim@tim-nn:~$ hdfs zkfc -formatZK
  用于在zk集群创建/hadoop-ha/mycluster目录



页: [1]
查看完整版本: namenode ha by zookeeper