Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

How to configure apache Sentry using cloudera manager api in python?

avatar
New Contributor

Hello,

I'm using cm_api in python to install cloudera cdh5.7. I have an apiException while configuring sentry server.
All parameters for sentry database like "sentry_server_database_port" or "sentry_server_database_password" are unknown.

Somebody can tell me how to solve the problem?

Do i need a particular cm_api version?

Thanks!

1 ACCEPTED SOLUTION

avatar
Master Collaborator

You don't need a particular version, only need to update the Sentry configuration example

 

 

from cm_api.api_client import ApiResource
api = ApiResource("cm-server-host")
cluster = api.get_cluster("_CLUSTER_NAME_")
service = cluster.create_service("sentry","SENTRY")
# Service-Wide
# sentry_server_database_host: Assuming embedded DB is running from where embedded-db is located.
service_config = {"sentry_server_database_host": "sentry-db.host.here",
"sentry_server_database_user": "sentry",
"sentry_server_database_name": "sentry",
"sentry_server_database_password": "cloudera",
"sentry_server_database_port": "7432",
"sentry_server_database_type": "postgresql"}
service.update_config(service_config)
# eg: fetch all hosts>hostId
# print [host.hostId for host in api.get_all_hosts()]
host = [host for host in api.get_all_hosts()][0]
service.create_role("sentry", "SENTRY_SERVER", host.hostId) Ref: https://github.com/gdgt/cmapi

 

 

 

 

 

View solution in original post

4 REPLIES 4

avatar
Master Collaborator

You don't need a particular version, only need to update the Sentry configuration example

 

 

from cm_api.api_client import ApiResource
api = ApiResource("cm-server-host")
cluster = api.get_cluster("_CLUSTER_NAME_")
service = cluster.create_service("sentry","SENTRY")
# Service-Wide
# sentry_server_database_host: Assuming embedded DB is running from where embedded-db is located.
service_config = {"sentry_server_database_host": "sentry-db.host.here",
"sentry_server_database_user": "sentry",
"sentry_server_database_name": "sentry",
"sentry_server_database_password": "cloudera",
"sentry_server_database_port": "7432",
"sentry_server_database_type": "postgresql"}
service.update_config(service_config)
# eg: fetch all hosts>hostId
# print [host.hostId for host in api.get_all_hosts()]
host = [host for host in api.get_all_hosts()][0]
service.create_role("sentry", "SENTRY_SERVER", host.hostId) Ref: https://github.com/gdgt/cmapi

 

 

 

 

 

avatar
New Contributor

Thanks

 

I used an external postgresql databases. Everything worked fine!

avatar
New Contributor

Is there any step by step guide

avatar
Contributor
Hey , How to enable Sentry HA using cm_api module in python ?