link:./deps.edn[role=include]
There are two main Crux systems: cluster node vs standalone. Use a cluster node system when horizontal scalability is required or when you want the guarantees that Kafka offers in terms of resiliency, availability, and retention of data.
Multiple instances of a cluster node systems may participate in a cluster using Kafka as the primary store and as the central means of coordination.
The Standalone system is where a single Crux instance has everything it needs locally. This is good for experimenting with Crux and for small to medium sized deployments, where running a single instance is permissible.
Name | Transaction Log | Java API |
---|---|---|
Cluster Node | Uses Kafka |
|
Standalone | Uses local event log |
|
Crux systems implement the ICruxAPI
interface and are the
starting point for making use of Crux. Systems also implement
java.io.Closeable
and can therefore be lifecycle managed.
To see an example of a Crux System being integrated into a Clojure lifecycle management framework such as Integrant, see the example Integrant system. |
Crux Systems will use the following properties:
System | Component | Property | Description |
---|---|---|---|
Both | kv-store |
| Sets the K/V Store to use, e.g. |
Both | kv-store |
| Sets the data-directory to use, e.g. |
Standalone | tx-log |
| Kafka Servers to connect to e.g. |
Standalone | http-server |
| Port for Crux HTTP Server e.g. |
Using the Crux standalone system is the best way to get started. Once you’ve started a standalone Crux instance as described below, you can then follow the getting started example.
link:./examples.clj[role=include]
For the purposes of this Hello World, we are using the simplest configuration of Crux, where all of the pluggable components are in-memory. There is no Kafka or RocksDB to worry about.
You can later stop the system if you wish:
link:./examples.clj[role=include]
When using Crux at scale it is recommended to use Crux as nodes connecting to a Kafka cluster.
Add Crux as a project dependency:
link:./deps.edn[role=include]
And Kafka Clients:
Use the API to start a cluster node system, configuring it with the
bootstrap-servers
property in order to connect to Kafka:
link:./examples.clj[role=include]
If you don’t specify kv-backend then by default the
cluster-node system will use RocksDB. You will need to add RocksDB to
your list of project dependencies.
|
You can later stop the system if you wish:
link:./examples.clj[role=include]
Set the following properties when configuring Crux systems:
Property | Value |
---|---|
|
|
| i.e. |
| i.e. |
For example when constructing the standalone system:
link:./examples.clj[role=include]
Crux can be used programmatically as a library, but Crux also ships with an embedded HTTP server, that allows clients to use the API remotely via REST.
Set the server-port
configuration property on a Crux system to
expose a HTTP port that will accept REST requests.
Visit the guide on using the REST api for examples of how to interact with Crux over HTTP.
Crux is ready to work with an embedded Kafka.
Add Kafka and Zookeeper to your project dependencies:
See the below example code:
link:./examples.clj[role=include]
You can later stop the Embedded Kafka if you wish:
link:./examples.clj[role=include]
Can you improve this documentation? These fine people already did:
Jeremy Taylor, Ivan Fedorov, Antonelli712, Alex Davis & Jon PitherEdit on GitHub
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close