Kyuubi命令行工具的使用

前言

Kyuubi提供了兩個(gè)命令行工具:kyuubi-admin和kyuubi-ctl。這兩個(gè)工具的功能和用法非常相似,能夠獲取到Kyuubi server和engine的狀態(tài)。下面分別介紹這兩個(gè)工具的常見(jiàn)使用場(chǎng)景。

環(huán)境信息

  • Kyuubi 1.9.2

前置要求

kyuubi-admin和kyuubi-ctl工具依賴(lài)于Kyuubi Rest API。使用前需要確保開(kāi)啟了Rest接口。相關(guān)配置位于kyuubi-defaults.conf中:

# 如果配置值有REST,說(shuō)明開(kāi)啟Web UI和Rest接口
kyuubi.frontend.protocols               THRIFT_BINARY,REST
# Kyuubi提供Web UI和Rest接口的端口號(hào)
kyuubi.frontend.rest.bind.port          10099

kyuubi-admin

使用幫助

使用--help參數(shù)可以打印出幫助信息。

bin/kyuubi-admin --help

幫助信息如下:

kyuubi 1.9.2
Usage: kyuubi-admin [list|delete|refresh] [options]

  -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.
  --username <value>       Username for basic authentication.
  --password <value>       Password for basic authentication.
  --spnegoHost <value>     Spnego host for spnego authentication.
  --hs2ProxyUser <value>   The value of hive.server2.proxy.user config.
  --conf <value>           Kyuubi config property pair, formatted key=value.

Command: list [engine|server]
        List information about resources.
Command: list engine [options]
        List all the engine nodes for a user
  -et, --engine-type <value>
                           The engine type this engine belong to.
  -es, --engine-subdomain <value>
                           The engine subdomain this engine belong to.
  -esl, --engine-share-level <value>
                           The engine share level this engine belong to.
Command: list server
        List all the server nodes

Command: delete [engine]
        Delete resources.
Command: delete engine [options]
        Delete the specified engine node for user.
  -et, --engine-type <value>
                           The engine type this engine belong to.
  -es, --engine-subdomain <value>
                           The engine subdomain this engine belong to.
  -esl, --engine-share-level <value>
                           The engine share level this engine belong to.

Command: refresh [config] <args>...
        Refresh the resource.
Command: refresh config [<configType>]
        Refresh the config with specified type.
  <configType>             The valid config type can be one of the following: hadoopConf, userDefaultsConf, kubernetesConf, unlimitedUsers, denyUsers, denyIps.

  -h, --help               Show help message and exit.

列出所有的Kyuubi Server

命令示例如下:

bin/kyuubi-admin list server --hostUrl http://10.100.10.100:10099

其中--hostUrl需要指定Kyuubi集群中任一Kyuubi server連接URL。
示例結(jié)果如下??梢圆樵?xún)到Kyuubi集群中所有的Kyuubi server和運(yùn)行狀態(tài)。

                         Server Node List (total 3)
╔═══════════╤═════════════════════╤═══════════════════════════════╤═════════╗
║ Namespace │ Instance            │ Attributes                    │ Status  ║
╠═══════════╪═════════════════════╪═══════════════════════════════╪═════════╣
║ /kyuubi   │ 10.100.10.100:10009 │ serverUri=10.100.10.100:10009 │ Running ║
║           │                     │ version=1.9.2                 │         ║
║           │                     │ sequence=0000000026           │         ║
╟───────────┼─────────────────────┼───────────────────────────────┼─────────╢
║ /kyuubi   │ 10.100.10.101:10009 │ serverUri=10.100.10.101:10009 │ Running ║
║           │                     │ version=1.9.2                 │         ║
║           │                     │ sequence=0000000027           │         ║
╟───────────┼─────────────────────┼───────────────────────────────┼─────────╢
║ /kyuubi   │ 10.100.10.102:10009 │ serverUri=10.100.10.102:10009 │ Running ║
║           │                     │ version=1.9.2                 │         ║
║           │                     │ sequence=0000000028           │         ║
╚═══════════╧═════════════════════╧═══════════════════════════════╧═════════╝
3 row(s)

列出所有的Engine

首先連接Kyuubi,確保Kyuubi創(chuàng)建出了一個(gè)Engine。例如使用Kyuubi連接Spark Engine:

./beeline -u 'jdbc:hive2://host1:2181,host2:2181,host3:2181/;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=kyuubi;#kyuubi.engine.type=SPARK_SQL;' -n hdfs

接下來(lái)使用如下命令,列出所有的Engine。需要注意的是,上面連接Kyuubi使用的用戶(hù)是hdfs,這里列出Engine的時(shí)候必須要指定用戶(hù)(--username參數(shù)),否則無(wú)法查詢(xún)到engine。

./kyuubi-admin list engine --hostUrl http://10.100.10.100:10099 --username hdfs

示例結(jié)果如下:

                                                Engine Node List (total 1)
╔═══════════════════════════════════════════╤══════════════════════════╤═════════════════════════════════════════════════╗
║ Namespace                                 │ Instance                 │ Attributes                                      ║
╠═══════════════════════════════════════════╪══════════════════════════╪═════════════════════════════════════════════════╣
║ /kyuubi_1.9.2_USER_SPARK_SQL/hdfs/default │ xxxxxx.bigdata.com:44418 │ refId=7626ca39-acbc-48eb-8366-76029adb0217      ║
║ ╔════════════╤════════════╤═══════════╗   │                          │ kyuubi.engine.url=xxxxxx.bigdata.com:33679      ║
║ ║ EngineType │ ShareLevel │ Subdomain ║   │                          │ spark.driver.memory=                            ║
║ ╠════════════╪════════════╪═══════════╣   │                          │ kyuubi.engine.id=application_1725009047638_0021 ║
║ ║ SPARK_SQL  │ USER       │ default   ║   │                          │ version=1.9.2                                   ║
║ ╚════════════╧════════════╧═══════════╝   │                          │ sequence=0000000002                             ║
║                                           │                          │ serverUri=xxxxxx.bigdata.com:44418              ║
║                                           │                          │ spark.executor.memory=                          ║
╚═══════════════════════════════════════════╧══════════════════════════╧═════════════════════════════════════════════════╝
1 row(s)

kyuubi-ctl

列出所有server

執(zhí)行如下命令。和kyuubi-admin不同的是kyuubi-ctl不需要指定hostUrl參數(shù)。

./kyuubi-ctl list server

示例結(jié)果:

            Zookeeper service nodes
╔═══════════╤═══════════════╤═══════╤═════════╗
║ Namespace │ Host          │ Port  │ Version ║
╠═══════════╪═══════════════╪═══════╪═════════╣
║ /kyuubi   │ 10.100.10.100 │ 10009 │ 1.9.2   ║
╟───────────┼───────────────┼───────┼─────────╢
║ /kyuubi   │ 10.100.10.101 │ 10009 │ 1.9.2   ║
╟───────────┼───────────────┼───────┼─────────╢
║ /kyuubi   │ 10.100.10.102 │ 10009 │ 1.9.2   ║
╚═══════════╧═══════════════╧═══════╧═════════╝
3 row(s)

列出其中一個(gè)server

需要指定server所在的主機(jī)IP/hostname和Kyuubi Rest接口端口號(hào)。命令如下:

./kyuubi-ctl get server --host 10.100.10.100 --port 10009

示例結(jié)果:

            Zookeeper service nodes
╔═══════════╤═══════════════╤═══════╤═════════╗
║ Namespace │ Host          │ Port  │ Version ║
╠═══════════╪═══════════════╪═══════╪═════════╣
║ /kyuubi   │ 10.100.10.100 │ 10009 │ 1.9.2   ║
╚═══════════╧═══════════════╧═══════╧═════════╝
1 row(s)

列出指定用戶(hù)的engine

需要使用--user參數(shù)指定用戶(hù),命令如下所示:

./kyuubi-ctl list engine --user hdfs

示例結(jié)果:

                              Zookeeper service nodes
╔═══════════════════════════════════════════╤════════════════════╤═══════╤═════════╗
║ Namespace                                 │ Host               │ Port  │ Version ║
╠═══════════════════════════════════════════╪════════════════════╪═══════╪═════════╣
║ /kyuubi_1.9.2_USER_SPARK_SQL/hdfs/default │ xxxxxx.bigdata.com │ 44418 │ 1.9.2   ║
╚═══════════════════════════════════════════╧════════════════════╧═══════╧═════════╝
1 row(s)

獲取特定的engine信息

需要執(zhí)行engine運(yùn)行所在的主機(jī)的IP/hostname,engine開(kāi)放的端口和用戶(hù)名。

./kyuubi-ctl get engine --host xxxxxx.bigdata.com --port 44418 --user hdfs

示例結(jié)果:

                              Zookeeper service nodes
╔═══════════════════════════════════════════╤════════════════════╤═══════╤═════════╗
║ Namespace                                 │ Host               │ Port  │ Version ║
╠═══════════════════════════════════════════╪════════════════════╪═══════╪═════════╣
║ /kyuubi_1.9.2_USER_SPARK_SQL/hdfs/default │ worker.bigdata.com │ 44418 │ 1.9.2   ║
╚═══════════════════════════════════════════╧════════════════════╧═══════╧═════════╝
1 row(s)

前面list engine命令的執(zhí)行結(jié)果包含get engine的結(jié)果。get engine需要的參數(shù)更多,沒(méi)有list engine使用方便。

刪除特定的engine

命令參數(shù)和get engine相同。示例如下:

./kyuubi-ctl delete engine --host xxxxxx.bigdata.com --port 44418 --user hdfs
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容