Reply
Explorer
Posts: 11
Registered: ‎04-20-2017

Accessing hue DB and adding Hue users programatically

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?

Cloudera Employee
Posts: 31
Registered: ‎05-29-2017

Re: Accessing hue DB and adding Hue users programatically

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.


Explorer
Posts: 11
Registered: ‎04-20-2017

Re: Accessing hue DB and adding Hue users programatically

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?

Highlighted
Cloudera Employee
Posts: 31
Registered: ‎05-29-2017

Re: Accessing hue DB and adding Hue users programatically

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?

Announcements