RethinkDB

Detailed information on the RethinkDB state store component

配置

To setup RethinkDB state store create a component of type state.rethinkdb. 请参阅本指南,了解如何创建和应用状态存储配置。

  1. apiVersion: dapr.io/v1alpha1
  2. kind: Component
  3. metadata:
  4. name: <NAME>
  5. namespace: <NAMESPACE>
  6. spec:
  7. type: state.rethinkdb
  8. version: v1
  9. metadata:
  10. - name: address
  11. value: <REPLACE-RETHINKDB-ADDRESS> # Required, e.g. 127.0.0.1:28015 or rethinkdb.default.svc.cluster.local:28015).
  12. - name: database
  13. value: <REPLACE-RETHINKDB-DB-NAME> # Required, e.g. dapr (alpha-numerics only)
  14. - name: table
  15. value: # Optional
  16. - name: username
  17. value: <USERNAME> # Optional
  18. - name: password
  19. value: <PASSWORD> # Optional
  20. - name: archive
  21. value: bool # Optional (whether or not store should keep archive table of all the state changes)

Warning

以上示例将密钥明文存储, It is recommended to use a secret store for the secrets as described here.

If you wish to use Redis as an actor store, append the following to the yaml.

  1. - name: actorStateStore
  2. value: "true"

RethinkDB state store supports transactions so it can be used to persist Dapr Actor state. By default, the state will be stored in table name daprstate in the specified database.

Additionally, if the optional archive metadata is set to true, on each state change, the RethinkDB state store will also log state changes with timestamp in the daprstate_archive table. This allows for time series analyses of the state managed by Dapr.

元数据字段规范

字段必填详情Example
addressYThe address for RethinkDB server“127.0.0.1:28015”, “rethinkdb.default.svc.cluster.local:28015”
databaseYThe database to use. Alpha-numerics only“dapr”
tableNThe table name to use“table”
usernameNThe username to connect with“user”
passwordNThe password to connect with“password”
archiveNWhether or not to archive the table“true”, “false”

Setup RethinkDB

You can run RethinkDB locally using Docker:

  1. docker run --name rethinkdb -v "$PWD:/rethinkdb-data" -d rethinkdb:latest

To connect to the admin UI:

  1. open "http://$(docker inspect --format '{{ .NetworkSettings.IPAddress }}' rethinkdb):8080"

相关链接