通过nginx负载均衡器对apacheflume代理进行代理telnet测试

cgh8pdjw  于 2021-06-04  发布在  Flume
关注(0)|答案(0)|浏览(376)

我实现了具有以下属性的flume代理:

agent1.sources.r1.type = netcat
agent1.sources.r1.bind = localhost
agent1.sources.r1.port = 41414
agent1.sinks.k1.type = logger

agent1.channels.c1.type = memory
agent1.channels.c1.capacity = 1000
agent1.channels.c1.transactionCapacity = 100

agent1.sources.r1.channels = c1
agent1.sinks.k1.channel = c1

我和你一起跑

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

然后我连接到thorugh telnet探员,如下所示:

>telnet localhost 41414

Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Hello World!
OK

一切正常,我发送短信,我的代理将其显示为日志信息:

2016-03-16 11:58:41,172 (SinkRunner-PollingRunner-DefaultSinkProcessor) [INFO - org.apache.flume.sink.LoggerSink.process(LoggerSink.java:94)] Event: { headers:{} body: 48 65 6C 6C 6F 20 57 6F 72 6C 64 21 0D          Hello World!. }

我现在要做的是运行两个代理,在这些代理和我的telnet客户端之间放置一个nginx负载平衡器代理,然后尝试相同的实验,这样telnet连接有时会连接到端口41414(agent1),有时连接到端口41415(agent2)。我的负载平衡器已经适用于我之前测试过的几个python套接字,因此配置文件应该可以:

http {

    large_client_header_buffers 4 16k;
    upstream localhost {

        server localhost:41414;     
        server localhost:41415;     

    }

    server {
            listen          41410;
            location / {
                proxy_pass      http://localhost;
            }
    }
}

我使用以下方式连接到此代理:

telnet localhost 41410

然后我开始发短信。我没有将其发送给我的flume代理,而是通过telnet窗口接收以下响应:

<html>
<head><title>400 Bad Request</title></head>
<body bgcolor="white">
<center><h1>400 Bad Request</h1></center>
<hr><center>nginx/1.4.6 (Ubuntu)</center>
</body>
</html>

我做错什么了?

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题