[KYUUBI #3045][FOLLOWUP] Correct the common options and add docs for kyuubi-admin command
### _Why are the changes needed?_ 1. The version options should be in zkOptions. 2. Add docs for kyuubi-adminctl. ### _How was this patch tested?_ - [ ] Add some test cases that check the changes thoroughly including negative and positive cases if possible - [x] Add screenshots for manual tests if appropriate  - [ ] [Run test](https://kyuubi.apache.org/docs/latest/develop_tools/testing.html#running-tests) locally before make a pull request Closes #3066 from turboFei/admin_ctl_docs. Closes #3045 983d133f [Fei Wang] comments 65675ad7 [Fei Wang] add more b5b772d5 [Fei Wang] comments 222b409c [Fei Wang] add docs 20c50c00 [Fei Wang] kyuubi-adminctl -> kyuubi-admin 078044e0 [Fei Wang] refactor 4e89b52d [Fei Wang] remove unused c2d1dc70 [Fei Wang] add admin ctl docs Authored-by: Fei Wang <fwang12@ebay.com> Signed-off-by: Fei Wang <fwang12@ebay.com>
This commit is contained in:
parent
9cb8041dbd
commit
99934591f0
@ -23,4 +23,5 @@ Tools
|
||||
:maxdepth: 2
|
||||
|
||||
spark_block_cleaner
|
||||
kyuubi-ctl
|
||||
kyuubi-ctl
|
||||
kyuubi-admin
|
||||
71
docs/tools/kyuubi-admin.rst
Normal file
71
docs/tools/kyuubi-admin.rst
Normal file
@ -0,0 +1,71 @@
|
||||
.. Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
.. http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
.. Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
Kyuubi Administer Tool
|
||||
=======================
|
||||
|
||||
.. versionadded:: 1.6.0
|
||||
|
||||
Kyuubi administer tool(kyuubi-admin) provides administrators with some maintenance operations against a kyuubi server or cluster.
|
||||
|
||||
.. _installation:
|
||||
|
||||
Installation
|
||||
-------------------------------------
|
||||
To install kyuubi-admin, you need to unpack the tarball. For example,
|
||||
|
||||
.. parsed-literal::
|
||||
|
||||
tar zxf apache-kyuubi-\ |release|\ -bin.tgz
|
||||
|
||||
This will result in the creation of a subdirectory named apache-kyuubi-|release|-bin shown below,
|
||||
|
||||
.. parsed-literal::
|
||||
|
||||
apache-kyuubi-\ |release|\ -bin
|
||||
├── ...
|
||||
├── bin
|
||||
| ├── kyuubi-admin
|
||||
│ ├── ...
|
||||
├── ...
|
||||
|
||||
|
||||
.. _usage:
|
||||
|
||||
Usage
|
||||
-------------------------------------
|
||||
.. code-block:: bash
|
||||
|
||||
bin/kyuubi-admin --help
|
||||
|
||||
|
||||
|
||||
.. _refresh_config:
|
||||
|
||||
Refresh config
|
||||
-------------------------------------
|
||||
|
||||
Refresh the config with specified type.
|
||||
|
||||
Usage: ``bin/kyuubi-admin refresh config [options] [<configType>]``
|
||||
|
||||
.. list-table::
|
||||
:widths: 20 80
|
||||
:header-rows: 1
|
||||
|
||||
* - Config Type
|
||||
- Description
|
||||
* - hadoopConf
|
||||
- The hadoop conf used for proxy user verification.
|
||||
@ -42,7 +42,6 @@ case class CliConfig(
|
||||
conf: Map[String, String] = Map.empty)
|
||||
|
||||
case class CommonOpts(
|
||||
version: String = null,
|
||||
verbose: Boolean = false,
|
||||
hostUrl: String = null,
|
||||
authSchema: String = null,
|
||||
@ -54,7 +53,8 @@ case class ZookeeperOpts(
|
||||
zkQuorum: String = null,
|
||||
namespace: String = null,
|
||||
host: String = null,
|
||||
port: String = null)
|
||||
port: String = null,
|
||||
version: String = null)
|
||||
|
||||
case class CreateOpts(filename: String = null)
|
||||
|
||||
|
||||
@ -50,7 +50,7 @@ object CommandLine {
|
||||
def getAdminCtlOptionParser(builder: OParserBuilder[CliConfig]): OParser[Unit, CliConfig] = {
|
||||
import builder._
|
||||
OParser.sequence(
|
||||
programName("kyuubi-adminctl"),
|
||||
programName("kyuubi-admin"),
|
||||
head("kyuubi", KYUUBI_VERSION),
|
||||
common(builder),
|
||||
refresh(builder),
|
||||
@ -68,10 +68,6 @@ object CommandLine {
|
||||
private def common(builder: OParserBuilder[CliConfig]): OParser[_, CliConfig] = {
|
||||
import builder._
|
||||
OParser.sequence(
|
||||
opt[String]('v', "version")
|
||||
.action((v, c) => c.copy(commonOpts = c.commonOpts.copy(version = v)))
|
||||
.text("Using the compiled KYUUBI_VERSION default," +
|
||||
" change it if the active service is running in another."),
|
||||
opt[Unit]('b', "verbose")
|
||||
.action((_, c) => c.copy(commonOpts = c.commonOpts.copy(verbose = true)))
|
||||
.text("Print additional debug output."),
|
||||
@ -115,7 +111,11 @@ object CommandLine {
|
||||
.text("Hostname or IP address of a service."),
|
||||
opt[String]('p', "port")
|
||||
.action((v, c) => c.copy(zkOpts = c.zkOpts.copy(port = v)))
|
||||
.text("Listening port of a service."))
|
||||
.text("Listening port of a service."),
|
||||
opt[String]('v', "version")
|
||||
.action((v, c) => c.copy(zkOpts = c.zkOpts.copy(version = v)))
|
||||
.text("Using the compiled KYUUBI_VERSION default," +
|
||||
" change it if the active service is running in another."))
|
||||
}
|
||||
|
||||
private def create(builder: OParserBuilder[CliConfig]): OParser[_, CliConfig] = {
|
||||
|
||||
@ -122,7 +122,7 @@ class ControlCliArguments(args: Seq[String], env: Map[String, String] = sys.env)
|
||||
| namespace ${cliConfig.zkOpts.namespace}
|
||||
| host ${cliConfig.zkOpts.host}
|
||||
| port ${cliConfig.zkOpts.port}
|
||||
| version ${cliConfig.commonOpts.version}
|
||||
| version ${cliConfig.zkOpts.version}
|
||||
| verbose ${cliConfig.commonOpts.verbose}
|
||||
""".stripMargin
|
||||
case ControlObject.ENGINE =>
|
||||
@ -134,7 +134,7 @@ class ControlCliArguments(args: Seq[String], env: Map[String, String] = sys.env)
|
||||
| user ${cliConfig.engineOpts.user}
|
||||
| host ${cliConfig.zkOpts.host}
|
||||
| port ${cliConfig.zkOpts.port}
|
||||
| version ${cliConfig.commonOpts.version}
|
||||
| version ${cliConfig.zkOpts.version}
|
||||
| verbose ${cliConfig.commonOpts.verbose}
|
||||
""".stripMargin
|
||||
case _ => ""
|
||||
|
||||
@ -74,11 +74,11 @@ abstract class Command[T](cliConfig: CliConfig) extends Logging {
|
||||
}
|
||||
}
|
||||
|
||||
if (arguments.commonOpts.version == null) {
|
||||
if (arguments.zkOpts.version == null) {
|
||||
if (verbose) {
|
||||
super.info(s"version is not specified, use built-in KYUUBI_VERSION:$KYUUBI_VERSION")
|
||||
}
|
||||
arguments = arguments.copy(commonOpts = arguments.commonOpts.copy(version = KYUUBI_VERSION))
|
||||
arguments = arguments.copy(zkOpts = arguments.zkOpts.copy(version = KYUUBI_VERSION))
|
||||
}
|
||||
arguments
|
||||
}
|
||||
|
||||
@ -49,7 +49,7 @@ object CtlUtils {
|
||||
// org.apache.kyuubi.engine.EngineRef#engineSpace
|
||||
DiscoveryPaths.makePath(
|
||||
s"${cliConfig.zkOpts.namespace}_" +
|
||||
s"${cliConfig.commonOpts.version}_" +
|
||||
s"${cliConfig.zkOpts.version}_" +
|
||||
s"${engineShareLevel}_${engineType}",
|
||||
cliConfig.engineOpts.user,
|
||||
Array(engineSubdomain))
|
||||
|
||||
@ -75,9 +75,8 @@ class AdminControlCliArgumentsSuite extends KyuubiFunSuite with TestPrematureExi
|
||||
// scalastyle:off
|
||||
val helpString =
|
||||
s"""kyuubi $KYUUBI_VERSION
|
||||
|Usage: kyuubi-adminctl [refresh] [options]
|
||||
|Usage: kyuubi-admin [refresh] [options]
|
||||
|
|
||||
| -v, --version <value> Using the compiled KYUUBI_VERSION default, change it if the active service is running in another.
|
||||
| -b, --verbose Print additional debug output.
|
||||
| --hostUrl <value> Host url for rest api.
|
||||
| --authSchema <value> Auth schema for rest api, valid values are basic, spnego.
|
||||
|
||||
@ -82,7 +82,7 @@ class ControlCliArgumentsSuite extends KyuubiFunSuite with TestPrematureExit {
|
||||
assert(opArgs.cliConfig.zkOpts.namespace == namespace)
|
||||
assert(opArgs.cliConfig.zkOpts.host == host)
|
||||
assert(opArgs.cliConfig.zkOpts.port == port)
|
||||
assert(opArgs.cliConfig.commonOpts.version == KYUUBI_VERSION)
|
||||
assert(opArgs.cliConfig.zkOpts.version == KYUUBI_VERSION)
|
||||
if (service == "engine") {
|
||||
assert(opArgs.cliConfig.engineOpts.user == user)
|
||||
}
|
||||
@ -113,7 +113,7 @@ class ControlCliArgumentsSuite extends KyuubiFunSuite with TestPrematureExit {
|
||||
assert(opArgs.cliConfig.zkOpts.namespace == newNamespace)
|
||||
assert(opArgs.cliConfig.zkOpts.host == host)
|
||||
assert(opArgs.cliConfig.zkOpts.port == port)
|
||||
assert(opArgs.cliConfig.commonOpts.version == KYUUBI_VERSION)
|
||||
assert(opArgs.cliConfig.zkOpts.version == KYUUBI_VERSION)
|
||||
}
|
||||
}
|
||||
|
||||
@ -296,7 +296,7 @@ class ControlCliArgumentsSuite extends KyuubiFunSuite with TestPrematureExit {
|
||||
zkQuorum)
|
||||
val opArgs = new ControlCliArguments(args)
|
||||
assert(opArgs.cliConfig.zkOpts.namespace == namespace)
|
||||
assert(opArgs.cliConfig.commonOpts.version == KYUUBI_VERSION)
|
||||
assert(opArgs.cliConfig.zkOpts.version == KYUUBI_VERSION)
|
||||
}
|
||||
|
||||
test("test use short options") {
|
||||
@ -328,7 +328,7 @@ class ControlCliArgumentsSuite extends KyuubiFunSuite with TestPrematureExit {
|
||||
assert(opArgs.cliConfig.zkOpts.namespace == namespace)
|
||||
assert(opArgs.cliConfig.zkOpts.host == host)
|
||||
assert(opArgs.cliConfig.zkOpts.port == port)
|
||||
assert(opArgs.cliConfig.commonOpts.version == KYUUBI_VERSION)
|
||||
assert(opArgs.cliConfig.zkOpts.version == KYUUBI_VERSION)
|
||||
if (service == "engine") {
|
||||
assert(opArgs.cliConfig.engineOpts.user == user)
|
||||
}
|
||||
@ -357,7 +357,6 @@ class ControlCliArgumentsSuite extends KyuubiFunSuite with TestPrematureExit {
|
||||
s"""kyuubi $KYUUBI_VERSION
|
||||
|Usage: kyuubi-ctl [create|get|delete|list|log|submit] [options]
|
||||
|
|
||||
| -v, --version <value> $versionHelpString
|
||||
| -b, --verbose Print additional debug output.
|
||||
| --hostUrl <value> Host url for rest api.
|
||||
| --authSchema <value> Auth schema for rest api, valid values are basic, spnego.
|
||||
@ -370,6 +369,7 @@ class ControlCliArgumentsSuite extends KyuubiFunSuite with TestPrematureExit {
|
||||
| -n, --namespace <value> The namespace, using kyuubi-defaults/conf if absent.
|
||||
| -s, --host <value> Hostname or IP address of a service.
|
||||
| -p, --port <value> Listening port of a service.
|
||||
| -v, --version <value> $versionHelpString
|
||||
|
|
||||
|Command: create [batch|server] [options]
|
||||
|${"\t"}Create a resource.
|
||||
|
||||
Loading…
Reference in New Issue
Block a user