Hi @gardenest, yes there is.
You need to point the router to a config file at startup :
zenohd -c config
In this config file you may set the following options :
routers_autoconnect_multicast = true
routers_autoconnect_gossip = true
When routers_autoconnect_multicast is set to true, routers connect to other routers they discovered through multicast.
When routers_autoconnect_gossip is set to true, routers connect to other routers they discovered by the intermediate of already connected routers.
Hi all,
I am trying Zenoh for the first time.
I need to share a single key between two Zenoh routers, in the same ethernet LAN (using latest docker container in net=host
mode). I need to use the multicast discovery between the routers.
Without adding the following options to the config file, the discovery is not working at all.
routers_autoconnect_multicast = true
routers_autoconnect_gossip = true
After adding the options found in the previous messages, the log reports that a peer is discovered.
The final reported configuration is :Config: peers_autoconnect=true;multicast_scouting=true;listener=tcp/0.0.0.0:7447;mode=router;peer;add_timestamp=true
At this point I am registering the data storage via curl (on the two peers):
curl -X PUT -H 'content-type:application/properties' -d 'path_expr=/demo/example/**' http://localhost:8000/@/router/local/plugin/storages/backend/memory/storage/my-storage
and then, on the host1
:curl -X PUT -d 'Hello World!' http://localhost:8000/demo/example/test
curl http://localhost:8000/demo/example/test
response is (correctly):
[
{ "key": "/demo/example/test", "value": "Hello World!", "encoding": "application/x-www-form-urlencoded", "time": "2021-07-07T07:35:25.674262035Z/C896D2A77D1341C88D1EB9DDF4886B7B" }
]
but on the host2
the commandcurl http://localhost:8000/demo/example/test
returns an empty array
[
]
Unfortunately now seems that the discovery of the peer has stopped working...docker run --init --rm --name=zenoh -e RUST_LOG=debug -v /home/user/zenoconfig/config:/zenoconfig --net=host eclipse/zenoh:latest -c /zenoconfig
the content of /zenoconfig
seen inside the zenoh container is:
multicast_scouting=true
peers_autoconnect=true
routers_autoconnect_multicast=true
routers_autoconnect_gossip=true
eclipse/zenoh
container you run is a zenoh router: internally it runs the zenohd
process.
routers_autoconnect_multicast
and routers_autoconnect_gossip
options have been introduced after the 0.5.0-beta.8 release. Thus, they are not yet supported in eclipse/zenoh:latest
image.master
branch that support those options. You should be able to run an eclipse/zenoh:master
container soon. I’ll let you know as soon as available.
.so
files on the other host), so I started to use the Docker container...
-e tcp/<ip_of_other_router>:7447
) ?
Ok, I will test it later.
So, I deduce that the multicast discovery of the routers is still an 'experimental feature'.
Just an observation:
this is not so-clear from the Getting Started section of the zenoh.io website...
it would be better to clearly report that, otherwise it seems that the "hello world" example between two routers, even in the simplest network configuration, is not working at all.
Hi @lrodorigo,
You can connect multiple routers with each other manually using the -e option. For example for 2 routers :
host1> zenohd
host2> zenohd -e tcp/host1:7447
routers discovery is deactivated by default so that users keep full control on the routers network topology.
routers_autoconnect_multicast=true
too, you should also pull the master branch for this fix.
Sorry for annoying you with really noob questions, but I am also having problems with z_put.py
/z_get.py
/z_sub.py
examples (from https://github.com/eclipse-zenoh/zenoh-python/blob/master/examples/zenoh/).
In particular the following happens:
1) I start the z_sub.py
script
2) I run z_put.py
script (without additional parameters)
3) z_sub.py
correctly invokes the callback
4) if I run z_get.py
, no data are received at all.
Openning session...
New workspace...
Get Data from '/demo/example/**'...
Process finished with exit code 0
More over (while the zenohd process with a [working] REST plugin is running):
0) I start z_sub.py -e tcp/localhost:7447
1) I run z_put.py -e tcp/localhost:7447
2) I run curl -X PUT -d 'Hello Data!' http://localhost:8000/demo/example/test2
3) The z_sub.py
invokes the callback ONLY for the data sent from the z_put.py
script (and not for the data sent by the REST API)
4) The key put from z_put.py
is retreived on the API at http://localhost:8000/demo/**
but the content is blank (while the content received from z_sub.py
is (correctly) 'Put from Python!'
Am I missing something?
curl -X PUT -H 'content-type:application/properties' -d 'path_expr=/demo/example/**' http://localhost:8000/@/router/local/plugin/storages/backend/memory/storage/my-storage
), but unfortunately the result is the same
-e tcp/localhost:7447
to z_pub and z_get (in this case the multicast discovery should work?)
pip install eclipse-zenoh
you might have compatibility issue with the router built from master
branch. (sorry, we’re large phase of changes since the last 0.5.0-beta.8 release, including in the protocol and APIs…)pip install https://github.com/eclipse-zenoh/zenoh-python/zipball/master
zenohd --mem-storage '/demo/**’
python3 ./z_sub.py
python3 ./z_put.py
=> z_sub receives the publicationcurl -X PUT -d 'Hello Data!' http://localhost:8000/demo/example/test2
=> z_sub receives the publicationcurl http://localhost:8000/demo/**
=> result is:[
{ "key": "/demo/example/zenoh-python-put", "value": "Put from Python!", "encoding": "text/plain", "time": "2021-07-07T13:48:04.130432996Z/D2D25874C4884368A11E63673229BA46" },
{ "key": "/demo/example/test2", "value": "Hello Data!", "encoding": "application/x-www-form-urlencoded", "time": "2021-07-07T13:48:08.151674997Z/D2D25874C4884368A11E63673229BA46" }
]
-e tcp/localhost:7447
is not necessary for z_put and z_get since they are configured in peer
mode by default and will do multicast discovery and discover the router.
zenohd --mem-storage '/demo/**
everything is working, if I run the zenohd docker container, and then I create the storage using curl -X PUT -H 'content-type:application/properties' -d 'path_expr=/demo/example/**' http://localhost:8000/@/router/local/plugin/storages/backend/memory/storage/my-storage
, the GET request does not see the data sent from z_put.py
(but it sees the data sent from PUT HTTP requests)
/demo/**
in the sencond you are creating a storage on /demo/example/**
.
put
it may not be surprising that it does not get stored. What is the key you are putting?
eclipse/zenoh:master
image including Olivier’s fix for this issue is now ready. Please try to pull it and re-do your test.
Yes I noticed that, and actually the reported metadata of the two datastores are correct:
/@/router/FB96238589C74C1AAADBB8359A9A24A8/plugin/storages/backend/memory/storage/my-storage
{"path_expr":"/demo/example/**"}
and
/@/router/1FE3B25A0F674180A0424BEFC8F46314/plugin/storages/backend/memory/storage/mem-storage-1
{"path_expr":"/demo/**"}
Anyway I am using z_put.py
with the default --path parameter (/demo/example/zenoh-python-put
), and I am publishing with curl on /demo/example/zenoh-python-put