PostgreSQL

Dapr can use any PostgreSQL instance. If you already have a running instance of PostgreSQL, move on to the Create a Dapr component section.

  1. Run an instance of PostgreSQL. You can run a local instance of PostgreSQL in Docker CE with the following command:

    This example does not describe a production configuration because it sets the password in plain text and the user name is left as the PostgreSQL default of “postgres”.

  2. To create a new database in PostgreSQL, run the following SQL command:

Create a file called , paste the following and replace the <CONNECTION STRING> value with your connection string. The connection string is a standard PostgreSQL connection string. For example, . See the PostgreSQL , specifically Keyword/Value Connection Strings, for information on how to define a connection string.

If you want to also configure PostgreSQL to store actors, add the actorStateStore configuration element shown below.

Warning

To apply the PostgreSQL state store to Kubernetes, use the CLI:

Running locally

To run locally, create a components dir containing the YAML file and provide the path to the command with the flag --components-path.