AppController/djinn.rb
# Updates the file that says where all the ZooKeeper nodes are
# located so that this node has the most up-to-date info if it needs to
# restore the data down the line.
Updates the file that says where all the ZooKeeper nodes are
located so that this node has the most up-to-date info if it needs to
restore the data down the line.
Updates the file that says where all the ZooKeeper nodes are located so that this node has the most up - to - date info if it needs to restore the data down the line .
def write_zookeeper_locations()
    zookeeper_data = { 'last_updated_at' => @last_updated,
      'locations' => []
    }
    @nodes.each { |node|
      if node.is_zookeeper?
        unless zookeeper_data['locations'].include? node.private_ip
          zookeeper_data['locations'] << node.private_ip
        end
      end
    }
    zookeeper_data['locations'].sort!
    if zookeeper_data['locations'] != @zookeeper_data
      HelperFunctions.write_json_file(ZK_LOCATIONS_FILE, zookeeper_data)
      @zookeeper_data = zookeeper_data['locations']
      Djinn.log_debug("write_zookeeper_locations: updated list of zookeeper servers")
    end
  end
def write_zookeeper_locations ( ) zookeeper_data = { 'last_updated_at' => @last_updated , 'locations' => [ ] } @nodes . each { | node | if node . is_zookeeper? unless zookeeper_data [ 'locations' ] . include? node . private_ip zookeeper_data [ 'locations' ] << node . private_ip end end } zookeeper_data [ 'locations' ] . sort! if zookeeper_data [ 'locations' ] != @zookeeper_data HelperFunctions . write_json_file ( ZK_LOCATIONS_FILE , zookeeper_data ) @zookeeper_data = zookeeper_data [ 'locations' ] Djinn . log_debug ( "write_zookeeper_locations: updated list of zookeeper servers" ) end end
Updates the file that says where all the ZooKeeper nodes are
located so that this node has the most up-to-date info if it needs to
restore the data down the line.
Updates the file that says where all the ZooKeeper nodes are located so that this node has the most up - to - date info if it needs to restore the data down the line .
# Let's see if it changed since last time we got the list. # Save the latest list of zookeeper nodes: needed to restart the # deployment.