Giter Club home page Giter Club logo

flume-agent-maven-plugin's Introduction

Flume Agent Maven Plugin

A Maven plugin used to start, stop, and run a Flume agent. By default, this runs Flume 1.7.0.

Goals

This plugin defines three goals:

  • run: This, given the configuration of the plugin, runs a standalone instance of Flume agents.
    • NOTE: there is a known issue of a process being left behind on Windows platforms. Refer to #19 for more information.
  • start: This starts the configured Flume agents. By default, it binds to the pre-integration-test phase.
  • stop: This is the counterpart to the start goal, stopping the agents it started. By default, it binds to the post-integration-test phase.

Configuration

The following describes configuration elements for the goals.

Running and Starting an Agent

The goals to run and start agents share the same configuration parameters and are, thus, grouped into the same description here.

Required Parameters

These goals are geared toward multi-agent startups; as a result, the individual agent configurations are nested within an <agents /> block. The following are required parameters in the configuration block of each agent. These, at a minimum, must be provided for the Flume agent to be started:

  • agentName: The name of the Flume agent (matching one in the given configuration file) that is to be loaded and run.
  • configFile: The configuration file that informs Flume how the agent named is to be configured.

An example configuration might look like:

<configuration>
    <agents>
        <agent>
            <agentName>a1</agentName>
            <configFile>${project.build.outputDirectory}/flume.properties</configFile>
        </agent>
    </agents>
</configuration>

Optional Configuration Parameters

The following are configuration parameters that can be configured optionally; either reasonable defaults are provided or they are not needed to run the agent.

Removing Flume Libraries

This feature was introduced in version 1.1 of the plugin.

Flume does not provide an out-of-the-box way to override the libraries provided by Flume. This can result in dependency collisions with plugins. To facilitate deference of classloading to the libraries provided by Flume plugins, this Maven plugin allows the specification of libraries to be removed from the Flume agent prior to it being started.

For example, to remove the libthrift-0.7.0.jar from the Flume agent's lib/ directory, you can provide a configuration like the following:

<configuration>
    <agents>
        <agent>
            <!-- required fields omitted for brevity -->
            <libs>
                <removals>
                    <removal>libthrift-0.7.0.jar</removal>
                </removals>
            </libs>
        </agent>
    </agents>
</configuration>

Setting the JAVA_OPTS Parameter

This can be used to set the JAVA_OPTS parameter passed to the Flume agent's Java environment. This can be particularly useful because Flume, by default, only runs with a max heap of 20 MB (which can easily be too low, especially when using custom sinks, channels, and sources) or if you wish to enable JMX in the Flume agent to access its MBeans. An example configuration may look like:

<configuration>
    <agents>
        <agent>
            <!-- required fields omitted for brevity -->
            <javaOpts>-Xms128m -Xmx512m</javaOpts>
        </agent>
    </agents>
</configuration>

Flume Plugins

The Maven plugin can also add Flume plugins to the Flume agent, making it easier to test your custom sinks, channels, and sources. You may want to consult the flume-plugin-maven-plugin for a tool used to assemble plugins in a format that this plugin expects.

The Flume plugin installation uses the dependency resolution of your POM to locate and download the plugin to be installed. An example configuration might look like:

<project>
    <build>
        <plugins>
            <plugin>
                <groupId>com.github.jrh3k5</groupId>
                <artifactId>flume-agent-maven-plugin</artifactId>
                <configuration>
                    <agents>
                        <agent>
                            <!-- required fields omitted for brevity -->
                            <flumePlugins>
                                <flumePlugin>
                                    <groupId>com.me</groupId> <!-- required -->
                                    <artifactId>my-project</artifactId> <!-- required -->
                                    <classifier>flume-plugin</classifier> <!-- default value - this is optional -->
                                    <type>tar.gz</type> <!-- default value - this is optional -->
                                </flumePlugin>
                            </flumePlugins>
                        </agent>
                    </agents>
                </configuration>
            </plugin>
        </plugins>
    </build>
    <dependencies>
        <dependency>
            <groupId>com.me</groupId>
            <artifactId>my-project</artifactId>
            <version>1.2.3</version>
            <classifier>flume-plugin</classifier>
            <type>tar.gz</type>
        </dependency>
    </dependencies>
</project>

This tells the plugin to look for a dependency in your project matching the given identifying information and to unpack and install it into the plugins.d/ directory beneath the Flume agent installation.

Change Source of Flume Archive

By default, the plugin downloads (and then caches) the archive of Flume from the Apache archives. If for some reason that URL is unavailable to you or the default version that the plugin uses is not suitable to your needs, you can change the location from which plugin downloads Flume by setting the flumeArchiveUrl and flumeArchiveMd5 parameters, like so:

<configuration>
    <flumeArchiveUrl>http://archive.apache.org/dist/flume/1.3.1/apache-flume-1.3.1-bin.tar.gz</flumeArchiveUrl>
    <flumeArchiveMd5>09362a5a8ed92c6fb0bfbdb2802301db</flumeArchiveMd5>
</configuration>

Logging Configuration

Starting with version 2.1.1 of the plugin, you can specify a logging configuration to be used by an agent like so:

<configuration>
    <agents>
        <agent>
            <loggingProperties>/some/location/of/logging.properties</loggingProperties>
        </agent>
    </agents>
</configuration>

This is expected to conform to the logging implementation used by your selected version of Flume.

flume-agent-maven-plugin's People

Contributors

jrh3k5 avatar

Watchers

 avatar James Cloos avatar

flume-agent-maven-plugin's Issues

stop-agent goal only stops most-recently-started agent

The stop-agent goal currently only stops the most-recently-started agent:

AgentProcessContainer.stopAgentProcess();

When using the plugin to start multiple agents, this means that all but one get left hanging as processes. The stop-agent mojo should accept an agent name as a parameter and stop that specific agent.

Allow specification of classpath

To try and work around an issue of conflicting dependencies being loaded out of the lib/ directory of the Flume installation, the plugin should allow the consumer to specify the classpath.

Re-download Apache tarball if MD5 does not match

If the temporary copy of the Flume archive gets corrupted, it can cause errors trying to use the plugin. The plugin should be smart enough to know if the tarball is corrupted and try to re-download the Flume archive if it determines that the local copy is corrupted

Add Travis support

Add Travis build support so that there's at least one system out there outside of my own laptop that's validating that the plugin builds correctly.

Don't require Maven 3.1.1

An unintended side effect of some work on 2.0 is that it now causes Maven to require version 3.1.1 to run - but there's no functional dependency on it. 2.0.1 should merely require 3.0.4 and above.

Update plugin to Java 8

Java 6 is EOL and so is Java 7. Even the latest version of Flume is running Java 8, so let's get off that train.

Update to Maven 3.3.9 libraries

IntelliJ does not like the 3.2.1 and mish-mash of Maven libraries currently used by the plugin. Let's converge the plugin to using a base minimum of 3.3.9 for the Maven plugin libraries.

Plugin missing project URL

While trying to release v3.0 of the plugin, the following error occurred:

[INFO] [ERROR] Repository "comgithubjrh3k5-1018" failures
[INFO] [ERROR]   Rule "pom-staging" failures
[INFO] [ERROR]     * Invalid POM: /com/github/jrh3k5/flume-agent-maven-plugin/3.0/flume-agent-maven-plugin-3.0.pom: Project URL missing

Allow removal of JARs from Flume's lib directory

Because (as version 1.4.0 of Flume) there's no proper way to override the JARs brought in by Flume's classpath in favor of JARs provided by plugins, the Maven plugin should support the ability to remove JARs from the Flume plugin installation prior to starting the agent to give priority to the JARs in the plugin classpath.

Agent Launch Fails on MS Windows

With Flume 1.7.0, we get the ability to launch a Flume agent via shell command: flume-ng.cmd on Windows, which in turn invokes a PowerShell script: flume-ng.ps1. The existing agent launch from the maven plugin fails: flume-ng.

Please update the agent plugin to support Flume 1.7.0, and then also detect the OS platform, select the proper launch command, and thereby support launching the agent on Unix, Mac, and Windows systems.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.