This section describes how to use Flume client to collect static logs from a local host and save them to the topic list (test1) of Kafka.
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. The configuration applies to scenarios where only the Flume is configured, for example, Spooldir Source+Memory Channel+Kafka Sink.
Use SpoolDir Source, Memory Channel, and Kafka Sink.
Parameter |
Description |
Example Value |
---|---|---|
Name |
The value must be unique and cannot be left blank. |
test |
spoolDir |
Specifies the directory where the file to be collected resides. This parameter cannot be left blank. The directory needs to exist and have the write, read, and execute permissions on the flume running user. |
/srv/BigData/hadoop/data1/zb |
trackerDir |
Specifies the path for storing the metadata of files collected by Flume. |
/srv/BigData/hadoop/data1/tracker |
batchSize |
Specifies the number of events that Flume sends in a batch (number of data pieces). A larger value indicates higher performance and lower timeliness. |
61200 |
kafka.topics |
Specifies the list of subscribed Kafka topics, which are separated by commas (,). This parameter cannot be left blank. |
test1 |
kafka.bootstrap.servers |
Specifies the bootstrap IP address and port list of Kafka. The default value is all Kafkabrokers in the Kafka cluster. |
192.168.101.10:21007 |
Upload the file exported in 1.d to the Flume client installation directory/fusioninsight-flume-Flume component version number/conf directory of the cluster
cd /Client installation directory/Kafka/kafka
kinit flume_kafka (Enter the password.)
bin/kafka-console-consumer.sh --topic topic name --bootstrap-server Kafka service IP address of the node where the role instance is located: 21007 --consumer.config config/consumer.properties --from-beginning
The system displays the contents of the file to be collected.
[root@host1 kafka]# bin/kafka-console-consumer.sh --topic test1 --bootstrap-server 192.168.101.10:21007 --consumer.config config/consumer.properties --from-beginning Welcome to flume