Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

0036-how to gracefully obtain Metabase password through CM API

2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/03 Report--

Warm Tip: to see the high-definition no-code picture, please open it with your mobile phone and click the picture to enlarge.

1. Problem description

People, as you get older, it is easy to forget some things, such as you accidentally forget the Metabase passwords of CDH cluster Hive,Hue and Sentry services. For database (MySQL/Oracle/PostgreSQL) administrators, there may be some unique tricks to retrieve passwords. But for us ordinary people, Cloudera Manger actually provides a very elegant way for you to find your Metabase password, which is the magical Cloudera Manager API.

two。 Solution method

2.1 through HTTP

1. Get all cluster information of Cloudera Manager

Enter the following address in the browser and replace it with the IP address of CM

Http://:7180/api/v10/clusters/

Enter the account password of CM

Get cluster information:

{"items": [{"name": "cluster", "displayName": "Cluster 1", "version": "CDH5", "fullVersion": "5.11.2", "maintenanceMode": false, "maintenanceOwners": [], "clusterUrl": "http://ip-172-31-22-86.ap-southeast-1.compute.internal:7180/cmf/clusterRedirect/cluster"}]}

two。 Obtain the Services of the specified cluster from the cluster information obtained in the previous step

Enter the following address in the browser and replace it with the IP address of CM and the cluster name obtained in the previous step

Http://:7180/api/v10/clusters//services/

{"items": [... {"name": "hue", "type": "HUE", "clusterRef": {"clusterName": "cluster"}, "serviceUrl": "http://ip-172-31-22-86.ap-southeast-1.compute.internal:7180/cmf/serviceRedirect/hue"," serviceState ": STARTED", "healthSummary": "GOOD" "healthChecks": [{"name": "HUE_HUE_SERVERS_HEALTHY", "summary": "GOOD"}], "configStalenessStatus": "FRESH", "clientConfigStalenessStatus": "FRESH", "maintenanceMode": false, "maintenanceOwners": [], "displayName": "Hue"}...] }

The above is the obtained json data fragment, and the red part is the Services name.

3. Obtain the configuration information of the service through the service name

Enter the following address in the browser, which will be replaced with the IP address of CM, the cluster name, and the name of the specified service

Http://:7180/api/v10/clusters//services//config

{"items": [{"name": "database_host", "value": "ip-172-31-22-86.ap-southeast-1.compute.internal"}, {"name": "database_password", "value": "password"}, {"name": "database_type", "value": "mysql"}.]}

In this way, the configuration information of the corresponding service is obtained, and the red part is the database password of the service.

2.2 Command line mode

1. Get cluster information

Replace with the user name of CM, the corresponding user password of CM, and the IP address of CM

Curl-v-k-X GET-u: http://:7180/api/v10/clusters/

Command line execution

[ec2-user@ip-172-31-22-86] $curl-v-k-X GET-u admin:admin http://ip-172-31-22-86:7180/api/v10/clusters/...{ "items": [{"name": "cluster", "displayName": "Cluster 1", "version": "CDH5", "fullVersion": "5.11.2", "maintenanceMode": false "maintenanceOwners": [], "clusterUrl": "http://ip-172-31-22-86.ap-southeast-1.compute.internal:7180/cmf/clusterRedirect/cluster"}] * Connection # 0 to host ip-172-31-22-86 left intact} [ec2-user@ip-172-31-22-86] $

The annotated part is the obtained cluster name.

two。 Get the Services of the specified cluster

Replace the corresponding parameters in the following command with the cluster name obtained in the previous step

Curl-v-k-X GET-u: http://:7180/api/v10/clusters//services/

Command line execution:

[ec2-user@ip-172-31-22-86] $curl-v-k-X GET-u admin:admin http://ip-172-31-22-86:7180/api/v10/clusters/cluster/services/...{ "items": [{"name": "hive", "type": "HIVE", "clusterRef": {"clusterName": "cluster"} "serviceUrl": "http://ip-172-31-22-86.ap-southeast-1.compute.internal:7180/cmf/serviceRedirect/hive"," serviceState ":" STARTED "," healthSummary ":" GOOD "," healthChecks ": [{" name ":" HIVE_HIVEMETASTORES_HEALTHY "," summary ":" GOOD "}, {" name ":" HIVE_HIVESERVER2S_HEALTHY " "summary": "GOOD"}], "configStalenessStatus": "FRESH", "clientConfigStalenessStatus": "FRESH", "maintenanceMode": false, "maintenanceOwners": [], "displayName": "Hive"}.]} [ec2-user@ip-172-31-22-86 ~] $

The marked part is the name of the service.

3. Get the configuration of the service based on the obtained Service name

Replace the parameter in the following command with your own environment information, and replace it with the service name obtained in the previous step.

Curl-v-k-X GET-u: http://:7180/api/v10/clusters//services//config

Command line execution:

[ec2-user@ip-172-31-22-86] $curl-v-k-X GET-u admin:admin http://ip-172-31-22-86:7180/api/v10/clusters/cluster/services/hive/config...{ "items": [{"name": "hive_metastore_database_host", "value": "ip-172-31-22-86.ap-southeast-1.compute.internal"} {"name": "hive_metastore_database_password", "value": "password"}, {"name": "mapreduce_yarn_service", "value": "yarn"}, {"name": "zookeeper_service", "value": "zookeeper"}] * Connection # 0 to host ip-172-31-22-86 left intact} [ec2-user@ip-172-31-22-86] $

The marked part of the above figure is the password of the hive service Metabase.

3. Summary

The Hue, Hive and Sentry service Metabase passwords can be obtained by the above two methods, but the database passwords of Oozie, AM, CM, RM, Navigator and other services are not supported. Note: the above operations need to be obtained by the administrator user of CM, and the password obtained by the non-administrator user is displayed as "REDACTED".

For more information about the API API of CM, please see the official website:

Https:// × × w.cloudera.com/documentation/enterprise/latest/topics/cm\ _ intro\ _ api.html

Drunken whips are famous horses, and teenagers are so pompous! Lingnan Huan Xisha, under the vomiting liquor store! The best friend refuses to let go, the flower of data play!

Warm Tip: to see the high-definition no-code picture, please open it with your mobile phone and click the picture to enlarge.

It is recommended to follow Hadoop practice, the first time, share more Hadoop practical information, welcome to forward and share.

Original article, welcome to reprint, reprint please indicate: reproduced from the official account of Wechat Hadoop

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report