CHD-Cloudera Manager API 详解

这篇具有很好参考价值的文章主要介绍了CHD-Cloudera Manager API 详解。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。


前言

Cloudera Manager是一个用于管理和监控Hadoop集群的强大工具。它提供了一套REST API,使用户能够通过编程方式与Cloudera Manager进行交互,并执行各种操作,如创建集群、添加服务、配置角色等。


一、Cloudera Manager 概念

1. 集群(Cluster)

集群是一组运行相互依赖服务的主机。集群中的所有服务具有相同的 CDH 版本。一个 Cloudera Manager 可以安装多个集群,它们通过不同的名称唯一标识。

Cloudera Manager可以管理多个集群,但是每个集群只能与单个Cloudera Manager Server或Cloudera Manager HA对相关联。一旦成功安装了第一个集群,就可以添加其他集群,运行相同或不同版本的CDH。然后,您可以独立管理每个集群及其服务。

2. 服务(Service)

服务是在集群中提供抽象功能的实体。服务的例子包括 HDFS、MapReduce、YARN 和 HBase。服务通常是分布式的,并包含一组物理运行在集群上的角色。服务具有自己的配置、状态和角色。您可以针对服务或批量针对角色发布命令。此外,HDFS 服务有名称服务,MapReduce 服务有活动。

所有服务都属于一个集群(除了 Cloudera 管理服务),并在 Cloudera Manager 安装中具有唯一的名称。服务的类型取决于集群的 CDH 版本。

3. 角色(Role)

角色为服务执行特定操作,并分配给主机。它通常作为守护进程运行,如 DataNode 或 TaskTracker。(当然也有例外,并非所有角色都是守护进程。)角色一旦创建,便不能重新分配到其他主机。如果想重新分配到其他主机,需要删除并重新创建这个角色。

角色拥有自己的配置和状态。角色上的 API 命令总是在服务级别以批量方式发布。

4. 角色类型(Role Type)

角色类型指的是角色所属的类。例如,HBase 服务有 Master 角色类型和 RegionServer 角色类型。不同服务类型具有不同的角色类型集合。不要将其与角色混淆,角色指的是物理分配给主机的特定角色实例。

您可以指定角色类型的配置,该配置由该类型的所有角色实例继承。

5. 主机(Host)

Cloudera Manager 代理运行在由 Cloudera Manager 管理的主机上。您可以为主机分配服务角色。

6. Cloudera Manager

与 Cloudera Manager 操作相关的所有内容都可在资源下找到。这包括全局命令、系统配置和 Cloudera 管理服务。

7. Cloudera 管理服务(Cloudera Management Service)

在企业版中提供 Hadoop 集群的监控、诊断和报告功能。该服务的操作与其他 Hadoop 服务类似,但管理服务不属于集群。

8. 指标(Metrics)

指标是衡量实体或活动状态的属性,例如打开的文件描述符数量或 CPU 利用率百分比。通过 Cloudera Manager API /timeseries/schema 端点可以获取完整的指标模式列表。

Cloudera Manager 可以使用名为 tsquery 的语言检索指标数据。

9. 调试 API

您可以在 Cloudera Manager 中启用调试功能,以查看 API 相关活动的详细日志。调试设置在 Cloudera Manager 管理控制台中的“启用 API 调试”页面。启用后,Cloudera Manager 服务器日志将包含所有 API 请求和响应的完整跟踪以及请求处理调试。由于可能生成大量日志数据,建议仅在开发过程中启用。


二、Cloudera Manager REST API

1. 介绍

1.1 返回数据视图介绍

  • 可以使用两种视图之一来列出集合中的条目:summary(默认视图)或 full
    • summary 视图提供了关于每个条目的核心信息。
    • full 视图提供了每个条目的完全展开视图。
  • 视图由名为 view 的查询参数控制,例如:
    curl -u admin:admin -X GET --header 'Accept: application/json' 'http://localhost:7180/api/v33/users?view=full'
    

1.2 错误代码介绍

在出现错误时,API会返回400和500系列的HTTP代码:

  • 400 — 无效的请求参数;格式错误的请求
  • 401 — 认证失败
  • 403 — 授权失败
  • 404 — 未找到对象
  • 500 — 内部API错误
  • 503 — 响应暂时不可用;调用者稍后重试

2. API版本

可以通过向/versionURL发送GET请求来查询API支持的最高版本。返回的字符串包含了最高支持的版本(例如,“v2”)。

curl -u admin:admin -X GET --header 'Accept: application/json' 'http://localhost:7180/api/version'

3. REST API 资源

资源的API前缀:http://localhost:7180/api/v33

  • v33:API版本号
  • clusterName:集群名称,可以通过curl -u admin:admin -X GET --header 'Accept: application/json' 'http://localhost:7180/api/v33/clusters' 命令查看集群信息,其中包含了集群名称、版本等信息。
  • serviceName:服务名称,可以通过curl -u admin:admin -X GET --header 'Accept: application/json' 'http://localhost:7180/api/v33/clusters/Cluster/services' | grep name 查看集群中有哪些服务。

3.1 活动API

路径 请求方法
/clusters/{clusterName}/services/{serviceName}/activities GET
/clusters/{clusterName}/services/{serviceName}/activities/{activityId} GET
/clusters/{clusterName}/services/{serviceName}/activities/{activityId}/children GET
/clusters/{clusterName}/services/{serviceName}/activities/{activityId}/metrics GET
/clusters/{clusterName}/services/{serviceName}/activities/{activityId}/similar GET

3.2 所有主机API

路径 请求方法
/cm/allHosts/config GET, PUT

3.3 审计API

路径 请求方法
/audits GET
/audits/stream GET

3.4 角色身份验证元数据API

路径 请求方法
/authRoleMetadatas GET

3.5 身份验证服务API

身份验证服务用于管理单点登录功能。

此服务尚未对一般用户开放。

控制身份验证服务的API基本上与控制MGMT服务的API相同。两者都不与集群关联,代表CM管理的资源。

路径 请求方法
/cm/authService DELETE, GET, PUT
/cm/authService/autoAssignRoles PUT
/cm/authService/autoConfigure PUT
/cm/authService/commands GET
/cm/authService/config GET, PUT
/cm/authService/roleTypes GET
/cm/authService/commands/enterMaintenanceMode POST
/cm/authService/commands/exitMaintenanceMode POST
/cm/authService/commands/restart POST
/cm/authService/commands/start POST
/cm/authService/commands/stop POST

3.6 身份验证服务角色命令API

路径 请求方法
/cm/authService/roleCommands/restart POST
/cm/authService/roleCommands/start POST
/cm/authService/roleCommands/stop POST

3.7 身份验证服务角色配置组API

路径 请求方法
/cm/authService/roleConfigGroups GET
/cm/authService/roleConfigGroups/{roleConfigGroupName} GET, PUT
/cm/authService/roleConfigGroups/{roleConfigGroupName}/config GET, PUT
/cm/authService/roleConfigGroups/{roleConfigGroupName}/roles GET

3.8 身份验证服务角色API

路径 请求方法
/cm/authService/roles GET, POST
/cm/authService/roles/{roleName} DELETE, GET
/cm/authService/roles/{roleName}/commands GET
/cm/authService/roles/{roleName}/config GET, PUT
/cm/authService/roles/{roleName}/commands/enterMaintenanceMode POST
/cm/authService/roles/{roleName}/commands/exitMaintenanceMode POST
/cm/authService/roles/{roleName}/logs/full GET
/cm/authService/roles/{roleName}/logs/stacks GET
/cm/authService/roles/{roleName}/logs/stacksBundle GET
/cm/authService/roles/{roleName}/logs/stderr GET
/cm/authService/roles/{roleName}/logs/stdout GET

3.9 批处理API

路径 请求方法
/batch POST

3.10 Cloudera Manager API

路径 请求方法
/cm/commands GET
/cm/config GET, PUT
/cm/deployment GET, PUT
/cm/importClusterTemplate POST
/cm/kerberosInfo GET
/cm/kerberosPrincipals GET
/cm/license GET, POST
/cm/licensedFeatureUsage GET
/cm/log GET
/cm/scmDbInfo GET
/cm/shutdownReadiness GET
/cm/version GET
/cm/commands/addCustomCerts POST
/cm/commands/clustersPerfInspector POST
/cm/commands/collectDiagnosticData POST
/cm/commands/deleteCredentials POST
/cm/commands/generateCmca POST
/cm/commands/generateCredentials POST
/cm/commands/hostInstall POST
/cm/commands/hostsDecommission POST
/cm/commands/hostsOfflineOrDecommission POST
/cm/commands/hostsPerfInspector POST
/cm/commands/hostsRecommission POST
/cm/commands/hostsRecommissionAndExitMaintenanceMode POST
/cm/commands/hostsRecommissionWithStart POST
/cm/commands/hostsStartRoles POST
/cm/commands/importAdminCredentials POST
/cm/commands/importKerberosPrincipal POST
/cm/commands/inspectHosts POST
/cm/commands/refreshParcelRepos POST
/cm/trial/begin POST
/cm/trial/end POST

3.11 集群API

路径 请求方法
/clusters GET, POST
/clusters/{clusterName} DELETE, GET, PUT
/clusters/{clusterName}/autoAssignRoles PUT
/clusters/{clusterName}/autoConfigure PUT
/clusters/{clusterName}/clientConfig GET
/clusters/{clusterName}/commands GET
/clusters/{clusterName}/dfsServices GET
/clusters/{clusterName}/export GET
/clusters/{clusterName}/hosts DELETE, GET, POST
/clusters/{clusterName}/kerberosInfo GET
/clusters/{clusterName}/serviceTypes GET
/clusters/{clusterName}/utilization GET
/clusters/{clusterName}/commands/configureAutoTlsServices POST
/clusters/{clusterName}/commands/configureForKerberos POST
/clusters/{clusterName}/commands/deleteCredentials POST
/clusters/{clusterName}/commands/deployClientConfig POST
/clusters/{clusterName}/commands/deployClusterClientConfig POST
/clusters/{clusterName}/commands/enterMaintenanceMode POST
/clusters/{clusterName}/commands/exitMaintenanceMode POST
/clusters/{clusterName}/commands/expireLogs POST
/clusters/{clusterName}/commands/firstRun POST
/clusters/{clusterName}/commands/inspectHosts POST
/clusters/{clusterName}/commands/perfInspector POST
/clusters/{clusterName}/commands/poolsRefresh POST
/clusters/{clusterName}/commands/preUpgradeCheck POST
/clusters/{clusterName}/commands/refresh POST
/clusters/{clusterName}/commands/restart POST
/clusters/{clusterName}/commands/rollingRestart POST
/clusters/{clusterName}/commands/rollingUpgrade POST
/clusters/{clusterName}/commands/start POST
/clusters/{clusterName}/commands/stop POST
/clusters/{clusterName}/commands/upgradeCdh POST
/clusters/{clusterName}/commands/upgradeServices POST
/clusters/{clusterName}/hosts/{hostId} DELETE

3.12 Cloudera Manager 对等节点API

路径 请求方法
/cm/peers GET, POST
/cm/peers/{peerName} DELETE, GET, PUT
/cm/peers/{peerName}/commands/test POST

3.13 命令API

路径 请求方法
/commands/{commandId} GET
/commands/{commandId}/abort POST
/commands/{commandId}/retry POST

3.14 仪表板API

路径 请求方法
/timeseries/dashboards GET, POST
/timeseries/dashboards/{dashboardName} DELETE, GET

3.15 数据上下文API

路径 请求方法
/dataContexts GET, POST
/dataContexts/{dataContextName} DELETE, GET

3.16 事件API

路径 请求方法
/events GET
/events/{eventId} GET

3.17 外部账户API

管理各种Cloudera Manager功能使用的外部帐户,用于执行外部任务。

路径 请求方法
/externalAccounts/create POST
/externalAccounts/supportedCategories GET
/externalAccounts/update PUT
/externalAccounts/account/{name} GET
/externalAccounts/accountByDisplayName/{displayName} GET
/externalAccounts/delete/{name} DELETE
/externalAccounts/supportedTypes/{categoryName} GET
/externalAccounts/type/{typeName} GET
/externalAccounts/account/{name}/config GET, PUT
/externalAccounts/typeInfo/{typeName}/commandsByName GET
/externalAccounts/account/{name}/commands/{commandName} POST

3.18 外部用户映射API

路径 请求方法
/externalUserMappings GET, POST
/externalUserMappings/{uuid} DELETE, GET, PUT

3.19 主机模版API

路径 请求方法
/clusters/{clusterName}/hostTemplates GET, POST
/clusters/{clusterName}/hostTemplates/{hostTemplateName} DELETE, GET, PUT
/clusters/{clusterName}/hostTemplates/{hostTemplateName}/commands/applyHostTemplate POST

3.20 主机API

路径 请求方法
/hosts DELETE, GET, POST
/hosts/{hostId} DELETE, GET, PUT
/hosts/{hostId}/config GET, PUT
/hosts/{hostId}/metrics GET
/hosts/{hostId}/commands/enterMaintenanceMode POST
/hosts/{hostId}/commands/exitMaintenanceMode POST
/hosts/{hostId}/commands/generateHostCerts POST
/hosts/{hostId}/commands/migrateRoles POST

3.21 Impala查询API

路径 请求方法
/clusters/{clusterName}/services/{serviceName}/impalaQueries GET
/clusters/{clusterName}/services/{serviceName}/impalaQueries/attributes GET
/clusters/{clusterName}/services/{serviceName}/impalaQueries/{queryId} GET
/clusters/{clusterName}/services/{serviceName}/impalaQueries/{queryId}/cancel POST

3.22 管理角色命令API

路径 请求方法
/cm/service/roleCommands/jmapDump POST
/cm/service/roleCommands/jmapHisto POST
/cm/service/roleCommands/jstack POST
/cm/service/roleCommands/lsof POST
/cm/service/roleCommands/restart POST
/cm/service/roleCommands/start POST
/cm/service/roleCommands/stop POST

3.23 管理角色配置组API

路径 请求方法
/cm/service/roleConfigGroups GET
/cm/service/roleConfigGroups/{roleConfigGroupName} GET, PUT
/cm/service/roleConfigGroups/{roleConfigGroupName}/config GET, PUT
/cm/service/roleConfigGroups/{roleConfigGroupName}/roles GET

3.24 管理角色API

路径 请求方法
/cm/service/roles GET, POST
/cm/service/roles/{roleName} DELETE, GET
/cm/service/roles/{roleName}/commands GET
/cm/service/roles/{roleName}/config GET, PUT
/cm/service/roles/{roleName}/commands/enterMaintenanceMode POST
/cm/service/roles/{roleName}/commands/exitMaintenanceMode POST
/cm/service/roles/{roleName}/logs/full GET
/cm/service/roles/{roleName}/logs/stacks GET
/cm/service/roles/{roleName}/logs/stacksBundle GET
/cm/service/roles/{roleName}/logs/stderr GET
/cm/service/roles/{roleName}/logs/stdout GET

3.25 管理服务API

路径 请求方法
/cm/service DELETE, GET, PUT
/cm/service/autoAssignRoles PUT
/cm/service/autoConfigure PUT
/cm/service/commands GET
/cm/service/config GET, PUT
/cm/service/roleTypes GET
/cm/service/commands/enterMaintenanceMode POST
/cm/service/commands/exitMaintenanceMode POST
/cm/service/commands/restart POST
/cm/service/commands/start POST
/cm/service/commands/stop POST

3.26 名称服务API

路径 请求方法
/clusters/{clusterName}/services/{serviceName}/nameservices GET
/clusters/{clusterName}/services/{serviceName}/nameservices/{nameservice} GET
/clusters/{clusterName}/services/{serviceName}/nameservices/{nameservice}/metrics GET

3.27 Parcels API

路径 请求方法
/clusters/{clusterName}/parcels GET
/clusters/{clusterName}/parcels/usage GET
/clusters/{clusterName}/parcels/products/{product}/versions/{version} GET
/clusters/{clusterName}/parcels/products/{product}/versions/{version}/commands/activate POST
/clusters/{clusterName}/parcels/products/{product}/versions/{version}/commands/cancelDistribution POST
/clusters/{clusterName}/parcels/products/{product}/versions/{version}/commands/cancelDownload POST
/clusters/{clusterName}/parcels/products/{product}/versions/{version}/commands/deactivate POST
/clusters/{clusterName}/parcels/products/{product}/versions/{version}/commands/removeDownload POST
/clusters/{clusterName}/parcels/products/{product}/versions/{version}/commands/startDistribution POST
/clusters/{clusterName}/parcels/products/{product}/versions/{version}/commands/startDownload POST
/clusters/{clusterName}/parcels/products/{product}/versions/{version}/commands/startRemovalOfDistribution POST

3.28 进程API

路径 请求方法
/clusters/{clusterName}/services/{serviceName}/roles/{roleName}/process GET
/clusters/{clusterName}/services/{serviceName}/roles/{roleName}/process/configFiles/{configFileName} GET

3.29 副本API

路径 请求方法
/clusters/{clusterName}/services/{serviceName}/replications DELETE, GET, POST
/clusters/{clusterName}/services/{serviceName}/replications/hdfsCopyListing POST
/clusters/{clusterName}/services/{serviceName}/replications/replicationState GET
/clusters/{clusterName}/services/{serviceName}/replications/{scheduleId} DELETE, GET, PUT
/clusters/{clusterName}/services/{serviceName}/replications/{scheduleId}/collectDiagnosticData POST
/clusters/{clusterName}/services/{serviceName}/replications/{scheduleId}/history GET
/clusters/{clusterName}/services/{serviceName}/replications/{scheduleId}/run POST

3.30 角色命令API

路径 请求方法
/clusters/{clusterName}/services/{serviceName}/roleCommands/hdfsBootstrapStandBy POST
/clusters/{clusterName}/services/{serviceName}/roleCommands/hdfsEnterSafemode POST
/clusters/{clusterName}/services/{serviceName}/roleCommands/hdfsFinalizeMetadataUpgrade POST
/clusters/{clusterName}/services/{serviceName}/roleCommands/hdfsFormat POST
/clusters/{clusterName}/services/{serviceName}/roleCommands/hdfsInitializeAutoFailover POST
/clusters/{clusterName}/services/{serviceName}/roleCommands/hdfsInitializeSharedDir POST
/clusters/{clusterName}/services/{serviceName}/roleCommands/hdfsLeaveSafemode POST
/clusters/{clusterName}/services/{serviceName}/roleCommands/hdfsSaveNamespace POST
/clusters/{clusterName}/services/{serviceName}/roleCommands/hueSyncDb POST
/clusters/{clusterName}/services/{serviceName}/roleCommands/jmapDump POST
/clusters/{clusterName}/services/{serviceName}/roleCommands/jmapHisto POST
/clusters/{clusterName}/services/{serviceName}/roleCommands/jstack POST
/clusters/{clusterName}/services/{serviceName}/roleCommands/lsof POST
/clusters/{clusterName}/services/{serviceName}/roleCommands/refresh POST
/clusters/{clusterName}/services/{serviceName}/roleCommands/restart POST
/clusters/{clusterName}/services/{serviceName}/roleCommands/start POST
/clusters/{clusterName}/services/{serviceName}/roleCommands/stop POST
/clusters/{clusterName}/services/{serviceName}/roleCommands/zooKeeperCleanup POST
/clusters/{clusterName}/services/{serviceName}/roleCommands/zooKeeperInit POST
/clusters/{clusterName}/services/{serviceName}/roleCommands/{commandName} POST

3.31 角色配置组API

路径 请求方法
/clusters/{clusterName}/services/{serviceName}/roleConfigGroups GET, POST
/clusters/{clusterName}/services/{serviceName}/roleConfigGroups/roles PUT
/clusters/{clusterName}/services/{serviceName}/roleConfigGroups/{roleConfigGroupName} DELETE, GET, PUT
/clusters/{clusterName}/services/{serviceName}/roleConfigGroups/{roleConfigGroupName}/config GET, PUT
/clusters/{clusterName}/services/{serviceName}/roleConfigGroups/{roleConfigGroupName}/roles GET, PUT

3.32 角色配置组API

路径 请求方法
/clusters/{clusterName}/services/{serviceName}/roles GET, POST
/clusters/{clusterName}/services/{serviceName}/roles/bulkDelete POST
/clusters/{clusterName}/services/{serviceName}/roles/{roleName} DELETE, GET
/clusters/{clusterName}/services/{serviceName}/roles/{roleName}/commands GET
/clusters/{clusterName}/services/{serviceName}/roles/{roleName}/commandsByName GET
/clusters/{clusterName}/services/{serviceName}/roles/{roleName}/config GET, PUT
/clusters/{clusterName}/services/{serviceName}/roles/{roleName}/metrics GET
/clusters/{clusterName}/services/{serviceName}/roles/{roleName}/commands/enterMaintenanceMode POST
/clusters/{clusterName}/services/{serviceName}/roles/{roleName}/commands/exitMaintenanceMode POST
/clusters/{clusterName}/services/{serviceName}/roles/{roleName}/commands/impalaDiagnostics POST
/clusters/{clusterName}/services/{serviceName}/roles/{roleName}/logs/full GET
/clusters/{clusterName}/services/{serviceName}/roles/{roleName}/logs/stacks GET
/clusters/{clusterName}/services/{serviceName}/roles/{roleName}/logs/stacksBundle GET
/clusters/{clusterName}/services/{serviceName}/roles/{roleName}/logs/stderr GET
/clusters/{clusterName}/services/{serviceName}/roles/{roleName}/logs/stdout GET

3.33 服务API

路径 请求方法
/clusters/{clusterName}/services GET, POST
/clusters/{clusterName}/services/{serviceName} DELETE, GET, PUT
/clusters/{clusterName}/services/{serviceName}/clientConfig GET
/clusters/{clusterName}/services/{serviceName}/commands GET
/clusters/{clusterName}/services/{serviceName}/commandsByName GET
/clusters/{clusterName}/services/{serviceName}/config GET, PUT
/clusters/{clusterName}/services/{serviceName}/impalaUtilization GET
/clusters/{clusterName}/services/{serviceName}/metrics GET
/clusters/{clusterName}/services/{serviceName}/roleTypes GET
/clusters/{clusterName}/services/{serviceName}/yarnUtilization GET
/clusters/{clusterName}/services/{serviceName}/commands/createOozieDb POST
/clusters/{clusterName}/services/{serviceName}/commands/createSolrHdfsHomeDir POST
/clusters/{clusterName}/services/{serviceName}/commands/createSqoopUserDir POST
/clusters/{clusterName}/services/{serviceName}/commands/decommission POST
/clusters/{clusterName}/services/{serviceName}/commands/deployClientConfig POST
/clusters/{clusterName}/services/{serviceName}/commands/disableJtHa POST
/clusters/{clusterName}/services/{serviceName}/commands/disableRmHa POST
/clusters/{clusterName}/services/{serviceName}/commands/disableSentryHa POST
/clusters/{clusterName}/services/{serviceName}/commands/enableJtHa POST
/clusters/{clusterName}/services/{serviceName}/commands/enableRmHa POST
/clusters/{clusterName}/services/{serviceName}/commands/enableSentryHa POST
/clusters/{clusterName}/services/{serviceName}/commands/enterMaintenanceMode POST
/clusters/{clusterName}/services/{serviceName}/commands/exitMaintenanceMode POST
/clusters/{clusterName}/services/{serviceName}/commands/firstRun POST
/clusters/{clusterName}/services/{serviceName}/commands/hbaseCreateRoot POST
/clusters/{clusterName}/services/{serviceName}/commands/hbaseUpgrade POST
/clusters/{clusterName}/services/{serviceName}/commands/hdfsCreateTmpDir POST
/clusters/{clusterName}/services/{serviceName}/commands/hdfsDisableAutoFailover POST
/clusters/{clusterName}/services/{serviceName}/commands/hdfsDisableHa POST
/clusters/{clusterName}/services/{serviceName}/commands/hdfsDisableNnHa POST
/clusters/{clusterName}/services/{serviceName}/commands/hdfsEnableAutoFailover POST
/clusters/{clusterName}/services/{serviceName}/commands/hdfsEnableHa POST
/clusters/{clusterName}/services/{serviceName}/commands/hdfsEnableNnHa POST
/clusters/{clusterName}/services/{serviceName}/commands/hdfsFailover POST
/clusters/{clusterName}/services/{serviceName}/commands/hdfsFinalizeRollingUpgrade POST
/clusters/{clusterName}/services/{serviceName}/commands/hdfsRollEdits POST
/clusters/{clusterName}/services/{serviceName}/commands/hdfsUpgradeMetadata POST
/clusters/{clusterName}/services/{serviceName}/commands/hiveCreateHiveUserDir POST
/clusters/{clusterName}/services/{serviceName}/commands/hiveCreateHiveWarehouse POST
/clusters/{clusterName}/services/{serviceName}/commands/hiveCreateMetastoreDatabase POST
/clusters/{clusterName}/services/{serviceName}/commands/hiveCreateMetastoreDatabaseTables POST
/clusters/{clusterName}/services/{serviceName}/commands/hiveUpdateMetastoreNamenodes POST
/clusters/{clusterName}/services/{serviceName}/commands/hiveUpgradeMetastore POST
/clusters/{clusterName}/services/{serviceName}/commands/hiveValidateMetastoreSchema POST
/clusters/{clusterName}/services/{serviceName}/commands/hueCreateHiveWarehouse POST
/clusters/{clusterName}/services/{serviceName}/commands/hueDumpDb POST
/clusters/{clusterName}/services/{serviceName}/commands/hueLoadDb POST
/clusters/{clusterName}/services/{serviceName}/commands/hueSyncDb POST
/clusters/{clusterName}/services/{serviceName}/commands/impalaCreateCatalogDatabase POST
/clusters/{clusterName}/services/{serviceName}/commands/impalaCreateCatalogDatabaseTables POST
/clusters/{clusterName}/services/{serviceName}/commands/impalaCreateUserDir POST
/clusters/{clusterName}/services/{serviceName}/commands/impalaDisableLlamaHa POST
/clusters/{clusterName}/services/{serviceName}/commands/impalaDisableLlamaRm POST
/clusters/{clusterName}/services/{serviceName}/commands/impalaEnableLlamaHa POST
/clusters/{clusterName}/services/{serviceName}/commands/impalaEnableLlamaRm POST
/clusters/{clusterName}/services/{serviceName}/commands/importMrConfigsIntoYarn POST
/clusters/{clusterName}/services/{serviceName}/commands/initSolr POST
/clusters/{clusterName}/services/{serviceName}/commands/installMrFrameworkJars POST
/clusters/{clusterName}/services/{serviceName}/commands/installOozieShareLib POST
/clusters/{clusterName}/services/{serviceName}/commands/migrateToSentry POST
/clusters/{clusterName}/services/{serviceName}/commands/offline POST
/clusters/{clusterName}/services/{serviceName}/commands/oozieCreateEmbeddedDatabase POST
/clusters/{clusterName}/services/{serviceName}/commands/oozieDisableHa POST
/clusters/{clusterName}/services/{serviceName}/commands/oozieDumpDatabase POST
/clusters/{clusterName}/services/{serviceName}/commands/oozieEnableHa POST
/clusters/{clusterName}/services/{serviceName}/commands/oozieLoadDatabase POST
/clusters/{clusterName}/services/{serviceName}/commands/oozieUpgradeDb POST
/clusters/{clusterName}/services/{serviceName}/commands/recommission POST
/clusters/{clusterName}/services/{serviceName}/commands/recommissionWithStart POST
/clusters/{clusterName}/services/{serviceName}/commands/restart POST
/clusters/{clusterName}/services/{serviceName}/commands/rollingRestart POST
/clusters/{clusterName}/services/{serviceName}/commands/sentryCreateDatabase POST
/clusters/{clusterName}/services/{serviceName}/commands/sentryCreateDatabaseTables POST
/clusters/{clusterName}/services/{serviceName}/commands/sentryUpgradeDatabaseTables POST
/clusters/{clusterName}/services/{serviceName}/commands/solrBootstrapCollections POST
/clusters/{clusterName}/services/{serviceName}/commands/solrBootstrapConfig POST
/clusters/{clusterName}/services/{serviceName}/commands/solrConfigBackup POST
/clusters/{clusterName}/services/{serviceName}/commands/solrMigrateSentryPrivilegesCommand POST
/clusters/{clusterName}/services/{serviceName}/commands/solrReinitializeStateForUpgrade POST
/clusters/{clusterName}/services/{serviceName}/commands/solrValidateMetadata POST
/clusters/{clusterName}/services/{serviceName}/commands/sqoopCreateDatabaseTables POST
/clusters/{clusterName}/services/{serviceName}/commands/sqoopUpgradeDb POST
/clusters/{clusterName}/services/{serviceName}/commands/start POST
/clusters/{clusterName}/services/{serviceName}/commands/stop POST
/clusters/{clusterName}/services/{serviceName}/commands/switchToMr2 POST
/clusters/{clusterName}/services/{serviceName}/commands/yarnApplicationDiagnosticsCollection POST
/clusters/{clusterName}/services/{serviceName}/commands/yarnCreateCmContainerUsageInputDirCommand POST
/clusters/{clusterName}/services/{serviceName}/commands/yarnCreateJobHistoryDirCommand POST
/clusters/{clusterName}/services/{serviceName}/commands/yarnFormatStateStore POST
/clusters/{clusterName}/services/{serviceName}/commands/yarnNodeManagerRemoteAppLogDirCommand POST
/clusters/{clusterName}/services/{serviceName}/commands/zooKeeperCleanup POST
/clusters/{clusterName}/services/{serviceName}/commands/zooKeeperInit POST
/clusters/{clusterName}/services/{serviceName}/commands/{commandName} POST
/clusters/{clusterName}/services/{serviceName}/reports/hdfsUsageReport GET
/clusters/{clusterName}/services/{serviceName}/reports/mrUsageReport GET

3.34 快照API

路径 请求方法
/clusters/{clusterName}/services/{serviceName}/snapshots/policies GET, POST
/clusters/{clusterName}/services/{serviceName}/snapshots/policies/{policyName} DELETE, GET, PUT
/clusters/{clusterName}/services/{serviceName}/snapshots/policies/{policyName}/history GET

3.35 时间序列API

路径 请求方法
/timeseries GET, POST
/timeseries/entityTypeAttributes GET
/timeseries/entityTypes GET
/timeseries/schema GET

3.36 工具API

路径 请求方法
/tools/echo GET
/tools/echoError GET

3.37 用户API

路径 请求方法
/users GET, POST
/users/sessions GET
/users/{userName} DELETE, GET, PUT
/users/expireSessions/{userName} POST

3.38 监视目录API

路径 请求方法
/clusters/{clusterName}/services/{serviceName}/watcheddir GET, POST
/clusters/{clusterName}/services/{serviceName}/watcheddir/{directoryPath} DELETE

3.39 YARN应用程序API

路径 请求方法
/clusters/{clusterName}/services/{serviceName}/yarnApplications GET
/clusters/{clusterName}/services/{serviceName}/yarnApplications/attributes GET
/clusters/{clusterName}/services/{serviceName}/yarnApplications/{applicationId}/kill POST

三、API 用法示例

1. 获取CDH的API版本

curl -u admin:admin -X GET --header 'Accept: application/json' 'http://localhost:7180/api/version'

2. 查看集群信息

这会显示CDH集群的信息,包括名称、版本等。

curl -u admin:admin -X GET --header 'Accept: application/json' 'http://localhost:7180/api/v33/clusters'
  • v33:API的版本号

返回结果示例如下:

{
  "items": [
    {
      "name": "Cluster",
      "version": "CDH4"
      ...
    },
    ...
  ]
}
  • name:集群的名称属性,这里的集群名称为Cluster

3. 查看群集中运行的服务

这会显示群集中运行的服务,以及状态和运行状况 信息(在企业版中)。

curl -u admin:admin -X GET --header 'Accept: application/json' 'http://localhost:7180/api/v33/clusters/Cluster/services'
  • Cluster:集群名称

查看集群中运行的服务的名称:

curl -u admin:admin -X GET --header 'Accept: application/json' 'http://localhost:7180/api/v33/clusters/Cluster/services' | grep name

4. 查看impala服务中的角色

这会查看impala服务中的角色信息

curl -u admin:admin -X GET --header 'Accept: application/json' 'http://localhost:7180/api/v33/clusters/Cluster/services/impala/roles'

5. 查看impala服务配置

这会显示了impala服务中所有角色的自定义配置类型。具有默认值的配置参数被排除在外。

curl -u admin:admin -X GET --header 'Accept: application/json' 'http://localhost:7180/api/v33/clusters/Cluster/services/impala/config'

显示完整配置视图的所有参数和描述:

curl -u admin:admin -X GET --header 'Accept: application/json' 'http://localhost:7180/api/v33/clusters/Cluster/services/impala/config?view=full'

6. 查询指标数据

这会获取impala服务的 health_bad_rate,health_concerning_rate 和 health_disabled_rate 指标数据。

curl -u admin:admin -X GET --header 'Accept: application/json' 'http://localhost:7180/api/v33/timeseries?query=select%20health_bad_rate,%20health_concerning_rate,%20health_disabled_rate%20where%20entityName=impala'

总结

在本文中,我们详细地介绍了 Cloudera Manager 的 REST API。首先,我们对 Cloudera Manager 的基础概念进行了说明,包括集群(cluster),服务(service) 和 角色(role)。紧接着,我们列举出所有可用的 REST 资源以及相应的请求方法。每个资源都有对应的路径和请求方法。

此外,文章还提供了一些实际示例来演示如何使用这些 API 进行特定操作。您可以根据自己需要选择合适的资源和方法来管理和监控您的 Cloudera Manager 集群。

希望本教程对您有所帮助!如有任何疑问或问题,请随时在评论区留言。感谢阅读!

参考链接:文章来源地址https://www.toymoban.com/news/detail-789633.html

  • Cloudera Manager API

到了这里,关于CHD-Cloudera Manager API 详解的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • CDH大数据平台 29Cloudera Manager Console之superset之MySQL元数据配置(markdown新版三)

    💖个人主页:@与自己作战 💯作者简介: CSDN@博客专家 、 CSDN@大数据领域优质创作者 、 CSDN@内容合伙人 、 阿里云@专家博主 🆘希望大佬们多多支持,携手共进 📝 如果文章对你有帮助的话,欢迎评论💬点赞👍收藏📂加关注 ⛔ 如需要支持请私信我 , 💯 必支持

    2024年02月02日
    浏览(59)
  • CDH大数据平台 30Cloudera Manager Console之superset之redis、ldap配置(markdown新版四)

    💖个人主页:@与自己作战 💯作者简介: CSDN@博客专家 、 CSDN@大数据领域优质创作者 、 CSDN@内容合伙人 、 阿里云@专家博主 🆘希望大佬们多多支持,携手共进 📝 如果文章对你有帮助的话,欢迎评论💬点赞👍收藏📂加关注 ⛔ 如需要支持请私信我 , 💯 必支持

    2024年02月02日
    浏览(58)
  • CDH大数据平台 22Cloudera Manager Console之azkaban与freeIPA、Kerberos等组合配置(markdown新版三)

    💖个人主页:@与自己作战 💯作者简介: CSDN@博客专家 、 CSDN@大数据领域优质创作者 、 CSDN@内容合伙人 、 阿里云@专家博主 🆘希望大佬们多多支持,携手共进 📝 如果文章对你有帮助的话,欢迎评论💬点赞👍收藏📂加关注 ⛔ 如需要支持请私信我 , 💯 必支持

    2024年02月03日
    浏览(54)
  • CDH大数据平台 23Cloudera Manager Console之azkaban与freeIPA、Kerberos等组合配置(markdown新版四)

    💖个人主页:@与自己作战 💯作者简介: CSDN@博客专家 、 CSDN@大数据领域优质创作者 、 CSDN@内容合伙人 、 阿里云@专家博主 🆘希望大佬们多多支持,携手共进 📝 如果文章对你有帮助的话,欢迎评论💬点赞👍收藏📂加关注 ⛔ 如需要支持请私信我 , 💯 必支持

    2023年04月09日
    浏览(31)
  • Cloudera Manager报错汇总

    一、不良 : 该主机与 Cloudera Manager Server 失去联系的时间过长。 该主机未与 Host Monitor 建立联系。 原因:agent的uuid与注册到server的信息不一致 验证:查看uuid与mysql元数据库中注册HOST_IDENTIFIER是否一致 agent的uuid位置:/var/lib/cloudera-scm-agent/uuid 元数据库中HOST_IDENTIFIER位置:scm库

    2024年02月14日
    浏览(46)
  • Hadoop发行版 Cloudera CDH 6.3.2及CM 安装包下载(阿里云盘 不限速)

    CDH(全称Cloudera’s Distribution, including Apache Hadoop)是由Cloudera公司构建的Hadoop稳定发行版,不仅含有 Apache Hadoop,还整合了Hive、Spark等组件。 由于CDH已停止维护,且Cloudera不再为CDH提供免费的下载服务,因此网上很难直接下载到CDH和管理工具CM的安装包。 百度云盘上的资源下载

    2024年02月03日
    浏览(75)
  • [已解决]该主机与 Cloudera Manager Server 失去联系的时间过长。 该主机未与 Host Monitor 建立联系。

    调整hvie 的参数后导致该主机与 Cloudera Manager Server 失去联系的时间过长 主机离家出走了! 出现问题后立马参数修改回来; 但是还是发现有这样的报错: 网上百度,各种操作,大概总结为2点:千万别信 1 修改hostname,删除cm_guid 2 删除主机重新添加-我的是线上环境不能删除,

    2024年02月05日
    浏览(60)
  • 修正版本 6.3.2 CHD 超详细!搭建本地大数据研发环境(16G内存+CDH)易错见红字

    简介:  工欲善其事必先利其器,在经过大量的理论学习以后,需要有一个本地的研发环境来进行练手。已经工作的可以不依赖于公司的环境,在家也可以随意的练习。而自学大数据的同学,也可以进行本地练习,大数据是一门偏实践的学科,在找工作之前进行一些实践操作

    2024年04月13日
    浏览(31)
  • 撕掉Hadoop标签,Cloudera未来可期吗?

    说起Cloudera,就不得不提起Hadoop,Cloudera的过去就是Hadoop时代中的一个缩影。作为全球第一家也是最大一家Hadoop商业化公司,Cloudera一直是Hadoop生态的领导者 1.1、Hadoop之父与Cloudera之父 2006年,计算机科学家Doug Cutting和Mike Cafarella创建了Apache Nutch项目并带着项目加入了雅虎,希望

    2024年02月06日
    浏览(42)
  • Streampark集成Cloudera Flink、ldap、告警,以及部署常见问题

    集成背景 我们当前集群使用的是Cloudera CDP,Flink版本为Cloudera Version 1.14,整体Flink安装目录以及配置文件结构与社区版本有较大出入。直接根据Streampark官方文档进行部署,将无法配置Flink Home,以及后续整体Flink任务提交到集群中,因此需要进行针对化适配集成,在满足使用需

    2023年04月09日
    浏览(45)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包