2. Modify the flume-env.sh configuration file, mainly to add the java environment
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not use this file except in compliance # with the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # If this file is placed at FLUME_CONF_DIR/flume-env.sh, it will be sourced # during Flume startup. # Enviroment variables can be set here. export JAVA_HOME=/opt/java/jdk1.7.0_65 # Give Flume more memory and pre-allocate, enable remote monitoring via JMX # export JAVA_OPTS="-Xms100m -Xmx2000m -Dcom.sun.management.jmxremote" # Note that the Flume conf directory is always included in the classpath. #FLUME_CLASSPATH=""
At this point, the installation of flume-ng is basically complete. have a test!
[root@GameCloud01 bin]# ./flume-ng version Flume 1.7.0-SNAPSHOT Source code repository: https://git-wip-us.apache.org/repos/asf/flume.git Revision: Unknown Compiled by aiyou on 02/22/2016 16:37:11 From source with checksum N/A
Possible problems:
[root@GameCloud01 bin]# ./flume-ng -bash: ./flume-ng: /bin/bash^M: bad interpreter: no such file or directory
This problem is because our script is compiled in the windows environment, and the script is converted into the dos text format under Windows. The end of each line is marked with \r\n, and its ASCII codes are 0x0D and 0x0A respectively. If this script file is directly executed on Linux, it will report /bin/bash^M: bad interpreter error prompt.
Solution:
1. Use vi or vim to open the error script flume-ng
2. View the text format: set ff?
3. If the display is: fileformat=dos, you need to change the file format to unix
4. Continue to execute: set ff =unix, save and exit.