Avro Source
监听Avro端口并从外部Avro客户端流接收事件。 当与另一个(previous hop)Flume代理上的内置Avro Sink配对时,它可以创建分层集合拓扑。 必需属性以粗体显示。
属性名称 | 默认值 | 描述 |
---|---|---|
channels | – | |
type | – | 组件类型名称,需要是avro |
bind | – | hostname or IP address to listen on |
port | – | Port # to bind to |
threads | – | 生成的最大工作线程数 |
selector.type | ||
selector.* | ||
interceptors | – | 以空格分隔的拦截器列表 |
interceptors.* | ||
compression-type | none | This can be “none” or “deflate”. The compression-type must match the compression-type of matching AvroSource |
ssl | false | 将其设置为true以启用SSL加密。 您还必须指定“keystore”和“keystore-password”。 |
keystore | – | This is the path to a Java keystore file. Required for SSL. |
keystore-password | – | The password for the Java keystore. Required for SSL. |
keystore-type | JKS | The type of the Java keystore. This can be “JKS” or “PKCS12”. |
exclude-protocols | SSLv3 | 要排除的SSL/TLS协议列表,以空格分隔。 除指定的协议外,将始终排除SSLv3。 |
ipFilter | false | 将此设置为true以启用netty的ipFiltering |
ipFilterRules | – | Define N netty ipFilter pattern rules with this config. |
Example for agent named a1:
a1.sources = r1
a1.channels = c1
a1.sources.r1.type = avro
a1.sources.r1.channels = c1
a1.sources.r1.bind = 0.0.0.0
a1.sources.r1.port = 4141
ipFilterRules的示例
ipFilterRules定义由逗号分隔的N个netty ipFilters模式规则必须采用此格式。
<’allow’ or deny>:<’ip’ or ‘name’ for computer name>:<pattern> or allow/deny:ip/name:pattern
example: ipFilterRules=allow:ip:127.*,allow:name:localhost,deny:ip:*
请注意,匹配的第一个规则将适用,如下面的示例所示,来自localhost上的客户端
这将允许localhost上的客户端拒绝来自任何其他ip的客户端“allow:name:localhost,deny:ip:”
这将拒绝localhost上的客户端允许来自任何其他ip的客户端“deny:name:localhost,allow:ip:“
Thrift Source
侦听Thrift端口并从外部Thrift客户端流接收事件。 当与另一个(previous hop)Flume代理上的内置ThriftSink配对时,它可以创建分层集合拓扑。 可以通过启用kerberos身份验证将Thrift源配置为以安全模式启动。 agent-principal和agent-keytab是Thrift源用于向kerberos KDC进行身份验证的属性。 必需属性以粗体显示。
属性名称 | 默认值 | 描述 |
---|---|---|
channels | – | |
type | – | 组件类型名称,需要是avro |
bind | – | hostname or IP address to listen on |
port | – | Port # to bind to |
threads | – | 生成的最大工作线程数 |
selector.type | ||
selector.* | ||
interceptors | – | 以空格分隔的拦截器列表 |
interceptors.* | ||
compression-type | none | This can be “none” or “deflate”. The compression-type must match the compression-type of matching AvroSource |
ssl | false | 将其设置为true以启用SSL加密。 您还必须指定“keystore”和“keystore-password”。 |
keystore | – | This is the path to a Java keystore file. Required for SSL. |
keystore-password | – | The password for the Java keystore. Required for SSL. |
keystore-type | JKS | The type of the Java keystore. This can be “JKS” or “PKCS12”. |
exclude-protocols | SSLv3 | 要排除的SSL/TLS协议列表,以空格分隔。 除指定的协议外,将始终排除SSLv3。 |
kerberos | false | 设置为true以启用kerberos身份验证。 在kerberos模式下,成功进行身份验证需要agent-principal和agent-keytab。 安全模式下的Thrift源将仅接受已启用kerberos且已成功通过kerberos KDC验证的Thrift客户端的连接。 |
agent-principal | – | Thrift Source使用的kerberos主体对kerberos KDC进行身份验证。 |
agent-keytab | – | Thrift Source与代理主体结合使用的keytab位置,用于对kerberos KDC进行身份验证。 |
代理名为a1的示例:
a1.sources = r1
a1.channels = c1
a1.sources.r1.type = thrift
a1.sources.r1.channels = c1
a1.sources.r1.bind = 0.0.0.0
a1.sources.r1.port = 4141
Exec Source
Exec源在启动时运行给定的Unix命令,并期望该进程在标准输出上连续生成数据(除非将属性logStdErr设置为true,否则将丢弃stderr)。 如果进程因任何原因退出,则源也会退出并且不会产生更多数据。 这意味着诸如cat [named pipe]或tail -F [file]之类的配置将产生所需的结果,而日期可能不会 - 前两个命令产生数据流,而后者产生单个事件并退出。
必需属性以粗体显示。
属性名称 | 默认值 | 描述 |
---|---|---|
channels | – | |
type | – | 组件类型名称,需要是avro |
command | – | The command to execute |
shell | – | 用于运行命令的shell调用。 例如 /bin/sh -c 。 仅适用于依赖shell功能的命令,如通配符,后退标记,管道等。 |
restartThrottle | 10000 | 尝试重新启动之前等待的时间(以毫秒为单位) |
restart | false | 是否应该重新执行已执行的cmd |
logStdErr | false | 是否应记录命令的stderr |
batchSize | 20 | 一次读取和发送到通道的最大行数 |
batchTimeout | 3000 | 在向下游推送数据之前,如果未达到缓冲区大小,则等待的时间(以毫秒为单位) |
selector.type | replicating | replicating or multiplexing |
selector.* | 取决于selector.type值 | |
interceptors | – | 以空格分隔的拦截器列表 |
interceptors.* |
警告:ExecSource和其他异步源的问题是如果在将事件放入channel中时出现错误,源无法保证客户端是否知道。在这种情况下,数据将丢失。例如,最常请求的功能之一是tail -F [file]
类似的用例,其中应用程序写入磁盘上的日志文件,Flume将文件尾部发送,将每一行作为事件发送。虽然这是可能的,但是有一个明显的问题;如果频道填满并且Flume无法发送事件,会发生什么?由于某种原因,Flume无法向编写日志文件的应用程序指示它需要保留日志或事件尚未发送。如果这没有意义,您只需要知道:当使用ExecSource等单向异步接口时,您的应用程序永远无法保证数据被接收!作为此警告的延伸 - 并且完全清楚 - 使用此源时,事件传递绝对没有保证。为了获得更强的可靠性保证,请考虑Spooling Directory Source,Taildir Source或通过SDK直接与Flume集成。
Example for agent named a1:
a1.sources = r1
a1.channels = c1
a1.sources.r1.type = exec
a1.sources.r1.command = tail -F /var/log/secure
a1.sources.r1.channels = c1
shell
配置用于通过shell
命令(例如Bash或Powershell)调用command
。 command
作为参数传递给shell
以便执行。 这允许command
使用shell
中的功能,例如通配符,后退标记,管道,循环,条件等。如果没有shell
配置,将直接调用command
。 shell
的常用值:bin/sh -c
,/bin/ksh -c
,cmd/c
,powershell -Command
等。
a1.sources.tailsource-1.type = exec
a1.sources.tailsource-1.shell = /bin/bash -c
a1.sources.tailsource-1.command = for i in /path/*.txt; do cat $i; done
JMS Source
JMS Source从JMS目标(例如队列或主题)读取消息。 作为JMS应用程序,它应该与任何JMS提供程序一起使用,但仅使用ActiveMQ进行测试。 JMS源提供可配置的批量大小,消息选择器,用户/传递和消息到flume事件转换器。 请注意,供应商提供的JMS jar应该包含在Flume类路径中,使用plugins.d
目录(首选),命令行上的-classpath
或flume-env.sh
中的FLUME_CLASSPATH
变量。
必需属性以粗体显示。
属性名称 | 默认值 | 描述 |
---|---|---|
channels | – | |
type | – | 组件类型名称,需要是avro |
initialContextFactory | – | Inital Context Factory,例如:org.apache.activemq.jndi.ActiveMQInitialContextFactory |
connectionFactory | – | 连接工厂应显示为的JNDI名称 |
providerURL | – | JMS提供的URL |
destinationName | – | Destination name |
destinationType | – | Destination type (queue or topic) |
messageSelector | – | Message selector to use when creating the consumer |
userName | – | Username for the destination/provider |
passwordFile | – | File containing the password for the destination/provider |
batchSize | 100 | Number of messages to consume in one batch |
converter.type | DEFAULT | 用于将消息转换为flume事件的类。 见下文。 |
converter.* | - | Converter properties. |
converter.charset | UTF-8 | 仅限默认转换器。 将JMS文本消息转换为字节数组时使用的字符集。 |
createDurableSubscription | false | 是否创建持久订阅。 持久订阅只能与destinationType主题一起使用。 如果为true,则必须指定“clientId”和“durableSubscriptionName”。 |
clientId | - | JMS客户端标识符在创建后立即在Connection上设置。 持久订阅必需。 |
durableSubscriptionName | - | 用于标识持久订阅的名称。 持久订阅必需。 |
Converter
JMS源允许可插拔转换器,尽管默认转换器可能适用于大多数用途。 默认转换器能够将Bytes,Text和Object消息转换为FlumeEvents。 在所有情况下,消息中的属性都作为标题添加到FlumeEvent中。
BytesMessage:消息的字节被复制到FlumeEvent的主体。 每封邮件无法转换超过2GB的数据。
TextMessage的:消息文本转换为字节数组并复制到FlumeEvent的主体。 默认转换器默认使用UTF-8,但这是可配置的。
ObjectMessage:将对象写入包含在ObjectOutputStream中的ByteArrayOutputStream,并将生成的数组复制到FlumeEvent的主体。
Example for agent named a1:
a1.sources = r1
a1.channels = c1
a1.sources.r1.type = jms
a1.sources.r1.channels = c1
a1.sources.r1.initialContextFactory = org.apache.activemq.jndi.ActiveMQInitialContextFactory
a1.sources.r1.connectionFactory = GenericConnectionFactory
a1.sources.r1.providerURL = tcp://mqserver:61616
a1.sources.r1.destinationName = BUSINESS_DATA
a1.sources.r1.destinationType = QUEUE
Spooling Directory Source
Taildir Source
Twitter 1% firehose Source (experimental)
NetCat TCP Source
NetCat UDP Source
Sequence Generator Source
Syslog Sources
Syslog TCP Source
Multiport Syslog TCP Source
Syslog UDP Source
HTTP Source
Stress Source
Legacy Sources
Avro Legacy Source
Thrift Legacy Source
Custom Source
自定义source是您自己的Source接口实现。 启动Flume代理时,自定义source的类及其依赖项必须包含在代理程序的类路径中。 自定义源的类型是其FQCN。
属性名称 | 默认值 | 描述 |
---|---|---|
channels | – | |
type | – | 组件类型名称,需要是FQCN |
selector.type | replicating or multiplexing | |
selector.* | replicating | 取决于selector.type值 |
interceptors | – | 以空格分隔的拦截器列表 |
interceptors.* |
Example for agent named a1:
a1.sources = r1
a1.channels = c1
a1.sources.r1.type = org.example.MySource
a1.sources.r1.channels = c1
Scribe Source
Scribe是另一种摄取系统。 要采用现有的Scribe摄取系统,Flume应该使用基于Thrift的ScribeSource和兼容的传输协议。 要部署Scribe,请遵循Facebook的指南。
属性名称 | 默认值 | 描述 |
---|---|---|
type | – | 组件类型名称,需要是org.apache.flume.source.scribe.ScribeSource |
port | 1499 | 应该连接Scribe的端口 |
maxReadBufferBytes | 16384000 | Thrift Default FrameBuffer Size |
workerThreads | 5 | Handing threads number in Thrift |
selector.type | ||
selector.* |
Example for agent named a1:
a1.sources = r1
a1.channels = c1
a1.sources.r1.type = org.apache.flume.source.scribe.ScribeSource
a1.sources.r1.port = 1463
a1.sources.r1.workerThreads = 5
a1.sources.r1.channels = c1