天天看点

​Installing the Ranger Kafka Plug-in

This section describes how to install and enable the Ranger Kafka plug-in.

The Ranger Kafka plug-in is automatically installed when Kafka is installed. You can verify this plug-in is present by using the following command:

rpm -qa | grep kafka-pluginranger_2_4_2_0_258-kafka-plugin-0.5.0.2.4.2.0-258.el6.x86_64

Navigate to <code>/usr/hdp/&lt;version&gt;/ranger-kafka-plugin</code>.

cd /usr/hdp/&lt;version&gt;/ranger-kafka-plugin

Edit the following entries in the <code>install.properties</code> file.

Table 13.5. Properties to Edit in the install.properties File

<col>

Configuration Property Name

Default/Example Value

Required?

Policy Admin Tool

COMPONENT_INSTALL_DIR_NAME

/usr/hdp/2.4.2.0-258/kafka

Y

POLICY_MGR_URL URL for policy admin

http://&lt;FQDN of ranger admin host&gt;:6080

REPOSITORY_NAME The repository name used in Policy Admin Tool for defining policies

kafkadev

Audit Database

SQL_CONNECTOR_JAR Path to SQL connector jar of the DB Flavor selected. The value should be the absolute path including the jar name.

/usr/share/java/mysql-connector-java.jar (default)

/usr/share/java/postgresql.jar

/usr/share/java/sqljdbc4.jar

/usr/share/java/ojdbc6.jar

XAAUDIT.DB.IS_ENABLEDEnable or disable database audit logging.

FALSE (default), TRUE

XAAUDIT.DB.FLAVOUR Specifies the type of database used for audit logging (MYSQL,ORACLE)

MYSQL (default)

XAAUDIT.DB.HOSTNAME Hostname of the audit database server

localhost

XAAUDIT.DB.DATABASE_NAMEAudit database name

ranger_audit

XAAUDIT.DB.USER_NAME Username used for performing audit log inserts (should be same username used in the ranger-admin installation process)

rangerlogger

XAAUDIT.DB.PASSWORD Database password associated with the above database user - for db audit logging

HDFS Audit

XAAUDIT.HDFS.IS_ENABLED Flag to enable/disable hdfs audit logging. If the hdfs audit logging is turned off, it will not log any access control to hdfs

XAAUDIT.HDFS.DESTINATION _DIRECTORY HDFS directory where the audit log will be stored

hdfs://__REPLACE__NAME_NODE_HOST:8020/ (format) hdfs://namenode.mycompany.com:8020/ranger/audit/%app-type%/%time:yyyyMMdd%

XAAUDIT.HDFS.LOCAL_BUFFER _DIRECTORY Local directory where the audit log will be saved for intermediate storage

hdfs://__REPLACE__NAME_NODE_HOST:8020/ (format) /var/log/%app-type%/audit

XAAUDIT.HDFS.LOCAL_ARCHIVE _DIRECTORY Local directory where the audit log will be archived after it is moved to hdfs

__REPLACE__LOG_DIR%app-type%/audit/archive (format) /var/log/%app-type%/audit/archive

XAAUDIT.HDFS.DESTINATION_FILEhdfs audit file name (format)

%hostname%-audit.log (default)

XAAUDIT.HDFS.DESTINATION _FLUSH_INTERVAL_SECONDS hdfs audit log file writes are flushed to HDFS at regular flush interval

900

XAAUDIT.HDFS.DESTINATION _ROLLOVER_INTERVAL_SECONDShdfs audit log file is rotated to write to a new file at a rollover interval specified here

86400

XAAUDIT.HDFS.DESTINATION _OPEN_RETRY_INTERVAL_SECONDShdfs audit log open() call is failed, it will be re-tried at this interval

60

XAAUDIT.HDFS.LOCAL_BUFFER _FILE Local filename used to store in audit log (format)

%time:yyyyMMdd-HHmm.ss%.log (default)

XAAUDIT.HDFS.LOCAL_BUFFER _FLUSH_INTERVAL_SECONDS Local audit log file writes are flushed to filesystem at regular flush interval

XAAUDIT.HDFS.LOCAL_BUFFER _ROLLOVER_INTERVAL_SECONDSLocal audit log file is rotated to write to a new file at a rollover interval specified here

600

XAAUDIT.HDFS.LOCAL_ARCHIVE _MAX_FILE_COUNT The maximum number of local audit log files that will be kept in the archive directory

10

SSL Information (https connectivity to Policy Admin Tool)

SSL_KEYSTORE_FILE_PATH Java Keystore Path where SSL key for the plug-in is stored. Is used only if SSL is enabled between Policy Admin Tool and Plugin; If SSL is not Enabled, leave the default value as it is - do not set as EMPTY if SSL not used

/etc/hadoop/conf/ranger-plugin-keystore.jks (default)

Only if SSL is enabled

SSL_KEYSTORE_PASSWORDPassword associated with SSL Keystore. Is used only if SSL is enabled between Policy Admin Tool and Plugin; If SSL is not Enabled, leave the default value as it is - do not set as EMPTY if SSL not used

none (default)

SSL_TRUSTSTORE_FILE_PATH Java Keystore Path where the trusted certificates are stored for verifying SSL connection to Policy Admin Tool. Is used only if SSL is enabled between Policy Admin Tool and Plugin; If SSL is not Enabled, leave the default value as it is - do not set as EMPTY if SSL not used

/etc/hadoop/conf/ranger-plugin-truststore.jks (default)

SSL_TRUSTSTORE_PASSWORDPassword associated with Truststore file. Is used only if SSL is enabled between Policy Admin Tool and Plugin; If SSL is not Enabled, leave the default value as it is - do not set as EMPTY if SSL not used

Enable the Kafka plug-in by running the following commands:

export JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-amd64./enable-kafka-plugin.sh

Enter the following commands to stop/start the Kafka service.

su kafka -c "/usr/hdp/current/kafka-broker/bin/kafka stop"

su kafka -c "/usr/hdp/current/kafka-broker/bin/kafka start"

Create the default repo for Kafka with the proper configuration specifying the same repository name as in step 3.

You can verify the plug-in is communicating to Ranger admin via the Audit/plugins tab.

If the plug-in is not able to communicate with Ranger admin, check the property <code>authorizer.class.name</code> in<code>/usr/hdp/2.4.2.0-258/kafka/config/server.properties</code>. The value of the authorizer.class.name should be org.apache.ranger.authorization.kafka.authorizer.RangerKafkaAuthorizer.

https://docs.hortonworks.com/HDPDocuments/HDP2/HDP-2.4.2/bk_installing_manually_book/content/installing_ranger_plugins.html