This section describes how to use the Flume client to collect static logs from a local host and save them to the flume_test HBase table. In this scenario, multi-level agents are cascaded.
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. The configuration applies to scenarios where only the server is configured, for example, Spooldir Source+File Channel+HBase Sink.
Use SpoolDir Source, File Channel, and Avro 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 |
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 |
hostname |
Specifies the name or IP address of the host whose data is to be sent. This parameter cannot be left blank. Name or IP address must be configured to be the name or IP address that the Avro source associated with it. |
192.168.108.11 |
port |
Specifies the port that sends the data. This parameter cannot be left blank. It must be consistent with the port that is monitored by the connected Avro Source. |
21154 |
ssl |
Specifies whether to enable the SSL authentication. (You are advised to enable this function to ensure security.) Only Sources of the Avro type have this configuration item.
|
false |
For example, use Avro Source, File Channel, and HBase Sink.
Parameter |
Description |
Example Value |
---|---|---|
Name |
The value must be unique and cannot be left blank. |
test |
bind |
Specifies the IP address to which Avro Source is bound. This parameter cannot be left blank. It must be configured as the IP address that the server configuration file will upload. |
192.168.108.11 |
port |
Specifies the ID of the port that the Avro Source monitors. This parameter cannot be left blank. It must be configured as an unused port. |
21154 |
ssl |
Specifies whether to enable the SSL authentication. (You are advised to enable this function to ensure security.) Only Sources of the Avro type have this configuration item.
|
false |
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/flumeserver/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/flumeserver/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 |
table |
Specifies the HBase table name. This parameter cannot be left blank. |
flume_test |
columnFamily |
Specifies the HBase column family name. This parameter cannot be left blank. |
cf |
batchSize |
Specifies the maximum number of events written to HBase by Flume in a batch. |
61200 |
kerberosPrincipal |
Specifies the Kerberos authentication user, which is mandatory in security versions. This configuration is required only in security clusters. |
flume_hbase |
kerberosKeytab |
Specifies the 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_hbase. In addition, ensure that the user who installs and runs the Flume client has the read and write permissions on the user.keytab file. |
cd /Client installation directory/ HBase/hbase
kinit flume_hbase (Enter the password.)
hbase(main):001:0> scan 'flume_test' ROW COLUMN+CELL 2017-09-18 16:05:36,394 INFO [hconnection-0x415a3f6a-shared--pool2-t1] ipc.AbstractRpcClient: RPC Server Kerberos principal name for service=ClientService is hbase/hadoop.<system domain name>@<system domain name> default4021ff4a-9339-4151-a4d0-00f20807e76d column=cf:pCol, timestamp=1505721909388, value=Welcome to flume incRow column=cf:iCol, timestamp=1505721909461, value=\x00\x00\x00\x00\x00\x00\x00\x01 2 row(s) in 0.3660 seconds