Flume-ng禁用自动加载配置文件功能
2017-03-20 16:56
405 查看
默认情况下,Flume中的
agent的配置文件,如果监听到配置文件变化了,Flume会试图重新加载变化的配置文件。判断配置文件是否变化主要是基于文件的最后修改时间来的,代码片段如下:
/////////////////////////////////////////////////////////////////////
User: 过往记忆
Date: 2015-08-19
Time: 23:59
bolg: https://www.iteblog.com 本文地址:https://www.iteblog.com/archives/1467
过往记忆博客,专注于hadoop、hive、spark、shark、flume的技术博客,大量的干货
过往记忆博客微信公共帐号:iteblog_hadoop
/////////////////////////////////////////////////////////////////////
@Override
public void run() {
LOGGER.debug("Checking file:{} for changes", file);
counterGroup.incrementAndGet("file.checks");
long lastModified = file.lastModified();
if (lastModified > lastChange) {
LOGGER.info("Reloading configuration file:{}", file);
counterGroup.incrementAndGet("file.loads");
lastChange = lastModified;
try {
eventBus.post(getConfiguration());
} catch (Exception e) {
LOGGER.error("Failed to load configuration data. Exception follows.",
e);
} catch (NoClassDefFoundError e) {
LOGGER.error("Failed to start agent because dependencies were not " +
"found in classpath. Error follows.", e);
} catch (Throwable t) {
// caught because the caller does not handle or log Throwables
LOGGER.error("Unhandled error", t);
}
}
}
然而,通常情况下,用户修改了配置文件之后就不会再去修改,而且让Flume自动去加载配置文件有时还会出现问题。不过值得高兴的是,我们可以在启动Flume的时候通过加上
PollingPropertiesFileConfigurationProvider会每隔30秒去重新加载Flume
agent的配置文件,如果监听到配置文件变化了,Flume会试图重新加载变化的配置文件。判断配置文件是否变化主要是基于文件的最后修改时间来的,代码片段如下:
/////////////////////////////////////////////////////////////////////
User: 过往记忆
Date: 2015-08-19
Time: 23:59
bolg: https://www.iteblog.com 本文地址:https://www.iteblog.com/archives/1467
过往记忆博客,专注于hadoop、hive、spark、shark、flume的技术博客,大量的干货
过往记忆博客微信公共帐号:iteblog_hadoop
/////////////////////////////////////////////////////////////////////
@Override
public void run() {
LOGGER.debug("Checking file:{} for changes", file);
counterGroup.incrementAndGet("file.checks");
long lastModified = file.lastModified();
if (lastModified > lastChange) {
LOGGER.info("Reloading configuration file:{}", file);
counterGroup.incrementAndGet("file.loads");
lastChange = lastModified;
try {
eventBus.post(getConfiguration());
} catch (Exception e) {
LOGGER.error("Failed to load configuration data. Exception follows.",
e);
} catch (NoClassDefFoundError e) {
LOGGER.error("Failed to start agent because dependencies were not " +
"found in classpath. Error follows.", e);
} catch (Throwable t) {
// caught because the caller does not handle or log Throwables
LOGGER.error("Unhandled error", t);
}
}
}
然而,通常情况下,用户修改了配置文件之后就不会再去修改,而且让Flume自动去加载配置文件有时还会出现问题。不过值得高兴的是,我们可以在启动Flume的时候通过加上
--no-reload-conf配置来禁止Flume自动加载配置文件。这个属性在Flume的官方文档并没有介绍;而且只有Apache的Flume存在这个参数,如果你使用的是Cloudera的Flume发行版,这个参数是不支持的,不过有人在
https://issues.cloudera.org/browse/DISTRO-648里面提到这个参数,如果你感兴趣可以去看下。
相关文章推荐
- Flume-ng禁用自动加载配置文件功能
- Wordpress禁用自动保存功能及清理自动保存的文件
- Ubuntu下改写vim配置文件vimrc来实现显示行号,语法高亮,自动缩进功能
- SqlMapConfig.xml---在spring配置文件中自动加载的mybatis文件
- 配置文件自动重新加载
- java 配置文件properties自动加载类
- EditPlus的编码自动完成功能及配置文件下载
- struts2中如何自动加载xml文件(不用修改配置文件)(转)
- java非web应用修改 properties/xml配置文件后,无需重启应用即可生效---自动加载
- Spring中自动加载Hibernate配置文件
- (转)ALSA配置文件(alsa.conf, asoundrc, asound.conf)及其自动加载 And HDMI Adiuo
- 为 eclipse 的 hibernate 配置文件(*.hbm.xml)加上自动提示功能
- eclipse(xmlbuddy插件)为xml文件自动提示(同MyEclipse编辑XML的提示功能),以spring配置文件为例
- 为 eclipse 的 hibernate 配置文件(*.hbm.xml)加上自动提示功能
- EditPlus的编码自动完成功能及配置文件下载
- 改写vim配置文件vimrc来实现显示行号,语法高亮,自动缩进功能
- SqlMapConfig.xml --- 在spring配置文件中自动加载的mybatis文件
- eclipse hibernate配置文件(*.hbm.xml)加上自动提示功能
- spring-自动加载配置文件\使用属性文件注入
- 为 eclipse 的 hibernate 配置文件(*.hbm.xml)加上自动提示功能