docs/howto/setup-state-store
Yaron Schneider 6c2fa97c64
Add Zookeeper how to (#222)
2019-11-01 16:31:44 -07:00
..
README.md Add Zookeeper how to (#222) 2019-11-01 16:31:44 -07:00
setup-azure-cosmosdb.md clarify cosmosdb doc (#212) 2019-10-30 11:25:34 -07:00
setup-cassandra.md Add how to's for etcd, consul and cassandra (#213) 2019-10-31 11:02:00 -07:00
setup-consul.md Add how to's for etcd, consul and cassandra (#213) 2019-10-31 11:02:00 -07:00
setup-etcd.md Add how to's for etcd, consul and cassandra (#213) 2019-10-31 11:02:00 -07:00
setup-memcached.md Add how to's for etcd, consul and cassandra (#213) 2019-10-31 11:02:00 -07:00
setup-mongodb.md add MongoDB how to guide (#221) 2019-11-01 14:32:14 -07:00
setup-redis.md Clean pub sub (#172) 2019-10-19 14:04:20 -07:00
setup-zookeeper.md Add Zookeeper how to (#222) 2019-11-01 16:31:44 -07:00
supported-state-stores.md Add Zookeeper how to (#222) 2019-11-01 16:31:44 -07:00

README.md

Setup a Dapr state store

Dapr integrates with existing databases to provide apps with state management capabilities for CRUD operations, transactions and more. Currently, Dapr supports the configuration of one state store per cluster.

State stores are extensible and can be found in the components-contrib repo.

A state store in Dapr is described using a Component file:

apiVersion: dapr.io/v1alpha1
kind: Component
metadata:
  name: statestore
spec:
  type: state.<DATABASE>
  metadata:
  - name: <KEY>
    value: <VALUE>
  - name: <KEY>
    value: <VALUE>
...

The type of database is determined by the type field, and things like connection strings and other metadata are put in the .metadata section. Even though you can put plain text secrets in there, it is recommended you use a secret store.

Running locally

When running locally with the Dapr CLI, a component file for a Redis state store will be automatically created in a components directory in your current working directory.

You can make changes to this file the way you see fit, whether to change connection values or replace it with a different store.

Running in Kubernetes

Dapr uses a Kubernetes Operator to update the sidecars running in the cluster with different components. To setup a state store in Kubernetes, use kubectl to apply the component file:

kubectl apply -f statestore.yaml

Reference