Исключение привязки, когда Flume прослушивает системный журнал на другом сервере

Окружающая среда

У меня есть два сервера Ubuntu 14.04, работающие на виртуальных машинах Oracle на машине с Windows 7, они могут видеть друг друга с помощью ping:

  • В Server ONE есть компонент SysLog-Ng (IP: 192.168.1.1), прослушивающий базу данных Postgresql.
  • На ВТОРОМ сервере установлен Apache Flume (IP:192.168.1.2)

На сервере One есть этот файл syslog-ng.conf (частичный):

# POSTGRESQL_LOGGER
destination logpgsql { file("/var/log/pgsql"); };
destination loghost {tcp("192.168.1.2" port(41414));};  # IP of Server TWO. Is it Correct? 
filter f_postgres { facility(local0); };
filter f_sql_insert {match(".*INSERT INTO prova.*;");};
log { source(s_src); 
      filter(f_postgres); 
      filter(f_sql_insert); 
      destination(loghost);
      destination(logpgsql);};

(Server ONE правильно получает сообщения от s_src, правильно сохраняет их в файле журнала pgsql)

На ВТОРОМ сервере есть этот файл flume-syslog.conf:

# Name the components on this agent
a1.sources = r1
a1.sinks = k1
a1.channels = c1

# TCP based Syslog source
a1.sources.r1.type = syslogtcp    
a1.sources.r1.port = 41414
a1.sources.r1.host = 192.168.1.1   # IP of Server ONE. Is it Correct?

# Describe the sink
a1.sinks.k1.type = logger

# Channel which buffers events in memory
a1.channels.c1.type = memory
a1.channels.c1.capacity = 1000
a1.channels.c1.transactionCapacity = 100

# Source and sinks to the channel
a1.sources.r1.channels = c1
a1.sinks.k1.channel = c1

Когда я запускаю приложение Flume с помощью:

flume-ng agent --conf conf --conf-file conf/flume-syslog.conf --name a1 -Dflume.root.logger=INFO,console

Я получаю это исключение:

2015-04-25 11:58:39,236 (lifecycleSupervisor-1-1) [INFO - org.apache.flume.source.SyslogTcpSource.start(SyslogTcpSource.java:118)] Syslog TCP Source starting...
2015-04-25 11:58:39,237 (lifecycleSupervisor-1-1) [ERROR - org.apache.flume.lifecycle.LifecycleSupervisor$MonitorRunnable.run(LifecycleSupervisor.java:253)] Unable to start EventDrivenSourceRunner: { source:org.apache.flume.source.SyslogTcp
Source{name:r1,state:IDLE} } - Exception follows.
org.jboss.netty.channel.ChannelException: Failed to bind to: /192.168.1.1:41414
    at org.jboss.netty.bootstrap.ServerBootstrap.bind(ServerBootstrap.java:297)
    at org.apache.flume.source.SyslogTcpSource.start(SyslogTcpSource.java:123)
    at org.apache.flume.source.EventDrivenSourceRunner.start(EventDrivenSourceRunner.java:44)
    at org.apache.flume.lifecycle.LifecycleSupervisor$MonitorRunnable.run(LifecycleSupervisor.java:251)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
    at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:304)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:178)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293
)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.net.BindException: Cannot assign requested address
    at sun.nio.ch.Net.bind0(Native Method)
    at sun.nio.ch.Net.bind(Net.java:444)
    at sun.nio.ch.Net.bind(Net.java:436)
    at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:214)
    at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
    at org.jboss.netty.channel.socket.nio.NioServerSocketPipelineSink.bind(NioServerSocketPipelineSink.java:140)
    at org.jboss.netty.channel.socket.nio.NioServerSocketPipelineSink.handleServerSocket(NioServerSocketPipelineSink.java:90)
    at org.jboss.netty.channel.socket.nio.NioServerSocketPipelineSink.eventSunk(NioServerSocketPipelineSink.java:64)

    at org.jboss.netty.channel.Channels.bind(Channels.java:569)
    at org.jboss.netty.channel.AbstractChannel.bind(AbstractChannel.java:189)
    at org.jboss.netty.bootstrap.ServerBootstrap$Binder.channelOpen(ServerBootstrap.java:342)
    at org.jboss.netty.channel.Channels.fireChannelOpen(Channels.java:170)
    at org.jboss.netty.channel.socket.nio.NioServerSocketChannel.<init>(NioServerSocketChannel.java:80)
    at org.jboss.netty.channel.socket.nio.NioServerSocketChannelFactory.newChannel(NioServerSocketChannelFactory.java:158)
    at org.jboss.netty.channel.socket.nio.NioServerSocketChannelFactory.newChannel(NioServerSocketChannelFactory.java:86)
    at org.jboss.netty.bootstrap.ServerBootstrap.bind(ServerBootstrap.java:276)
    ... 10 more

Что это должно? Спасибо за ожидание.


person Andrea T    schedule 25.04.2015    source источник


Ответы (1)


В файле flume-syslog.conf на сервере ONE IP-адрес должен быть собственным:

# TCP based Syslog source
a1.sources.r1.type = syslogtcp    
a1.sources.r1.port = 41414
a1.sources.r1.host = 192.168.1.2
person Andrea T    schedule 25.04.2015