This script can be used as the upstart script (in /etc/init.d
) for a Flume-ng agent. We're using Flume version 1.6.
Here's the commands I'll use to set flume up on a box. What is does:
- download flume
- put the binary in
/usr/bin
- put the lib directory in
/usr/lib
- create a system user
- put the config files into place (see below)
cd /tmp
wget http://apache.osuosl.org/flume/1.6.0/apache-flume-1.6.0-bin.tar.gz
tar xzf apache-flume-1.6.0-bin.tar.gz
sudo mv apache-flume-1.6.0-bin/bin/flume-ng /usr/bin/flume-ng
sudo mv apache-flume-1.6.0-bin/lib /usr/lib/flume
rm -r apache-flume-1.6.0-bin*
sudo useradd --system --no-create-home flume
sudo cp ~/.../etc_defaults_flume /etc/default/flume
sudo mkdir -p /etc/flume/conf.d/
sudo cp ~/.../config/* /etc/flume/conf.d/
sudo cp ~/.../flume_init.d.sh /etc/init.d/flume
sudo chmod +x /etc/init.d/flume
sudo update-rc.d flume defaults
The config files:
/etc/flume/conf.d/flume.conf
This is where your sources, channels and sinks are defined./etc/flume/conf.d/flume-env.sh
Example:
JAVA_OPTS="-Xmx512m"
#FLUME_JAVA_OPTS=
FLUME_CLASSPATH=/usr/lib/flume/*
#FLUME_JAVA_LIBRARY_PATH=
#FLUME_APPLICATION_CLASS=
/etc/flume/conf.d/log4j.properties
The example can be found in theconf
directory ofapache-flume-1.6.0-bin.tar.gz
./etc/default/flume
Example:
############################
# Default settings for flume
############################
# The linux user that the daemon runs as.
# Default: flume
#FLUME_USER=flume
# Name of agent that will run. This must be defined in the given conf file.
# Default: agent
#FLUME_AGENT_NAME=agent
# Path to which log file is written
# Default: /var/log/flume.log
#FLUME_LOG_FILE=/var/log/flume.log
# Location of conf files
# Default: /etc/flume/conf.d
#FLUME_CONF_DIR=/etc/flume/conf.d
# Filename of used conf file
# Default: agent.conf
#FLUME_CONF_FILE=agent.conf
good instructions