Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

Accessing hue DB and adding Hue users programatically

Accessing hue DB and adding Hue users programatically

Explorer

Hi,

 

I have a cluster created with Cloudera Director. Every database, including the Hue DB is external, and I think all the credentials were generated by Director. Now I'd like to add users using the Hue shell or some other script, but it asks for the Hue secrets, that are set in the Manager, but they are secured.

- How can I check these generated users/passwords for the databases?

- If I have the password, what's the easiest way to add Hue users programatically?

3 REPLIES 3

Re: Accessing hue DB and adding Hue users programatically

Contributor

Hello ztoth,

If you have the administrator credentials of Cloudera Manager, you can use it to request the SQL credentials of the Hue service. For example, the below REST API call returns the password in the configuration variable named "database_password" for any Hue service:
https://cloudera.github.io/cm_api/apidocs/v17/path__clusters_-clusterName-_services_-serviceName-_co...

Unfortunately, the Hue API does not have a programmatical way to add regular users, but you can use external authentication backends such as LDAP.


Re: Accessing hue DB and adding Hue users programatically

Explorer

Hi Zsolt,

 

thanks for the answer! I could find the Hue DB creds in the API, but for some reason I'm still unable to connect to the database. I'm trying to connect with the following command, with the configs returned by the API:

mysql -h <database_host> -u <database_user> -p <database_name>

and giving the <database_password> when prompted. Also tried without specifying the <database_name>, but no luck, getting Access Denied every time. Is there something I miss?

Re: Accessing hue DB and adding Hue users programatically

Contributor

Hi,

Hue is connecting directly to the mysql server that this configuration provides. Which machine do you use to login mysql? Is it the same node where Hue is installed?