Avro协议中的Flume SSL问题

ho草

我将事件从一项服务传递到另一项服务时遇到问题。当我禁用SSL时,我的事件在另一端正确接收。但是,当我启用SSL时,就会出现异常。

org.apache.flume.EventDeliveryException: NettyAvroRpcClient { host: 192.168.168.197, port: 41422 }: Failed to send event
    at org.apache.flume.api.NettyAvroRpcClient.append(NettyAvroRpcClient.java:250)
    at com.ashok.sink.Main.main(Main.java:22)
Caused by: org.apache.flume.EventDeliveryException: NettyAvroRpcClient { host: 192.168.168.197, port: 41422 }: Exception thrown from remote handler
    at org.apache.flume.api.NettyAvroRpcClient.waitForStatusOK(NettyAvroRpcClient.java:397)
    at org.apache.flume.api.NettyAvroRpcClient.append(NettyAvroRpcClient.java:297)
    at org.apache.flume.api.NettyAvroRpcClient.append(NettyAvroRpcClient.java:238)
    ... 1 more
Caused by: java.util.concurrent.ExecutionException: java.io.IOException: NettyTransceiver closed
    at org.apache.avro.ipc.CallFuture.get(CallFuture.java:128)
    at org.apache.flume.api.NettyAvroRpcClient.waitForStatusOK(NettyAvroRpcClient.java:389)
    ... 3 more
Caused by: java.io.IOException: NettyTransceiver closed
    at org.apache.avro.ipc.NettyTransceiver.disconnect(NettyTransceiver.java:338)
    at org.apache.avro.ipc.NettyTransceiver.access$200(NettyTransceiver.java:59)
    at org.apache.avro.ipc.NettyTransceiver$NettyClientAvroHandler.handleUpstream(NettyTransceiver.java:496)
    at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:558)
    at org.jboss.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:786)
    at org.jboss.netty.handler.codec.frame.FrameDecoder.cleanup(FrameDecoder.java:489)
    at org.jboss.netty.handler.codec.frame.FrameDecoder.channelClosed(FrameDecoder.java:372)
    at org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:88)
    at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:558)
    at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:553)
    at org.jboss.netty.channel.Channels.fireChannelClosed(Channels.java:476)
    at org.jboss.netty.channel.socket.nio.AbstractNioWorker.close(AbstractNioWorker.java:736)
    at org.jboss.netty.channel.socket.nio.NioWorker.read(NioWorker.java:89)
    at org.jboss.netty.channel.socket.nio.AbstractNioWorker.processSelectedKeys(AbstractNioWorker.java:471)
    at org.jboss.netty.channel.socket.nio.AbstractNioWorker.run(AbstractNioWorker.java:332)
    at org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:35)
    at org.jboss.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:102)
    at org.jboss.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42)
    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:744)

我正在使用apache flume 1.6(最新)

我的conf是:

agent.sources.ashok-source.type = avro
agent.sources.ashok-source.channels = ashok-channel
agent.sources.ashok-source.bind = 192.168.168.197
agent.sources.ashok-source.port = 41422
agent.sources.ashok-source.ssl = true
agent.sources.ashok-source.keystore = S:/Ashok/keystore/ashokKeystore.jks
agent.sources.ashok-source.keystore-password = ashok-123
agent.sources.ashok-source.keystore-type = jks
agent.sinks.ashok-sink.type = com.ashok.sink.AshokSink
agent.sinks.ashok-sink.channel = ashok-channel
agent.sinks.ashok-sink.ssl = true
agent.sinks.ashok-sink.truststore = S:/Ashok/keystore/ashokKeystore.jks
agent.sinks.ashok-sink.truststore-password = ashok-123
agent.sinks.ashok-sink.truststore-type = JKS
agent.channels.ashok-channel.type = file
agent.channels.ashok-channel.checkpointDir = ../channel/ashok/checkpoint
agent.channels.ashok-channel.dataDirs = ../channel/ashok/data

我的代码:

RpcClient client = null;
try {
        client = RpcClientFactory.getDefaultInstance("192.168.168.197", 41422);
        Map<String, String> header = new HashMap<String, String>();
        header.put("head", "er");
        Event event = EventBuilder.withBody(ByteArrayUtil.getBytes("Data"), header);
        client.append(event);
    } catch (Exception e) {
        e.printStackTrace();
    }

我使用下面的链接创建了JKS文件。https://www.sslshopper.com/article-how-to-create-a-self-signed-certificate-using-java-keytool.html

我犯了一些错误,有人可以帮助我。

ho草

RpcClientFactory.getDefaultInstance("192.168.168.197", 41422);我没有使用RpcClientFactory.getInstance(properies)而是在运行时与信任库属性一起使用解决了我的问题。

Map<String, String> header = new HashMap<String, String>();
TransTO transTO = new TransTO(1, "Ashok", true);
header.put("print", "yes");
Event event = EventBuilder.withBody(ByteArrayUtil.getBytes(transTO), header);
Properties prop = new Properties();
prop.setProperty("hosts.h1", "192.168.2.62:41422");
prop.setProperty("hosts", "h1");
prop.setProperty("compression-type", "deflate");
prop.setProperty("truststore-type", "JKS");
prop.setProperty("ssl", "true");
prop.setProperty("truststore", "D:/New folder/cacerts.jks");
prop.setProperty("truststore-password", "ashok-123");
RpcClient client = RpcClientFactory.getInstance(prop);
client.append(event);

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

Avro协议中的Flume SSL问题

来自分类Dev

Chrome中的WebSocket SSL问题

来自分类Dev

Traefik SSL版本2.1.4中的问题

来自分类Dev

Kubernetes中的Istio CORS和SSL问题

来自分类Dev

AEM6中的SSL配置问题

来自分类Dev

SSL证书问题:证书链中的自签名证书

来自分类Dev

我收到SSL握手问题如何在空手道中禁用SSL

来自分类Dev

连接中的未知SSL协议错误

来自分类Dev

在HttpsURLConnection中禁用SSL作为协议

来自分类Dev

Swift中协议的类型约束问题

来自分类Dev

Azure DEVOPS中的GIT错误-SSL证书问题:证书链中的自签名证书

来自分类Dev

卷曲错误60,SSL证书问题:证书链中的自签名证书

来自分类Dev

SSL证书绑定问题-证书链中缺少一个或多个中间证书

来自分类Dev

让IDE添加自签名证书后,多个程序中的SSL证书问题

来自分类Dev

仅在Java项目中,通过SSL的Apache ActiveMQ 5.10.0中的身份验证和授权问题

来自分类Dev

如何解决 youtube data api V3 中的 curl 错误 60:ssl 证书问题?

来自分类Dev

SSL证书问题:无法在git中获取本地颁发者证书

来自分类Dev

如何在OpenSSL中设置SSL协议优先级

来自分类Dev

Web 检查中的弱 SSL 协议 TLS v1.0

来自分类Dev

HAProxy上的SSL问题

来自分类Dev

SSL证书安装问题

来自分类Dev

PayPal SSL错误/问题

来自分类Dev

Android SSL问题

来自分类Dev

奇怪的SSL问题

来自分类Dev

字体导致SSL问题

来自分类Dev

SSL / TLS WCF问题

来自分类Dev

SSL通配符问题

来自分类Dev

Apache和SSL问题

来自分类Dev

子域的SSL问题