Support Questions

Find answers, ask questions, and share your expertise

how to auto start zookeeper when machine is restart

avatar
Explorer

how to auto start zookeeper when machine is restart

i can't auto start use zookeeper when ambari-server is 2.5.1.0

thanks. the DB is postgresql

11 REPLIES 11

avatar
Explorer

@Jay SenSharma

i kill the pid and the zookeeper server can auto start ,

why i stop zookeeper server and restart machine the zookeeper can't auto start ?

avatar
Master Mentor

@qiancai zhou

Please refer to the following piece of code to understand the logic:

https://github.com/apache/ambari/blob/release-2.5.1/ambari-agent/src/main/python/ambari_agent/Recove...

  def requires_recovery(self, component):
    """
    Recovery is allowed for:
    INISTALLED --> STARTED
    INIT --> INSTALLED --> STARTED
    RE-INSTALLED (if configs do not match)
    """
    if not self.enabled():
      return False


    if not self.configured_for_recovery(component):
      return False


    if component not in self.statuses:
      return False


    status = self.statuses[component]
    if self.auto_start_only or self.auto_install_start:
      if status["current"] == status["desired"]:
        return False
      if status["desired"] not in self.allowed_desired_states:
        return False
    else:
      if status["current"] == status["desired"] and status['stale_config'] == False:
        return False


    if status["desired"] not in self.allowed_desired_states or status["current"] not in self.allowed_current_states:
      return False


    logger.info("%s needs recovery, desired = %s, and current = %s.", component, status["desired"], status["current"])
    return True
    pass

.