Liking cljdoc? Tell your friends :D

Installation

XTDB nodes can be embedded within your JVM application, or they can be started standalone through a pre-built XTDB JAR, via Docker, or using Clojure CLI tooling.

This guide will show you how to set up an in-memory node using the core module. You can then proceed to add further modules (eg for persistence) as required - see the documentation of the individual modules for more information.

Project dependency

XTDB depends on Java 8+.

deps.edn
com.xtdb/xtdb-core {:mvn/version "{xtdb_version}"}
pom.xml
<dependency>
    <groupId>com.xtdb</groupId>
    <artifactId>xtdb-core</artifactId>
    <version>{xtdb_version}</version>
</dependency>

Within your JVM application

First, add the core module as a project dependency. We can then start up an in-memory XTDB node with:

Clojure
(require '[xtdb.api :as xt])

(xt/start-node {})
Java
link:example$test/xtdb/docs/Install.java[role=include]

link:example$test/xtdb/docs/Install.java[role=include]
link:example$test/xtdb/docs/Install.java[role=include]
Kotlin
link:example$test/xtdb/docs/Install.kt[role=include]

link:example$test/xtdb/docs/Install.kt[role=include]

Using a pre-built XTDB JAR

You can start a standalone XTDB node, accessible through HTTP, using a pre-built XTDB JAR. XTDB pre-built JARs can be found on the relevant GitHub releases page - we’ll use xtdb-in-memory.jar.

Start it in the usual way, with java -jar xtdb-in-memory.jar. This will open an HTTP port with a console UI on port 3000 - open http://localhost:3000 in your favourite browser.

You can also build custom XTDB JARs with your choice of modules - see the XTDB build blog post for more details.

Via Docker

You can also start a standalone XTDB node using Docker, using:

docker run -p 3000:3000 juxt/xtdb-in-memory:1.21.0

Again, this opens up an HTTP server at http://localhost:3000.

Likewise, you can build custom XTDB Docker images - see the XTDB build blog post for more details.

Clojure CLI tooling

Similarly, to start XTDB using Clojure’s CLI tooling:

deps.edn
{:deps {org.clojure/clojure {:mvn/version "1.10.3"}
        com.xtdb/xtdb-core {:mvn/version "{xtdb_version}"}
        com.xtdb/xtdb-http-server {:mvn/version "{xtdb_version}"}}}
xtdb.edn
{:xtdb.http-server/server {:port 3000}}

Then, start the node with clojure -m xtdb.main.

You can get a listing of CLI flags using clojure -m xtdb.main -h.

Can you improve this documentation? These fine people already did:
James Henderson, Jeremy Taylor & Steven Deobald
Edit on GitHub

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close