Cloudera Manager是一个用于管理和监控Hadoop集群的强大工具。它提供了一套REST API,使用户能够通过编程方式与Cloudera Manager进行交互,并执行各种操作,如创建集群、添加服务、配置角色等。
集群是一组运行相互依赖服务的主机。集群中的所有服务具有相同的 CDH 版本。一个 Cloudera Manager 可以安装多个集群,它们通过不同的名称唯一标识。
Cloudera Manager可以管理多个集群,但是每个集群只能与单个Cloudera Manager Server或Cloudera Manager HA对相关联。一旦成功安装了第一个集群,就可以添加其他集群,运行相同或不同版本的CDH。然后,您可以独立管理每个集群及其服务。
服务是在集群中提供抽象功能的实体。服务的例子包括 HDFS、MapReduce、YARN 和 HBase。服务通常是分布式的,并包含一组物理运行在集群上的角色。服务具有自己的配置、状态和角色。您可以针对服务或批量针对角色发布命令。此外,HDFS 服务有名称服务,MapReduce 服务有活动。
所有服务都属于一个集群(除了 Cloudera 管理服务),并在 Cloudera Manager 安装中具有唯一的名称。服务的类型取决于集群的 CDH 版本。
角色为服务执行特定操作,并分配给主机。它通常作为守护进程运行,如 DataNode 或 TaskTracker。(当然也有例外,并非所有角色都是守护进程。)角色一旦创建,便不能重新分配到其他主机。如果想重新分配到其他主机,需要删除并重新创建这个角色。
角色拥有自己的配置和状态。角色上的 API 命令总是在服务级别以批量方式发布。
角色类型指的是角色所属的类。例如,HBase 服务有 Master 角色类型和 RegionServer 角色类型。不同服务类型具有不同的角色类型集合。不要将其与角色混淆,角色指的是物理分配给主机的特定角色实例。
您可以指定角色类型的配置,该配置由该类型的所有角色实例继承。
Cloudera Manager 代理运行在由 Cloudera Manager 管理的主机上。您可以为主机分配服务角色。
与 Cloudera Manager 操作相关的所有内容都可在资源下找到。这包括全局命令、系统配置和 Cloudera 管理服务。
在企业版中提供 Hadoop 集群的监控、诊断和报告功能。该服务的操作与其他 Hadoop 服务类似,但管理服务不属于集群。
指标是衡量实体或活动状态的属性,例如打开的文件描述符数量或 CPU 利用率百分比。通过 Cloudera Manager API /timeseries/schema 端点可以获取完整的指标模式列表。
Cloudera Manager 可以使用名为 tsquery 的语言检索指标数据。
您可以在 Cloudera Manager 中启用调试功能,以查看 API 相关活动的详细日志。调试设置在 Cloudera Manager 管理控制台中的“启用 API 调试”页面。启用后,Cloudera Manager 服务器日志将包含所有 API 请求和响应的完整跟踪以及请求处理调试。由于可能生成大量日志数据,建议仅在开发过程中启用。
summary
(默认视图)或 full
。
summary
视图提供了关于每个条目的核心信息。full
视图提供了每个条目的完全展开视图。view
的查询参数控制,例如:curl -u admin:admin -X GET --header 'Accept: application/json' 'http://localhost:7180/api/v33/users?view=full'
在出现错误时,API会返回400和500系列的HTTP代码:
可以通过向/version
URL发送GET请求来查询API支持的最高版本。返回的字符串包含了最高支持的版本(例如,“v2”)。
curl -u admin:admin -X GET --header 'Accept: application/json' 'http://localhost:7180/api/version'
资源的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
查看集群中有哪些服务。路径 | 请求方法 |
---|---|
/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 |
路径 | 请求方法 |
---|---|
/cm/allHosts/config | GET, PUT |
路径 | 请求方法 |
---|---|
/audits | GET |
/audits/stream | GET |
路径 | 请求方法 |
---|---|
/authRoleMetadatas | GET |
身份验证服务用于管理单点登录功能。
此服务尚未对一般用户开放。
控制身份验证服务的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 |
路径 | 请求方法 |
---|---|
/cm/authService/roleCommands/restart | POST |
/cm/authService/roleCommands/start | POST |
/cm/authService/roleCommands/stop | POST |
路径 | 请求方法 |
---|---|
/cm/authService/roleConfigGroups | GET |
/cm/authService/roleConfigGroups/{roleConfigGroupName} | GET, PUT |
/cm/authService/roleConfigGroups/{roleConfigGroupName}/config | GET, PUT |
/cm/authService/roleConfigGroups/{roleConfigGroupName}/roles | GET |
路径 | 请求方法 |
---|---|
/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 |
路径 | 请求方法 |
---|---|
/batch | POST |
路径 | 请求方法 |
---|---|
/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 |
路径 | 请求方法 |
---|---|
/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 |
路径 | 请求方法 |
---|---|
/cm/peers | GET, POST |
/cm/peers/{peerName} | DELETE, GET, PUT |
/cm/peers/{peerName}/commands/test | POST |
路径 | 请求方法 |
---|---|
/commands/{commandId} | GET |
/commands/{commandId}/abort | POST |
/commands/{commandId}/retry | POST |
路径 | 请求方法 |
---|---|
/timeseries/dashboards | GET, POST |
/timeseries/dashboards/{dashboardName} | DELETE, GET |
路径 | 请求方法 |
---|---|
/dataContexts | GET, POST |
/dataContexts/{dataContextName} | DELETE, GET |
路径 | 请求方法 |
---|---|
/events | GET |
/events/{eventId} | GET |
管理各种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 |
路径 | 请求方法 |
---|---|
/externalUserMappings | GET, POST |
/externalUserMappings/{uuid} | DELETE, GET, PUT |
路径 | 请求方法 |
---|---|
/clusters/{clusterName}/hostTemplates | GET, POST |
/clusters/{clusterName}/hostTemplates/{hostTemplateName} | DELETE, GET, PUT |
/clusters/{clusterName}/hostTemplates/{hostTemplateName}/commands/applyHostTemplate | POST |
路径 | 请求方法 |
---|---|
/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 |
路径 | 请求方法 |
---|---|
/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 |
路径 | 请求方法 |
---|---|
/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 |
路径 | 请求方法 |
---|---|
/cm/service/roleConfigGroups | GET |
/cm/service/roleConfigGroups/{roleConfigGroupName} | GET, PUT |
/cm/service/roleConfigGroups/{roleConfigGroupName}/config | GET, PUT |
/cm/service/roleConfigGroups/{roleConfigGroupName}/roles | GET |
路径 | 请求方法 |
---|---|
/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 |
路径 | 请求方法 |
---|---|
/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 |
路径 | 请求方法 |
---|---|
/clusters/{clusterName}/services/{serviceName}/nameservices | GET |
/clusters/{clusterName}/services/{serviceName}/nameservices/{nameservice} | GET |
/clusters/{clusterName}/services/{serviceName}/nameservices/{nameservice}/metrics | GET |
路径 | 请求方法 |
---|---|
/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 |
路径 | 请求方法 |
---|---|
/clusters/{clusterName}/services/{serviceName}/roles/{roleName}/process | GET |
/clusters/{clusterName}/services/{serviceName}/roles/{roleName}/process/configFiles/{configFileName} | GET |
路径 | 请求方法 |
---|---|
/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 |
路径 | 请求方法 |
---|---|
/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 |
路径 | 请求方法 |
---|---|
/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 |
路径 | 请求方法 |
---|---|
/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 |
路径 | 请求方法 |
---|---|
/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 |
路径 | 请求方法 |
---|---|
/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 |
路径 | 请求方法 |
---|---|
/timeseries | GET, POST |
/timeseries/entityTypeAttributes | GET |
/timeseries/entityTypes | GET |
/timeseries/schema | GET |
路径 | 请求方法 |
---|---|
/tools/echo | GET |
/tools/echoError | GET |
路径 | 请求方法 |
---|---|
/users | GET, POST |
/users/sessions | GET |
/users/{userName} | DELETE, GET, PUT |
/users/expireSessions/{userName} | POST |
路径 | 请求方法 |
---|---|
/clusters/{clusterName}/services/{serviceName}/watcheddir | GET, POST |
/clusters/{clusterName}/services/{serviceName}/watcheddir/{directoryPath} | DELETE |
路径 | 请求方法 |
---|---|
/clusters/{clusterName}/services/{serviceName}/yarnApplications | GET |
/clusters/{clusterName}/services/{serviceName}/yarnApplications/attributes | GET |
/clusters/{clusterName}/services/{serviceName}/yarnApplications/{applicationId}/kill | POST |
curl -u admin:admin -X GET --header 'Accept: application/json' 'http://localhost:7180/api/version'
这会显示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这会显示群集中运行的服务,以及状态和运行状况 信息(在企业版中)。
curl -u admin:admin -X GET --header 'Accept: application/json' 'http://localhost:7180/api/v33/clusters/Cluster/services'
查看集群中运行的服务的名称:
curl -u admin:admin -X GET --header 'Accept: application/json' 'http://localhost:7180/api/v33/clusters/Cluster/services' | grep name
这会查看impala服务中的角色信息
curl -u admin:admin -X GET --header 'Accept: application/json' 'http://localhost:7180/api/v33/clusters/Cluster/services/impala/roles'
这会显示了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'
这会获取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 集群。
希望本教程对您有所帮助!如有任何疑问或问题,请随时在评论区留言。感谢阅读!
参考链接: