The documentation you are viewing is for Dapr v1.6 which is an older version of Dapr. For up-to-date documentation, see the latest version.


RethinkDB 状态存储组件的详细信息


To setup RethinkDB state store, create a component of type state.rethinkdb. See the how-to guide to create and apply a state store configuration.

kind: Component
  name: <NAME>
  namespace: <NAMESPACE>
  type: state.rethinkdb
  version: v1
  - name: address
    value: <REPLACE-RETHINKDB-ADDRESS> # Required, e.g. or rethinkdb.default.svc.cluster.local:28015).
  - name: database
    value: <REPLACE-RETHINKDB-DB-NAME> # Required, e.g. dapr (alpha-numerics only)
  - name: table
    value: # Optional
  - name: username
    value: <USERNAME> # Optional
  - name: password
    value: <PASSWORD> # Optional
  - name: archive
    value: bool # Optional (whether or not store should keep archive table of all the state changes)

If you wish to use RethinkDB as an actor store, append the following to the YAML.

  - name: actorStateStore
    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 named daprstate in the specified database.

此外,如果可选的 archive 元数据被设置为 true,在每个状态改变时,RethinkDB 状态存储将在 daprstate_archive 表中记录带有时间戳的状态存储。 这允许对 Dapr 管理的状态进行时间序列分析。


字段 必填 详情 示例
address Y RethinkDB 服务器的地址 "", "rethinkdb.default.svc.cluster.local:28015"
database Y 要使用的数据库。 仅限字母数字 "dapr"
table 要使用的表名 "table"
username 连接使用的用户名 "user"
password N 连接使用的密码 "password"
archive N 是否存档表 "true", "false"

设置 RethinkDB

您可以使用 Docker 在本地运行 RethinkDB

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

连接到管理 UI:

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