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.

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

Solved Go to solution

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

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

Accepted Solutions

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

Super 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

 

 

 

 

 

4 REPLIES 4

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

Super 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

 

 

 

 

 

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

New Contributor

Thanks

 

I used an external postgresql databases. Everything worked fine!

Highlighted

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

New Contributor

Is there any step by step guide

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

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