- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
Created on ‎05-08-2020 10:36 AM - edited ‎09-21-2020 12:41 PM
Here is a fun one: how do you connect from Python in Cloudera Machine Learning to our Kafka datahub cluster?
The documentation is pretty thorough, but it does not have an example of a python client. That's what I'm going to highlight in this article.
The good news is that since CML and Datahub run in the same network, you don't need to worry about opening the broker ports, therefore you just need to follow these steps:
- Step 1: Get and upload your freeIPA certificate
- Step 2: Find your broker hostnames
- Step 3: Setup your client
Step 1: Get and upload your freeIPA certificate
- Go to your management console > your environment > Actions > Get FreeIPA Certificate:
- Once downloaded, go to your CML workspace, and upload your file (e.g. /home/cdsw/ca.crt).
Step 2: Find your broker hostnames
Step 3: Setup your client
Then, open a session in CML, and use the following parameters:
from kafka import KafkaProducer
producer = KafkaProducer(bootstrap_servers=['<YOUR_BROKER_URL>:9093','<YOUR_BROKER_URL>:9093','<YOUR_BROKER_URL>:9093'],
security_protocol="SASL_SSL",
sasl_mechanism="PLAIN",
ssl_check_hostname=True,
ssl_cafile='/home/cdsw/ca.crt',
sasl_plain_username="<YOUR_WORKLOAD_USER>",
sasl_plain_password="<YOUR_WORKLOAD_PASSWORD>",
api_version_auto_timeout_ms=30000)
Created on ‎02-08-2021 12:12 PM - edited ‎02-08-2021 12:16 PM
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
@pvidal - Thanks for this quick guide.
Following scenario for external client TLS connectivity over PAM authentication (SASL_SSL) would be much helpful if added in documentation as an end-to-end reference ;
1. As CDP internally manages the Certificate Authority,
2. So truststore/keystore credentials are not available with Admins unlike on-premises clusters,
3. In that case how to import client certificates for mutual TLS setup,
4. Also not able to see 'Get FreeIPA Certificate' though having all roles/account admin access.
Thanks,
Joy
Created on ‎02-08-2021 10:37 PM
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Hi @joyabrata
Obtain the FreeIPA certificate of your environment:
- From the CDP Home Page navigate to Management Console > Environments.
- Locate and select your environment from the list of available environments.
- Go to the Summary tab, scroll down to FreeIPA session then click Actions
- Select Get FreeIPA Certificate from the drop-down menu.
Created on ‎02-09-2021 01:01 AM
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
@jagadeesan - Followed the same doc, please refer below screenshot.
Created on ‎02-09-2021 04:57 AM
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Hi @joyabrata
I think you are looking in the Data Lake tab which is a different one, you can go to the Summary tab, then scroll down to FreeIPA session then click Actions and get Get FreeIPA Certificate from the drop-down menu. Hope this will help you.