CI Discussion Discord License License

Eclipse Zenoh

The Eclipse Zenoh: Zero Overhead Pub/sub, Store/Query and Compute.

Zenoh (pronounce /zeno/) unifies data in motion, data at rest and computations. It carefully blends traditional pub/sub with geo-distributed storages, queries and computations, while retaining a level of time and space efficiency that is well beyond any of the mainstream stacks.

Check the website zenoh.io and the roadmap for more detailed information.


InfluxDB backend

In Zenoh a backend is a storage technology (such as DBMS, time-series database, file system...) alowing to store the keys/values publications made via zenoh and return them on queries. See the zenoh documentation for more details.

This backend relies on an InfluxDB server to implement the storages. Its library name (without OS specific prefix and extension) that zenoh will rely on to find it and load it is zbackend_influxdb.

:point_right: Install latest release: see below

:point_right: Build "master" branch: see below

:warning: InfluxDB 2.x is not yet supported. InfluxDB 1.8 minimum is required.


:warning: Documentation for previous 0.5 versions:

The following documentation related to the version currently in development in "master" branch: 0.6.x.

For previous versions see the README and code of the corresponding tagged version: - 0.5.0-beta.9 - 0.5.0-beta.8


Examples of usage

Prerequisites: - You have a zenoh router (zenohd) installed, and the zbackend_influxdb library file is available in ~/.zenoh/lib. - You have an InfluxDB service running and listening on http://localhost:8086

You can setup storages either at zenoh router startup via a configuration file, either at runtime via the zenoh admin space, using for instance the REST API.

Setup via a JSON5 configuration file

Setup at runtime via curl commands on the admin space

Tests using the REST API

Using curl to publish and query keys/values, you can: ```bash

Put some values at different time intervals

curl -X PUT -d "TEST-1" http://localhost:8000/demo/example/test curl -X PUT -d "TEST-2" http://localhost:8000/demo/example/test curl -X PUT -d "TEST-3" http://localhost:8000/demo/example/test

Retrive them as a time serie where '_time=[..]' means "infinite time range"

curl -g 'http://localhost:8000/demo/example/test?_time=[..]' ```


Volume configuration

InfluxDB-backed volumes need some configuration to work:

Both username and password should be hidden behind a private gate, as shown in the example above. In general, if you wish for a part of the configuration to be hidden when configuration is queried, you should hide it behind a private gate.


Volume-specific storage configuration

Storages relying on a influxdb backed volume may have additional configuration through the volume section: - "db" (optional, string) : the InfluxDB database name the storage will map into. If not specified, a random name will be generated, and the corresponding database will be created (even if "create_db" is not set).


Behaviour of the backend

Mapping to InfluxDB concepts

Each storage will map to an InfluxDB database.
Each key to store will map to an InfluxDB measurement named with the key stripped from the "strip_prefix" property (see below).
Each key/value put into the storage will map to an InfluxDB point reusing the timestamp set by zenoh (but with a precision of nanoseconds). The fileds and tags of the point is are the following: - "kind" tag: the zenoh change kind ("PUT" for a value that have been put, or "DEL" to mark the deletion of the key) - "timestamp" field: the original zenoh timestamp - "encoding" field: the value's encoding flag - "base64" field: a boolean indicating if the value is encoded in base64 - "value"field: the value as a string, possibly encoded in base64 for binary values.

Behaviour on deletion

On deletion of a key, all points with a timestamp before the deletion message are deleted. A point with "kind"="DEL" is inserted (to avoid re-insertion of points with an older timestamp in case of un-ordered messages). After a delay (5 seconds), the measurement corresponding to the deleted key is dropped if it still contains no points.

Behaviour on GET

On GET operations, by default the storage returns only the latest point for each key/measurement. This is to be coherent with other backends technologies that only store 1 value per-key.
If you want to get time-series as a result of a GET operation, you need to specify a time range via the "_time"argument in your Selector.

Examples of selectors: ```bash # get the complete time-series /demo/example/**?_time=[..]

# get points within a fixed date interval /demo/example/influxdb/**?_time=[2020-01-01T00:00:00Z..2020-01-02T12:00:00.000000000Z]

# get points within a relative date interval /demo/example/influxdb/**?_time=[now(-2d)..now(-1d)] ```

See the "_time" RFC for a complete description of the time range format


How to install it

To install the latest release of this backend library, you can do as follows:

Manual installation (all platforms)

All release packages can be downloaded from:
- https://download.eclipse.org/zenoh/zenoh-backend-influxdb/latest/

Each subdirectory has the name of the Rust target. See the platforms each target corresponds to on https://doc.rust-lang.org/stable/rustc/platform-support.html

Choose your platform and download the .zip file.
Unzip it in the same directory than zenohd or to any directory where it can find the backend library (e.g. /usr/lib or ~/.zenoh/lib)

Linux Debian

Add Eclipse Zenoh private repository to the sources list, and install the zenoh-backend-influxdb package:

bash echo "deb [trusted=yes] https://download.eclipse.org/zenoh/debian-repo/ /" | sudo tee -a /etc/apt/sources.list > /dev/null sudo apt update sudo apt install zenoh-backend-influxdb


How to build it

:warning: WARNING :warning: : Zenoh and its ecosystem are under active development. When you build from git, make sure you also build from git any other Zenoh repository you plan to use (e.g. binding, plugin, backend, etc.). It may happen that some changes in git are not compatible with the most recent packaged Zenoh release (e.g. deb, docker, pip). We put particular effort in mantaining compatibility between the various git repositories in the Zenoh project.

At first, install Cargo and Rust.

:warning: WARNING :warning: : As Rust doesn't have a stable ABI, the backend library should be built with the exact same Rust version than zenohd, and using for zenoh dependency the same version (or commit number) than 'zenohd'. Otherwise, incompatibilities in memory mapping of shared types between zenohd and the library can lead to a "SIGSEV" crash.

To know the Rust version you're zenohd has been built with, use the --version option.
Example: bash $ zenohd --version The zenoh router v0.6.0-beta.1 built with rustc 1.64.0 (a55dd71d5 2022-09-19) Here, zenohd has been built with the rustc version 1.64.0.
Install and use this toolchain with the following command:

bash $ rustup default 1.64.0

And zenohd version corresponds to an un-released commit with id 1f20c86. Update the zenoh dependency in Cargo.lock with this command: bash $ cargo update -p zenoh --precise 1f20c86

Then build the backend with: bash $ cargo build --release --all-targets