anchor.diff:  %%%===================================================================
   %%% 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
  
positive.code: 
  -define(INIT_SCRIPT, "couchbase-server").
  -define(CLI, "LC_ALL=en_US.UTF-8 /opt/couchbase/bin/couchbase-cli").
  
  %%%===================================================================
  %%% Service behaviour callbacks
  
negative.code:     Host = hosts:self(),
      Port = onepanel_env:typed_get(couchbase_admin_port, list),
  
      ?info("Rebalancing the couchbase cluster..."),
      rebalance_cluster_with_attempts(Host, Port, User, Password, ?REBALANCE_ATTEMPTS),
  
      % Couchbase reports healthy status before it's ready to serve requests.
      % This delay provides additional margin of error before starting workers.
  