in src/kudu/tools/tool_action_tserver.cc [380:526]
unique_ptr<Mode> BuildTServerMode() {
unique_ptr<Action> dump_memtrackers =
TServerActionBuilder("dump_memtrackers", &TserverDumpMemTrackers)
.Description("Dump the memtrackers from a Kudu Tablet Server")
.AddOptionalParameter("format")
.AddOptionalParameter("memtracker_output")
.Build();
unique_ptr<Action> get_flags =
TServerActionBuilder("get_flags", &TServerGetFlags)
.Description("Get the gflags for a Kudu Tablet Server")
.AddOptionalParameter("all_flags")
.AddOptionalParameter("flags")
.AddOptionalParameter("flag_tags")
.Build();
unique_ptr<Action> run =
ActionBuilder("run", &TServerRun)
.ProgramName("kudu-tserver")
.Description("Run a Kudu Tablet Server")
.ExtraDescription("Note: The tablet server is started in this process and "
"runs until interrupted.\n\n"
"The most common configuration flags are described below. "
"For all the configuration options pass --helpfull or see "
"https://kudu.apache.org/docs/configuration_reference.html"
"#kudu-tserver_supported")
.AddOptionalParameter("tserver_master_addrs")
// Even though fs_wal_dir is required, we don't want it to be positional argument.
.AddOptionalParameter("fs_wal_dir")
.AddOptionalParameter("fs_data_dirs")
.AddOptionalParameter("fs_metadata_dir")
.AddOptionalParameter("block_cache_capacity_mb")
.AddOptionalParameter("memory_limit_hard_bytes")
.AddOptionalParameter("log_dir")
// Unlike most tools we don't log to stderr by default to match the
// kudu-tserver binary as closely as possible.
.AddOptionalParameter("logtostderr", string("false"))
.Build();
unique_ptr<Action> set_flag =
TServerActionBuilder("set_flag", &TServerSetFlag)
.Description("Change a gflag value on a Kudu Tablet Server")
.AddRequiredParameter({ kFlagArg, "Name of the gflag" })
.AddRequiredParameter({ kValueArg, "New value for the gflag" })
.AddOptionalParameter("force")
.AddOptionalParameter("run_consistency_check")
.Build();
unique_ptr<Action> set_flag_for_all =
ClusterActionBuilder("set_flag_for_all", &TServerSetAllTServersFlag)
.Description("Change a gflag value for all Kudu Tablet Servers in the cluster")
.AddRequiredParameter({ kFlagArg, "Name of the gflag" })
.AddRequiredParameter({ kValueArg, "New value for the gflag" })
.AddOptionalParameter("force")
.Build();
unique_ptr<Action> status =
TServerActionBuilder("status", &TServerStatus)
.Description("Get the status of a Kudu Tablet Server")
.Build();
unique_ptr<Action> timestamp =
TServerActionBuilder("timestamp", &TServerTimestamp)
.Description("Get the current timestamp of a Kudu Tablet Server")
.Build();
unique_ptr<Action> list_tservers =
ClusterActionBuilder("list", &ListTServers)
.Description("List tablet servers in a Kudu cluster")
.AddOptionalParameter("columns", string("uuid,rpc-addresses"),
string("Comma-separated list of tserver info fields to "
"include in output.\nPossible values: uuid, "
"rpc-addresses, http-addresses, version, seqno, "
"heartbeat, start_time, state"))
.AddOptionalParameter("format")
.Build();
unique_ptr<Action> quiescing_status =
TServerActionBuilder("status", &QuiescingStatus)
.Description("Output information about the quiescing state of a Tablet "
"Server.")
.Build();
unique_ptr<Action> start_quiescing =
TServerActionBuilder("start", &StartQuiescingTServer)
.Description("Start quiescing the given Tablet Server. While a Tablet "
"Server is quiescing, Tablet replicas on it will no longer "
"attempt to become leader, and new scan requests will be "
"retried at other servers.")
.AddOptionalParameter("error_if_not_fully_quiesced")
.Build();
unique_ptr<Action> stop_quiescing =
TServerActionBuilder("stop", &StopQuiescingTServer)
.Description("Stop quiescing a Tablet Server.")
.Build();
unique_ptr<Mode> quiesce = ModeBuilder("quiesce")
.Description("Operate on the quiescing state of a Kudu Tablet Server.")
.AddAction(std::move(quiescing_status))
.AddAction(std::move(start_quiescing))
.AddAction(std::move(stop_quiescing))
.Build();
unique_ptr<Action> enter_maintenance =
ClusterActionBuilder("enter_maintenance", &EnterMaintenance)
.Description("Begin maintenance on the Tablet Server. While under "
"maintenance, downtime of the Tablet Server will not lead "
"to the immediate re-replication of its tablet replicas.")
.AddRequiredParameter({ kTServerIdArg, kTServerIdDesc })
.AddOptionalParameter("allow_missing_tserver")
.Build();
// Note: --allow_missing_tserver doesn't make sense for exit_maintenance
// because if the tserver is missing, the non-existent tserver's state is
// already NONE and so exit_maintenance is a no-op.
unique_ptr<Action> exit_maintenance =
ClusterActionBuilder("exit_maintenance", &ExitMaintenance)
.Description("End maintenance of the Tablet Server.")
.AddRequiredParameter({ kTServerIdArg, kTServerIdDesc })
.Build();
unique_ptr<Mode> state = ModeBuilder("state")
.Description("Operate on the state of a Kudu Tablet Server")
.AddAction(std::move(enter_maintenance))
.AddAction(std::move(exit_maintenance))
.Build();
unique_ptr<Action> unregister_tserver =
ClusterActionBuilder("unregister", &UnregisterTServer)
.Description(
"Unregister a tablet server from the master's in-memory state and system catalog.")
.AddRequiredParameter({kTServerIdArg, kTServerIdDesc})
.AddOptionalParameter("force_unregister_live_tserver")
.AddOptionalParameter("remove_tserver_state")
.Build();
return ModeBuilder("tserver")
.Description("Operate on a Kudu Tablet Server")
.AddAction(std::move(dump_memtrackers))
.AddAction(std::move(get_flags))
.AddAction(std::move(run))
.AddAction(std::move(set_flag))
.AddAction(std::move(set_flag_for_all))
.AddAction(std::move(status))
.AddAction(std::move(timestamp))
.AddAction(std::move(list_tservers))
.AddAction(std::move(unregister_tserver))
.AddMode(std::move(quiesce))
.AddMode(std::move(state))
.Build();
}