Community Articles
Find and share helpful community-sourced technical articles
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.
Labels (1)
Rising Star

This article helps with configuration of HDF processors to integrate with HDP components

Integration for puthivestreaming processor:

Pre-requisites: In HDP ambari, enable the below properties for hive.

hive.txn.manager = org.apache.hadoop.hive.ql.lockmgr.DbTxnManager 
hive.compactor.initiator.on = true
hive.compactor.worker.threads > 0

BUG: HiveStreaming processor not picking the updated hive-meta store principal from hive-site. xml


1. Copy hive-site.xml, core-site.xml, hdfs-site.xml to the conf directory of NiFi
2. Clear the Hive Configuration Resources property
3. Create an ExecuteStream processor on the canvas scheduled to run as often as the ticket needs to be refreshed (every hour should do for most setups) with the following groovy script, replacing nifi@HDF.COM with your principal and /etc/nifi.headless.keytab with your keytab

Steps: Create /etc/hdp/tgt.groovy and copy the code below into the file on all nifi nodes.

Note: Change the kerberos principal and keytab location as necessary

import org.apache.nifi.nar.NarClassLoader
import org.apache.nifi.nar.NarClassLoaders NarClassLoaders.instance.extensionClassLoaders.each { c ->
if (c instanceof NarClassLoader && c.workingDirectory. absolutePath.contains('nifi-hive')) {
   def originalClassloader = Thread.currentThread().
Thread.currentThread().setContextClassLoader(c); try {
def configClass = c.loadClass('org.apache.hadoop.conf. Configuration', true)
def hiveConfigurator = c.loadClass('org.apache.nifi.util. hive.HiveConfigurator', true).newInstance();
     def config = hiveConfigurator.getConfigurationFromFiles('')
, true).getMethod('setConfiguration', configClass).invoke(null, config)
c.loadClass('' , true).getMethod('loginUserFromKeytab', String.class, String.clas s).invoke(null, 'nifi@HDF.NET', '/etc/security/keytabs/nifi. headless.keytab')'Successfully logged in')
session.transfer(session.create(), REL_SUCCESS) } catch (Exception e) {
     log.error('Unable to login with keytab', e)
session.transfer(session.create(), REL_FAILURE) } finally {
} }

Do the following on all the nifi nodes,

chown nifi:nifi /etc/hdp/tgt.groovy; chmod +x /etc/hdp/tgt.groovy;
cp /etc/hdp/hive-site.xml /etc/nifi/conf/; cp /etc/hdp/core-site.xml /etc/nifi/conf/; cp /etc/hdp /hdfs-site.xml /etc/nifi/conf/;
chown nifi:nifi /etc/nifi/conf/hive-site.xml /etc/nifi/conf/core-site.xml /etc/nifi/conf/hdfs-site. xml; 

Integration for hbase processor:

Add hostname and IP of all HDP nodes to /etc/hosts file in all nifi nodes

<Hostname1>	<IpAddress1>
<Hostname2>	<IpAddress2>

Integration for kafka processor:

Create a file under the location "/etc/hdp/zookeeper-jaas.conf" and copy the code below

Note: Change the kerberos principal and keytab location as necessary

Client { required useKeyTab=true keyTab="/etc/security/keytabs/nifi.headless.keytab" storeKey=true
KafkaClient { required useTicketCache=true
useKeyTab=true keyTab="/etc/security/keytabs/nifi.headless.keytab" principal="nifi@HDF.COM";

Add below configuration to advanced nifi-bootstrap.conf in HDP ambari and restart the nifi service.

0 Kudos
Don't have an account?
Coming from Hortonworks? Activate your account here
Version history
Revision #:
2 of 2
Last update:
‎03-01-2020 11:15 PM
Updated by:
Top Kudoed Authors