anchor.diff:  
   -define(INIT_SCRIPT, "couchbase-server").
   -define(CLI, "LC_ALL=en_US.UTF-8 /opt/couchbase/bin/couchbase-cli").
  +
  +-define(REBALANCE_ATTEMPTS, 3).
  +-define(REBALANCE_ATTEMPT_INTERVAL, timer:seconds(10)).
   
   %%%===================================================================
   %%% Service behaviour callbacks
  
positive.code:     Host = hosts:self(),
      Port = onepanel_env:typed_get(couchbase_admin_port, list),
  
      Cmd = [?CLI, "rebalance", "-c", Host ++ ":" ++ Port, "-u", User],
      onepanel_shell:ensure_success(
          Cmd ++ ["-p", Password],
          Cmd ++ ["-p", "*****"]
      ),
  
      % Couchbase reports healthy status before it's ready to serve requests.
      % This delay provides additional margin of error before starting workers.
  
negative.code: %%%===================================================================
  %%% Internal functions
  %%%===================================================================
  
  %% @private
  -spec rebalance_cluster_with_attempts(string(), string(), string(), string(), non_neg_integer()) ->
      ok | no_return().
  rebalance_cluster_with_attempts(Host, Port, User, Password, AttemptsLeft) ->
      Cmd = [?CLI, "rebalance", "-c", Host ++ ":" ++ Port, "-u", User],
      try
          onepanel_shell:ensure_success(
              Cmd ++ ["-p", Password],
              Cmd ++ ["-p", "*****"]
          ),
          ?info("Successfully rebalanced the couchbase cluster")
      catch _:_ ->
          % error logging is done internally
          CurrentAttemptsLeft = AttemptsLeft - 1,
          case CurrentAttemptsLeft of
              0 ->
                  ?error("Failed to rebalance the couchbase cluster - no attempts left"),
                  error(failed_to_rebalance_couchbase_cluster);
              _ ->
                  ?info("Retrying couchbase cluster rebalance - ~B attempts left...", [CurrentAttemptsLeft]),
                  timer:sleep(?REBALANCE_ATTEMPT_INTERVAL),
                  rebalance_cluster_with_attempts(Host, Port, User, Password, CurrentAttemptsLeft)
          end
      end.
  
  
  %%--------------------------------------------------------------------
  %% @private @doc
  