Forst of all, you need to find proper packages for your distribution. At this time Dinemic Framework supports:
- Ubuntu 16.04, 16.10, 17.04 and 17.10
- Debian Jessie and Stretch
- Centos 7
All packages and versions you can find at our repository: https://packages.dinemic.io. Find proper version of your system and library version. Then download rpm, deb package or tarball if you want to extract it manually.
Dinemic framework is distributed in binary version with all dependencies, so it is important to find version dedicated for your distribution.
Redhat and Centos
wget https://packages.dinemic.io/centos-7/VERSION/libdinemic-VERSION.rpm rpm -Uvh libdinemic-VERSION.rpm
Debian and Ubuntu
wget https://packages.dinemic.io/debian-stretch/VERSION/libdinemic-VERSION.deb dpkg -i libdinemic-VERSION.deb
wget https://packages.dinemic.io/centos-7/VERSION/libdinemic-VERSION.tar tar xf libdinemic-VERSION.tar
One of features of this framework is the database proxy and ORM. It handles data changes of C++ objects in your applications and transparently stores it inside database. Thus, the database engine is necessary to run your applications.
Dinemic provides two database drivers. First one is MemoryDriver, which is votaile and stores all data in RAM. The second driver is RedisDriver, which uses the Redis Server as key-value data store to save all data on local disk.
To use RedisDriver, install proper package:
Installing Redis at Debian and Ubuntu
sudo apt-get install redis-server
Installing Redis on Centos 7 and Redhat
yum install redis
Redis server should be installed on every node, that uses RedisDriver. Due to Dinemic architecture, each application node (you application instance) requires local data store, thus the Redis server.
Create configuration file
Last step before creating your application is to create config.dinemic file with configuration for your application at each node. At beginning we will create only local application, so you will need only one instance of this file. However multiple applications running on the same host should not use the same database, so you will need different configuration files in future, one for each instance of application running on computer.
The default configuration file looks like following:
LOGLEVEL: error KEYRING_DIR: /tmp/dinemic_keys ZEROMQ_SYNC_MULTICAST_PORT: 3344 ZEROMQ_SYNC_MULTICAST_ADDR: 22.214.171.124 STORE_DRIVER: MemoryDriver REDIS_SERVER: localhost REDIS_PORT: 6379 REDIS_DATABASE: 1
Each entry consists of key followed by colon, space and value. For example:
The LOGLEVEL defines verbosity of libdinemic framework. Allowed values are: none, error, info, debug, mutex. The last one allows to show all messages related to internal locks and is very verbose. The prefered loglevel is error or info.
The KEYRING_DIR defines where dinemic should store keys for objects created within ORM and framework, and also where to store public keys of objects created on other nodes of network.
The ZEROMQ_… variables define parameters of aotudiscovery mechanism of ZeroMQ synchronization driver. This parameters should be equal on all nodes of network to provide autodiscovery. Without this setting consistent, applications will not find each other. This setting could be also used to limitate one cluster of application from another, using the same phsical network.
The STORE_DRIVER defines which driver should be used to store data on local machine for application. In version 0.1.5 possible values are: RedisDriver which uses Redis backnd and MemoryDriver which stores data in RAM.
The REDIS_… parameters are used to obtain connection with local redis server. The REDIS_DATABASE could be used to handle multiple applications on the same machine. Due to each application decides how database should look like, connectint multiple applications to the same database will cause data looses.