Introduction
Build scalable communication systems with Eclipse Zenoh
Get started with Zenoh on Raspberry Pi and Arm Linux
Containerize and deploy Zenoh across multiple Raspberry Pi devices
Run a simple Zenoh pub/sub example
Run a Zenoh storage and query example
Run a Zenoh queryable node for on-demand edge computation
Run a Zenoh queryable with parameterized Rust computation
Next Steps
This example demonstrates Zenoh’s data storage and query model which enables nodes to retrieve previously published values—even after the original publisher goes offline.
Building on the previous pub/sub example, you’ll now run a lightweight Zenoh daemon that stores key–value pairs in memory. Then, you’ll publish data with z_put
and retrieve it using z_get
.
This pattern is ideal for robotics and IIoT scenarios where devices intermittently connect or request snapshots of remote state.
For example, in a warehouse or factory:
Unlike Pub/Sub, which requires live, real-time message exchange, Zenoh’s storage and query model enables asynchronous access to data that was published earlier, even if the original publisher is no longer online.
In this example, you’ll run the zenohd
daemon with in-memory storage and use z_put
to publish data and z_get
to retrieve it.
This is especially useful for distributed systems where nodes may intermittently connect or request snapshots of state from peers.
On one Raspberry Pi, launch the Zenoh daemon with a configuration that enables in-memory storage for keys in the demo/example/**
directory.
cd ~/zenoh/target/release/
./zenohd --cfg='plugins/storage_manager/storages/demo:{key_expr:"demo/example/**",volume:"memory"}' &
This starts the Zenoh daemon with in-memory storage support.
You should see log messages indicating that the storage_manager plugin is loaded.
If port 7447 is already in use, either stop any previous Zenoh processes or configure a custom port using the listen.endpoints.router
setting.
On 2nd Raspberry Pi device, use z_put
to send a key-value pair that will be handled by the zenohd
storage.
cd ~/zenoh/target/release/examples
./z_put -k demo/example/test1 -p "Hello from storage!"
This command stores the string Hello from storage!
under the key demo/example/test1.
Back on first Raspberry Pi, you can now query the stored data from any Zenoh connected node.
cd ~/zenoh/target/release/examples
./z_get -s demo/example/test1
You should see an output similar to:
Sending Query 'demo/example/test1'...
>> Received ('demo/example/test1': 'Hello from storage!')
The result is shown below:
Figure 2: Storage and Query
If you have more than two Raspberry Pi devices, you can run the z_get
command on a third device to validate that storage queries work seamlessly across a multi-node setup.
This example shows how Zenoh’s storage with query model supports asynchronous data access and resilient state-sharing—critical capabilities in robotics and industrial IoT systems where network connectivity may be intermittent or system components loosely coupled.
Now that you’ve seen how Zenoh handles pub/sub and storage-based queries, you’re ready to build reactive and intelligent edge nodes.
In the next example, you’ll implement a Zenoh queryable that responds to runtime parameters,such as battery level and temperature, by computing and returning a real-time health score. This showcases how Zenoh supports on-demand edge computation without needing to pre-store data.