This section describes how to use the Flume client to collect logs from the topic list (test1) of the Kafka client and save them to the /flume/test directory on HDFS.
This section applies to MRS 3.x or later clusters.
By default, the cluster network environment is secure and the SSL authentication is not enabled during the data transmission process. For details about how to use the encryption mode, see Configuring the Encrypted Transmission.
For example, use Kafka Source, File Channel, and HDFS Sink.
Parameter |
Description |
Example Value |
---|---|---|
Name |
The value must be unique and cannot be left blank. |
test |
kafka.topics |
Specifies the subscribed Kafka topic list, in which topics are separated by commas (,). This parameter cannot be left blank. |
test1 |
kafka.consumer.group.id |
Specifies the data group ID obtained from Kafka. This parameter cannot be left blank. |
flume |
kafka.bootstrap.servers |
Specifies the bootstrap IP address and port list of Kafka. The default value is all Kafka lists in a Kafka cluster. If Kafka has been installed in the cluster and its configurations have been synchronized, this parameter can be left blank. |
192.168.101.10:21007 |
batchSize |
Specifies the number of events that Flume sends in a batch (number of data pieces). |
61200 |
dataDirs |
Specifies the directory for storing buffer data. The run directory is used by default. Configuring multiple directories on disks can improve transmission efficiency. Use commas (,) to separate multiple directories. If the directory is inside the cluster, the /srv/BigData/hadoop/dataX/flume/data directory can be used. dataX ranges from data1 to dataN. If the directory is outside the cluster, it needs to be independently planned. |
/srv/BigData/hadoop/data1/flume/data |
checkpointDir |
Specifies the directory for storing the checkpoint information, which is under the run directory by default. If the directory is inside the cluster, the /srv/BigData/hadoop/dataX/flume/checkpoint directory can be used. dataX ranges from data1 to dataN. If the directory is outside the cluster, it needs to be independently planned. |
/srv/BigData/hadoop/data1/flume/checkpoint |
transactionCapacity |
Specifies the transaction size, that is, the number of events in a transaction that can be processed by the current Channel. The size cannot be smaller than the batchSize of Source. Setting the same size as batchSize is recommended. |
61200 |
hdfs.path |
Specifies the HDFS data write directory. This parameter cannot be left blank. |
hdfs://hacluster/flume/test |
hdfs.filePrefix |
Specifies the file name prefix after data is written to HDFS. |
TMP_ |
hdfs.batchSize |
Specifies the maximum number of events that can be written to HDFS once. |
61200 |
hdfs.kerberosPrincipal |
Specifies the Kerberos authentication user, which is mandatory in security versions. This configuration is required only in security clusters. |
flume_hdfs |
hdfs.kerberosKeytab |
Specifies the keytab file path for Kerberos authentication, which is mandatory in security versions. This configuration is required only in security clusters. |
/opt/test/conf/user.keytab NOTE:
Obtain the user.keytab file from the Kerberos certificate file of the user flume_hdfs. In addition, ensure that the user who installs and runs the Flume client has the read and write permissions on the user.keytab file. |
hdfs.useLocalTimeStamp |
Specifies whether to use the local time. Possible values are true and false. |
true |
vi jaas.conf
KafkaClient { com.sun.security.auth.module.Krb5LoginModule required useKeyTab=true keyTab="/opt/test/conf/user.keytab" principal="flume_hdfs@<System domain name>" useTicketCache=false storeKey=true debug=true; };
Values of keyTab and principal vary depending on the actual situation.