Load Balancing Log4J Appender
Appends Log4j events to a list of flume agent’s avro source. A client using thisappender must have the flume-ng-sdk in the classpath (eg,flume-ng-sdk-1.9.0.jar). This appender supports a round-robin and randomscheme for performing the load balancing. It also supports a configurable backofftimeout so that down agents are removed temporarily from the set of hostsRequired properties are in bold.
Property Name | Default | Description |
---|---|---|
Hosts | – | A space-separated list of host:port at which Flume (throughan AvroSource) is listening for events |
Selector | ROUND_ROBIN | Selection mechanism. Must be either ROUND_ROBIN,RANDOM or custom FQDN to class that inherits fromLoadBalancingSelector. |
MaxBackoff | – | A long value representing the maximum amount of time inmilliseconds the Load balancing client will backoff from anode that has failed to consume an event. Defaults to no backoff |
UnsafeMode | false | If true, the appender will not throw exceptions on failure tosend the events. |
AvroReflectionEnabled | false | Use Avro Reflection to serialize Log4j events. |
AvroSchemaUrl | – | A URL from which the Avro schema can be retrieved. |
Sample log4j.properties file configured using defaults:
- #...
- log4j.appender.out2 = org.apache.flume.clients.log4jappender.LoadBalancingLog4jAppender
- log4j.appender.out2.Hosts = localhost:25430 localhost:25431
- # configure a class's logger to output to the flume appender
- log4j.logger.org.example.MyClass = DEBUG,flume
- #...
Sample log4j.properties file configured using RANDOM load balancing:
- #...
- log4j.appender.out2 = org.apache.flume.clients.log4jappender.LoadBalancingLog4jAppender
- log4j.appender.out2.Hosts = localhost:25430 localhost:25431
- log4j.appender.out2.Selector = RANDOM
- # configure a class's logger to output to the flume appender
- log4j.logger.org.example.MyClass = DEBUG,flume
- #...
Sample log4j.properties file configured using backoff:
- #...
- log4j.appender.out2 = org.apache.flume.clients.log4jappender.LoadBalancingLog4jAppender
- log4j.appender.out2.Hosts = localhost:25430 localhost:25431 localhost:25432
- log4j.appender.out2.Selector = ROUND_ROBIN
- log4j.appender.out2.MaxBackoff = 30000
- # configure a class's logger to output to the flume appender
- log4j.logger.org.example.MyClass = DEBUG,flume
- #...