Skip to content

Storage options

Anton Medviediev edited this page May 5, 2017 · 4 revisions

DeviceHive currently provides two options for metadata storage - PostgreSql and Riak. PostgreSql is the recommended option and is enabled by default.

If you want to use Riak instead, you can either use the Riak Docker image, or build from sources.

Building from sources

You will need a running instance of the Riak database (http://docs.basho.com/riak/kv/2.2.3/setup/).

Once Riak is up and running, download DH sources and build with the riak profile

mvn clean package -Pbooted-riak

Next, you will need to install the custom MapReduce scripts and configurations provided with DH. This should be executed from the machine that is running Riak.

./${devicehive-java-server-directory}/devicehive-riak-dao/src/main/resources/map-reduce/install.sh

Finally, you will need to init the database schema and import default initial data. This should be executed from the machine that is running Riak.

./${devicehive-java-server-directory}/devicehive-riak-dao/src/main/resources/riak-initial-data.sh

Once the script successfully finishes, you can start the DH server.

Start Zookeeper and Apache Kafka brokers as explained at official documentation (http://kafka.apache.org/documentation.html#quickstart). If your Kafka brokers are installed on different machines, please specify their hostname/ports at app.properties file. You need to update zookeeper.connect (zookeeper's contact point) and bootstrap.servers (list of brokers) properties.

To start the server itself, you have to start the backend and the frontend. To do this, first run following command:

java -jar ${devicehive-java-server-directory}/devicehive-backend/target/devicehive-backend-<version>-boot.jar

Wait for the application to start, then run:

java -jar ${devicehive-java-server-directory}/devicehive-frontend/target/devicehive-frontend-<version>-boot.jar

This will start embedded undertow application server on default port 8080 and deploy DeviceHive application.

Docker

The Riak Docker image and instructions can be found in this repository https://github.com/devicehive/devicehive-docker/tree/updated-admin/riak-image. The image will provide DH, Riak and all required dependencies.

Clone this wiki locally