Open zyllt opened 4 years ago
Can you describe how do you deploy the cluster?
@sijie thanks for your reply.
I deploy the pulsar cluster on bare metal.my cluster has five machines.Two of them have brokers and three have bookies.local-zk and configuration-store deployed on all machines.I started functions-woker
within brokers
use Thread Runtime
.
At the beginning I started a demo-function named WordCountFunction
,then i trigger it and broker log outputs a exception.
According to the exception messages, I looked at the source code and found that using the Function# Context#stateContext
requires starting a StreamStorage
component.
I first started this component in a single bookie use extraServerComponents=org.apache.bookkeeper.stream.server.StreamStorageLifecycleComponent
.
The Booki Log shows a successful start.And I use netstat -ant | grep -i listen | grep 4181
command to see that port 4181 is already listening at 0.0.0.0
.
In the configuration file functions_worker.yml
I set the stateStorageServiceUrl
configuration to bk://10.1.0.112:4181
.that is IP of bookie.
After restarting the broker I deleted the demo-function WordCountFunction
I created earlier and recreated it again.But when I check the logs, I find that the startup of the demo-function is parked.
I use command of pulsar-admin functions trigger
,prompt me function does not exist.
19:27:11.455 [test/test-namespace/WordCountFunction-0] INFO org.apache.pulsar.functions.instance.JavaInstanceRunnable - Load JAR: /usr/local/pulsar-2.5.0/download/pulsar_functions/test/test-namespace/WordCountFunction/0/pulsar-functions-api-examples.jar
19:27:11.467 [test/test-namespace/WordCountFunction-0] INFO org.apache.pulsar.functions.instance.JavaInstanceRunnable - Initialize function class loader for function WordCountFunction at function cache manager
19:27:11.920 [client-scheduler-OrderedScheduler-0-0] INFO org.apache.bookkeeper.clients.impl.channel.StorageServerChannelManager - Added range server (hostname: "127.0.0.1"
port: 4181
) into the channel manager.
I suspect it may be a problem with this Added range server (hostname: "127.0.0.1" port: 4181)
, because StreamStorageServer
is on another machine, but I have configured the correct stateStorageServiceUrl
in functions_worker.yml
.
I think that the hostname should be obtained in zk according to the source code, and then I connected to local-zk to check ls /stream/servers/available
path found that the output is [127.0.0.1:4181]
.
I think it may be that the real IP address cannot be obtained when registering for zk,but I cannot confirm whether this problem is caused.
Then I started an independent functions-worker on the bookie machine, and then started the demo-function and trigger it,then i found that everything was normal.
I tested other cases,you can see here. https://github.com/apache/bookkeeper/issues/2216#issuecomment-602995573
I see. I think this is the problem is on advertisement. It seems to advertise the address using 127.0.0.1. We need to fix the issue at apache/bookkeeper#2216.
Describe the bug When I created a demo function(
WordCountFunction
) in the cluster, I got an exception.According to the source code, I found thatFunction#Context#stateContext
needs the support ofStreamStorage
.I startedStreamStorage
useextraServerComponents=org.apache.bookkeeper.stream.server.StreamStorageLifecycleComponent
and restartWordCountFunction
,i found theWordCountFunction
thread is parking. In my pulsar cluster,broker and bookie deploy on different machine. To Reproduce Steps to reproduce the behavior:StreamStorage
with a bookie server at machine AWordCountFunction
with a broker server at machine BWordCountFunction
thread is parking atJavaInstanceRunnable.createStateTable(JavaInstanceRunnable.java:345)
Screenshots
jstack -l
thread infoDesktop (please complete the following information):
StreamStorage
is127.0.0.1:4181
,The reason the thread is parked should be this.I started theWordCountFunction
on the same machine withStreamStorage
,the function is successful. I looked at the source code but couldn't find how to modify the configuration registered to zk.