状态存储组件

为 Dapr 状态管理建立不同状态存储的指导

Dapr 与现有数据库集成,为应用程序提供CRUD操作、事务等状态管理功能。 Dapr 支持为每个应用配置多个命名的状态存储组件。

状态存储可以扩展,可以在 components-contrib repo 中找到。

Dapr 的使用 Component 文件来描述状态存储:

  1. apiVersion: dapr.io/v1alpha1
  2. kind: Component
  3. metadata:
  4. name: statestore
  5. namespace: default
  6. spec:
  7. type: state.<DATABASE>
  8. version: v1
  9. metadata:
  10. - name: <KEY>
  11. value: <VALUE>
  12. - name: <KEY>
  13. value: <VALUE>
  14. ...

数据库的类型由type字段决定,连接地址和其他元数据等放在.metadata部分。 Even though metadata values can contain secrets in plain text, it is recommended you use a secret store.

Visit this guide on how to configure a state store component.

支持的状态存储

Visit this reference to see all of the supported state stores in Dapr.

相关主题