本文为您介绍常见的 Kudu 基础操作命令,您可以在火山引擎 E-MapReduce(EMR)集群中,直接执行 Kudu 命令来操作。
登录 EMR 控制台。
在左侧导航栏中,选择并进入 集群列表 > 集群名称 > 服务列表 > Kudu 界面。
点击展开 Kudu Master,列出 Kudu Master 的机器列表。
方案一:使用 SSH 方式登录到 Kudu Master 的其中一个节点上,详情请参见使用 SSH连接主节点。
方案二:可以通过 EMR 集群 Kudu 组件服务部署拓扑中(emr-master-1主机名称)的ECS ID,跳转进入到云服务器的实例界面,点击右上角的 远程连接 按钮,输入集群创建时的 root 密码,进入远程终端。
登录集群后,您可以直接在 Shell 中执行相关 Kudu 命令。
说明
kudu master list <kudu master list>
例如:
kudu master list emr-3432jdr2za2uxxx-master-1,emr-3432jdr2za2uxxx-core-1,emr-3432jdr2za2uxxx-core-2
输出为:
uuid | rpc-addresses | role ----------------------------------+----------------------------------------+---------- 50213849661a4075b82cecb8xxx | emr-3432jdr2za2uxxx-master-1:7051 | FOLLOWER f6bbd253a730485897870f73xxx | emr-3432jdr2za2uxxx-core-1:7051 | FOLLOWER 9bf836ce63604edaa62f5b71xxx | emr-3432jdr2za2uxxx-core-2:7051 | LEADER
kudu tserver list <kudu master list>
例如:
kudu tserver list emr-3432jdr2za2uxxx-master-1,emr-3432jdr2za2uxxx-core-1,emr-3432jdr2za2uxxx-core-2
输出为:
uuid | rpc-addresses ----------------------------------+-------------------------------------- 1fa382bfaa5445f095f2f9xxx | emr-3432jdr2za2uxxx-core-1:7050 da522576521b4fa6913416xxx | emr-3432jdr2za2uxxx-core-2:7050
kudu cluster ksck <kudu master list>
注意
该命令必须使用 su kudu 命令,先切换到 kudu 用户后执行。
例如:
kudu cluster ksck emr-3432jdr2za2uxxx-master-1,emr-3432jdr2za2uxxx-core-1,emr-3432jdr2za2uxxx-core-2
输出为:
Master Summary UUID | Address | Status ----------------------------------+-----------------------------------+--------- 50213849661a4075b82cecxxx | emr-3432jdr2za2uxxx-master-1 | HEALTHY 9bf836ce63604edaa62f5bxxx | emr-3432jdr2za2uxxx-core-2 | HEALTHY f6bbd253a730485897870fxxx | emr-3432jdr2za2uxxx-core-1 | HEALTHY Flags of checked categories for Master: Flag | Value | Master ---------------------+-------------------------------------------------------------+------------------------- builtin_ntp_servers | 0.pool.ntp.org,1.pool.ntp.org,2.pool.ntp.org,3.pool.ntp.org | all 3 server(s) checked time_source | system | all 3 server(s) checked Tablet Server Summary UUID | Address | Status | Location | Tablet Leaders | Active Scanners ----------------------------------+--------------------------------------+---------+----------+----------------+----------------- 1fa382bfaa5445f095f2f9xxx | emr-3432jdr2za2uxxx-core-1:7050 | HEALTHY | <none> | 1 | 0 da522576521b4fa6913416xxx | emr-3432jdr2za2uxxx-core-2:7050 | HEALTHY | <none> | 1 | 0 Tablet Server Location Summary Location | Count ----------+--------- <none> | 2 Flags of checked categories for Tablet Server: Flag | Value | Tablet Server ---------------------+-------------------------------------------------------------+------------------------- builtin_ntp_servers | 0.pool.ntp.org,1.pool.ntp.org,2.pool.ntp.org,3.pool.ntp.org | all 2 server(s) checked time_source | system | all 2 server(s) checked Version Summary Version | Servers ---------+------------------------- 1.14.0 | all 5 server(s) checked Tablet Summary Summary by table Name | RF | Status | Total Tablets | Healthy | Recovering | Under-replicated | Unavailable ------+----+---------+---------------+---------+------------+------------------+------------- test | 1 | HEALTHY | 2 | 2 | 0 | 0 | 0 Tablet Replica Count Summary Statistic | Replica Count ----------------+--------------- Minimum | 1 First Quartile | 1 Median | 1 Third Quartile | 1 Maximum | 1 Total Count Summary | Total Count ----------------+------------- Masters | 3 Tablet Servers | 2 Tables | 1 Tablets | 2 Replicas | 2 OK
kudu table list <kudu master list>
例如:
kudu table list emr-3432jdr2za2uxxx-master-1,emr-3432jdr2za2uxxx-core-1,emr-3432jdr2za2uxxx-core-2
kudu table describe <kudu master list> <table name>
例如:
kudu table describe emr-3432jdr2za2uxxx-master-1,emr-3432jdr2za2uxxx-core-1,emr-3432jdr2za2uxxx-core-2 test
输出为:
TABLE test ( id INT32 NOT NULL, name STRING NOT NULL, PRIMARY KEY (id) ) HASH (id) PARTITIONS 2 SEED 100 OWNER root REPLICAS 1