Peer Server

Running the Peer Server

A Datomic Peer Server provides an interface for Datomic clients to access databases.

The Peer Server communicates with storage and the Transactor to service both reads from and writes to Datomic databases. As such, the system running the Peer Server must have appropriate permissions to access storage, as specified in the Storage Documentation.

The Peer Server must also be able to connect to the live Transactor at the location specified by the host property in the transactor properties file. For more information on the connection between the Peer Server and the Transactor see the Deployment Documentation.

It is important to note that Peer Servers do not own databases. As such, the Peer Server cannot create or destory a database.

You can launch a Peer Server for one or more databases with the peer-server command:

bin/run -m datomic.peer-server\
        -h host\
        -p port\ 
        -a access-key,secret\
        -d dbname,URI\

The access-key and secret are opaque strings. Clients must provide a matching access-key and secret to connect.

A dbname can consist of alphanumeric characters plus the hyphen '-'.

The database URI is described in the documentation for connect, e.g.


The -d option may be passed multiple times to serve multiple databases from a single peer server. As a development convenience, a Peer Server can also serve transient, memory-only databases by passing a mem URI to the Peer Server command.

The -a option may be passed multiple time to allow multiple access keys and secrets, e.g. to support a key rotation scheme.

Connecting to the Peer Server

To connect to a Peer Server, call connect, passing in the arguments you used to create the peer server

  • Peer Server host:port for :endpoint
  • Peer Server secret for :secret
  • Peer Server access-key for :access-key

with the other connect arguments hard-coded as shown in the example below:

 '[clojure.core.async :refer (<!!)]
 '[datomic.client :as client])

(def conn
  (<!! (client/connect
        {:db-name "my-db"
         :account-id client/PRO_ACCOUNT
         :secret "my-secret"
         :access-key "my-access-key"
         :endpoint "localhost:8998"
         :region "none"
         :service "peer-server"})))

Health Check

The peer server exposes /health as a health check endpoint, and will respond with a 2xx status code to HTTP requests for {host}:{port}/health. Given a peer server runnnig with

bin/run -m datomic.peer-server -a k,s -d test,datomic:mem://test

The health check will respond:

curl localhost:8998/health

curl: (52) Empty reply from server


The use of iteration in the Client API (i.e. taking from a query or datoms result channel repeatedly) requires that the client communicate with the same Peer Server instance that served the original request. In a system with multiple Peer Servers behind a load balancer we recommend you enable sticky sessions to ensure iterative requests are routed to the same Peer Server instance. If sticky sessions are unavailable, it is also possible to handle chunking and iteration manually using the :limit and :offset arguments.