anchor.diff:              {ok, Host};
           _:Reason ->
               ?error_stacktrace("Cannot join database cluster: ~p", [Reason]),
  +            {error, Host}
  +    end.
  +
  +
  +%% init_cluster/1
  +%% ====================================================================
  +%% @doc Init database cluster. ClusterHost is one of current
  +%% database cluster hosts.
  +%% @end
  +-spec init_cluster(ClusterHost :: string()) -> Result when
  +    Result :: {ok, Host :: string()} | {error, Host :: string()}.
  +%% ====================================================================
  +init_cluster(ClusterHost) ->
  +    Host = onepanel_utils:get_host(node()),
  +    try
  +        catch memsup:start_link(),
  +        {_, Mem} = proplists:lookup(system_total_memory, memsup:get_system_memory_data()),
  +        MemMB = erlang:round(Mem / 1024 / 1024),
  +        MemToAllocate = erlang:round(MemMB / 2),
  +
  +        InitCommand = "/opt/couchbase/couchbase-cli cluster-init -c " ++ ClusterHost ++ ":8091 --cluster-init-username=admin" ++
  +            " --cluster-init-password=" ++ ?COUCHBASE_PASSWORD ++ " --cluster-init-ramsize=" ++ integer_to_list(MemToAllocate) ++
  +            " 1>/dev/null 2>&1 ; echo -n $?",
  +        ?info("Running couchbase command ~p", [InitCommand]),
  +        "0" = os:cmd(InitCommand),
  +
  +        BucketCommand = "/opt/couchbase/couchbase-cli bucket-create -c " ++ ClusterHost ++ ":8091" ++
  +            " -u admin -p " ++ ?COUCHBASE_PASSWORD ++ " --bucket=default --bucket-ramsize=" ++ integer_to_list(MemToAllocate) ++
  +            " 1>/dev/null 2>&1 ; echo -n $?",
  +        ?info("Running couchbase command ~p", [BucketCommand]),
  +        "0" = os:cmd(BucketCommand),
  +
  +        {ok, Host}
  +    catch
  +        _:Reason ->
  +            ?error_stacktrace("Cannot init database cluster: ~p", [Reason]),
               {error, Host}
       end.
   
  
positive.code:         ok = installer_utils:overwrite_config_args(?DB_CONFIG,
              <<"listener.protobuf.internal = ">>, <<"[^\n]*">>, <<"0.0.0.0:8087">>),
  
          "0" = os:cmd("riak start 1>/dev/null 2>&1 ; echo -n $?"),
          ok = wait_until("riak ping 1>/dev/null 2>&1 ; echo -n $?", "0"),
  
          {ok, Host}
      catch
  
negative.code:     try
          ?debug("Stopping database node"),
  
          "0" = os:cmd("/etc/init.d/couchbase stop 1>/dev/null 2>&1 ; echo -n $?"),
  
          {ok, Host}
      catch
  