首页 > 解决方案 > NiFi DELETE 处理器在代理后面访问时不起作用

问题描述

希望你们都做得很好。

谷歌搜索大约一周后,我仍然无法找出与在 zuul 代理后面运行的 nifi kubernetes 集群相关的问题的解决方案。

这是我的问题的详细描述:我有一个 NiFi 集群在 docker 桌面上的 K8s 中运行,配置如下:

- name: NIFI_WEB_HTTP_PORT
value: "31313"
- name: NIFI_WEB_HTTP_HOST
value: "PODIP" #truncated string as its not necessary
- name: NIFI_CLUSTER_IS_NODE
value: "true"
- name: NIFI_CLUSTER_NODE_PROTOCOL_PORT
value: "30303"
- name: NIFI_CLUSTER_ADDRESS
value: "PODIP" #truncated string as its not necessary
- name: NIFI_CLUSTER_NODE_PROTOCOL_THREADS
value: "50"
- name: NIFI_CLUSTER_NODE_PROTOCOL_MAX_THREADS
value: "100"
- name: NIFI_ZK_CONNECT_STRING
value: "zookeeper-service:2181"
- name: NIFI_ELECTION_MAX_WAIT
value: "20 sec"
- name: NIFI_REMOTE_INPUT_HOST
value: "PODIP" #truncated string as its not necessary
- name: NIFI_REMOTE_INPUT_SOCKET_PORT
value: "30313"
- name: NIFI_WEB_PROXY_CONTEXT_PATH
value: "/nifi"

我有一个在 springboot 应用程序上运行的 zuul 代理,具有以下设置,如与代理相关的 NiFi 管理指南中所述:

前置过滤器:

context.addZuulRequestHeader("X-ProxyScheme", "http");
context.addZuulRequestHeader("X-ProxyHost", "localhost");
context.addZuulRequestHeader("X-ProxyPort", "34343");

和路线:

zuul:
  host:
    socket-timeout-millis: 100000
  routes:
    nifi-service-app-ks:
      path: /nifi/**
      stripPrefix: false
      url: http://localhost:31313/

    nifi-service-api:
      path: /nifi-api/**
      stripPrefix: false
      url: http://localhost:31313/

    nifi-service-docs:
      path: /nifi-docs/**
      stripPrefix: false
      url: http://localhost:31313/

我的代理网址:http://localhost:34343/nifi/

使用 k8s 负载均衡器无需代理即可直接访问的 URL:http://localhost:31313/nifi

问题:通过代理 URL (http://localhost:34343/nifi/) 访问 nifi:当我在当前控制器中拉(或现有)一个处理器并尝试删除时,它会引发以下异常:

2021-05-27 05:37:22,936 WARN [Replicate Request Thread-4] o.a.n.c.c.h.r.ThreadPoolRequestReplicator Failed to replicate request DELETE /nifi-api/processors/ac22e03e-0179-1000-0000-00004f113151 to 10.1.2.35:31313 due to java.net.SocketTimeoutException: timeout
2021-05-27 05:37:22,936 WARN [Replicate Request Thread-8] o.a.n.c.c.h.r.ThreadPoolRequestReplicator Failed to replicate request DELETE /nifi-api/processors/ac22e03e-0179-1000-0000-00004f113151 to 10.1.2.36:31313 due to java.net.SocketTimeoutException: timeout
2021-05-27 05:37:22,936 WARN [Replicate Request Thread-6] o.a.n.c.c.h.r.ThreadPoolRequestReplicator Failed to replicate request DELETE /nifi-api/processors/ac22e03e-0179-1000-0000-00004f113151 to 10.1.2.37:31313 due to java.net.SocketTimeoutException: timeout
2021-05-27 05:37:22,937 WARN [Replicate Request Thread-4] o.a.n.c.c.h.r.ThreadPoolRequestReplicator
java.net.SocketTimeoutException: timeout
at okio.SocketAsyncTimeout.newTimeoutException(JvmOkio.kt:143)
at okio.AsyncTimeout.access$newTimeoutException(AsyncTimeout.kt:162)
at okio.AsyncTimeout$source$1.read(AsyncTimeout.kt:335)
at okio.RealBufferedSource.indexOf(RealBufferedSource.kt:427)
at okio.RealBufferedSource.readUtf8LineStrict(RealBufferedSource.kt:320)
at okhttp3.internal.http1.HeadersReader.readLine(HeadersReader.kt:29)
at okhttp3.internal.http1.Http1ExchangeCodec.readResponseHeaders(Http1ExchangeCodec.kt:178)
at okhttp3.internal.connection.Exchange.readResponseHeaders(Exchange.kt:106)
at okhttp3.internal.http.CallServerInterceptor.intercept(CallServerInterceptor.kt:79)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.kt:34)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.kt:95)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.kt:83)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.kt:76)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
at okhttp3.internal.connection.RealCall.getResponseWithInterceptorChain$okhttp(RealCall.kt:201)
at okhttp3.internal.connection.RealCall.execute(RealCall.kt:154)
at org.apache.nifi.cluster.coordination.http.replication.okhttp.OkHttpReplicationClient.replicate(OkHttpReplicationClient.java:132)
at org.apache.nifi.cluster.coordination.http.replication.okhttp.OkHttpReplicationClient.replicate(OkHttpReplicationClient.java:126)
at org.apache.nifi.cluster.coordination.http.replication.ThreadPoolRequestReplicator.replicateRequest(ThreadPoolRequestReplicator.java:652)
at org.apache.nifi.cluster.coordination.http.replication.ThreadPoolRequestReplicator$NodeHttpRequest.run(ThreadPoolRequestReplicator.java:844)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.net.SocketException: Socket closed
at java.net.SocketInputStream.read(SocketInputStream.java:204)
at java.net.SocketInputStream.read(SocketInputStream.java:141)
at okio.InputStreamSource.read(JvmOkio.kt:90)
at okio.AsyncTimeout$source$1.read(AsyncTimeout.kt:129)
... 26 common frames omitted
2021-05-27 05:37:22,937 WARN [Replicate Request Thread-8] o.a.n.c.c.h.r.ThreadPoolRequestReplicator
java.net.SocketTimeoutException: timeout
at okio.SocketAsyncTimeout.newTimeoutException(JvmOkio.kt:143)
at okio.AsyncTimeout.access$newTimeoutException(AsyncTimeout.kt:162)
at okio.AsyncTimeout$source$1.read(AsyncTimeout.kt:335)
at okio.RealBufferedSource.indexOf(RealBufferedSource.kt:427)
at okio.RealBufferedSource.readUtf8LineStrict(RealBufferedSource.kt:320)
at okhttp3.internal.http1.HeadersReader.readLine(HeadersReader.kt:29)
at okhttp3.internal.http1.Http1ExchangeCodec.readResponseHeaders(Http1ExchangeCodec.kt:178)
at okhttp3.internal.connection.Exchange.readResponseHeaders(Exchange.kt:106)
at okhttp3.internal.http.CallServerInterceptor.intercept(CallServerInterceptor.kt:79)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.kt:34)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.kt:95)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.kt:83)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.kt:76)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
at okhttp3.internal.connection.RealCall.getResponseWithInterceptorChain$okhttp(RealCall.kt:201)
at okhttp3.internal.connection.RealCall.execute(RealCall.kt:154)
at org.apache.nifi.cluster.coordination.http.replication.okhttp.OkHttpReplicationClient.replicate(OkHttpReplicationClient.java:132)
at org.apache.nifi.cluster.coordination.http.replication.okhttp.OkHttpReplicationClient.replicate(OkHttpReplicationClient.java:126)
at org.apache.nifi.cluster.coordination.http.replication.ThreadPoolRequestReplicator.replicateRequest(ThreadPoolRequestReplicator.java:652)
at org.apache.nifi.cluster.coordination.http.replication.ThreadPoolRequestReplicator$NodeHttpRequest.run(ThreadPoolRequestReplicator.java:844)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.net.SocketException: Socket closed
at java.net.SocketInputStream.read(SocketInputStream.java:204)
at java.net.SocketInputStream.read(SocketInputStream.java:141)
at okio.InputStreamSource.read(JvmOkio.kt:90)
at okio.AsyncTimeout$source$1.read(AsyncTimeout.kt:129)
... 26 common frames omitted
2021-05-27 05:37:22,938 WARN [Replicate Request Thread-6] o.a.n.c.c.h.r.ThreadPoolRequestReplicator
java.net.SocketTimeoutException: timeout
at okio.SocketAsyncTimeout.newTimeoutException(JvmOkio.kt:143)
at okio.AsyncTimeout.access$newTimeoutException(AsyncTimeout.kt:162)
at okio.AsyncTimeout$source$1.read(AsyncTimeout.kt:335)
at okio.RealBufferedSource.indexOf(RealBufferedSource.kt:427)
at okio.RealBufferedSource.readUtf8LineStrict(RealBufferedSource.kt:320)
at okhttp3.internal.http1.HeadersReader.readLine(HeadersReader.kt:29)
at okhttp3.internal.http1.Http1ExchangeCodec.readResponseHeaders(Http1ExchangeCodec.kt:178)
at okhttp3.internal.connection.Exchange.readResponseHeaders(Exchange.kt:106)
at okhttp3.internal.http.CallServerInterceptor.intercept(CallServerInterceptor.kt:79)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.kt:34)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.kt:95)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.kt:83)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.kt:76)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
at okhttp3.internal.connection.RealCall.getResponseWithInterceptorChain$okhttp(RealCall.kt:201)
at okhttp3.internal.connection.RealCall.execute(RealCall.kt:154)
at org.apache.nifi.cluster.coordination.http.replication.okhttp.OkHttpReplicationClient.replicate(OkHttpReplicationClient.java:132)
at org.apache.nifi.cluster.coordination.http.replication.okhttp.OkHttpReplicationClient.replicate(OkHttpReplicationClient.java:126)
at org.apache.nifi.cluster.coordination.http.replication.ThreadPoolRequestReplicator.replicateRequest(ThreadPoolRequestReplicator.java:652)
at org.apache.nifi.cluster.coordination.http.replication.ThreadPoolRequestReplicator$NodeHttpRequest.run(ThreadPoolRequestReplicator.java:844)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.net.SocketException: Socket closed
at java.net.SocketInputStream.read(SocketInputStream.java:204)
at java.net.SocketInputStream.read(SocketInputStream.java:141)
at okio.InputStreamSource.read(JvmOkio.kt:90)
at okio.AsyncTimeout$source$1.read(AsyncTimeout.kt:129)
... 26 common frames omitted
2021-05-27 05:37:22,940 INFO [Replicate Request Thread-6] o.a.n.c.c.h.r.ThreadPoolRequestReplicator Received a status of 500 from 10.1.2.35:31313 for request DELETE /nifi-api/processors/ac22e03e-0179-1000-0000-00004f113151 when performing first stage of two-stage commit. The action will not occur
2021-05-27 05:37:22,941 INFO [Replicate Request Thread-6] o.a.n.c.c.h.r.ThreadPoolRequestReplicator Received a status of 500 from 10.1.2.36:31313 for request DELETE /nifi-api/processors/ac22e03e-0179-1000-0000-00004f113151 when performing first stage of two-stage commit. The action will not occur
2021-05-27 05:37:22,941 INFO [Replicate Request Thread-6] o.a.n.c.c.h.r.ThreadPoolRequestReplicator Received a status of 500 from 10.1.2.37:31313 for request DELETE /nifi-api/processors/ac22e03e-0179-1000-0000-00004f113151 when performing first stage of two-stage commit. The action will not occur
2021-05-27 05:37:22,942 WARN [Replicate Request Thread-6] o.a.n.c.c.node.NodeClusterCoordinator All nodes failed to process URI DELETE /nifi-api/processors/ac22e03e-0179-1000-0000-00004f113151. As a result, no node will be disconnected from cluster
2021-05-27 05:37:23,864 INFO [Process Cluster Protocol Request-2] o.a.n.c.p.impl.SocketProtocolListener Finished processing request 4b3dc5de-ba17-44a8-85b5-b6efdb2c83b4 (type=HEARTBEAT, length=3717 bytes) from 10.1.2.36:31313 in 1 millis

但是,当我通过使用没有代理的直接 URL 访问 NiFi 来执行删除处理器的相同操作时,一切似乎都正常。

标签: kubernetesapache-nifinetflix-zuul

解决方案


推荐阅读