zyllt edited a comment on issue #6589: Can not use Context#Counter in function 
URL: https://github.com/apache/pulsar/issues/6589#issuecomment-604259667
   @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 
   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 
   In the configuration file `functions_worker.yml ` I set the 
`stateStorageServiceUrl` configuration to ` bk://`.that is IP of 
   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: 
   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: ""
   port: 4181
   ) into the channel manager.
   I suspect it may be a problem with this `Added range server (hostname: 
"" 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 `[]`.
   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 
   I tested other cases,you can see here.  

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:

With regards,
Apache Git Services

Reply via email to