Persisting data in the state store

The state store is a distributed storage system, deployed as part of Azure IoT Operations. Using the state store, applications can get, set, and delete key-value pairs, without needing to install more services, such as Redis. The state store also provides versioning of the data, and also the primitives for building distributed locks, ideal for highly available applications.

Like Redis, the state store uses in memory storage. Stopping or restarting the Kubernetes cluster causes the state store contents to be lost.

The state store is implemented via MQTTv5. Its service is integrated directly into MQTT broker and is automatically started when the broker starts. The state store provides the same high availability as the MQTT broker.

Why use the state store?

The state store allows an edge application to persist data on the edge. Typical uses of the state store include:

  • Creating stateless applications
  • Sharing state between applications
  • Developing highly available applications
  • Storing data to be used by dataflows

State store authorization

The state store extends MQTT broker's authorization mechanism, allowing individual clients to have optional read and write access to specific keys. Read more on how to configure MQTT broker authorization for the state store.

Interacting with the state store

A state store CLI tool is available which enables interaction with the state store from a shell running on a off-cluster computer. The documentation will guide you through:

  1. Generating an X.509 certificate chain for authenticating with MQTT broker
  2. Creating a BrokerAuthentication using x.509 certificates
  3. Creating a BrokerListener of type LoadBalancer to enable off-cluster access

For instructions on using the tool, refer to the state store CLI GitHub page.

Note

SDKs to interact with the state store are currently in active development, and will be available in the near future to enable edge applications to interact with the state store.