How to embed ArangoDB in a desktop application

烈酒焚心 提交于 2019-12-04 03:34:54

It's possible to install an instance of ArangoDB with your application installation.

It installs into it's own directory, and its key assets are:

  • ArangoDB Binaries
  • ArangoDB Data files
  • ArangoDB Log files
  • ArangoDB Foxx Applications (optional)

ArangoDB can run as a service, and it is configured via a file called arangod.conf.

This file centrally controls settings like the ports it runs on, the IP addresses it listens to, the database engine to use, SSL and security settings, and much more.

Taking Windows as an example, you can do a silent installation of ArangoDB, and then use tools like PowerShell or DOS batch files to stop/start the ArangoDB service, copy in an arangod.conf file with your required configuration settings, etc.

It's even possible to generate an SSL certificate and apply it to the ArangoDB instance so that you can have SSL connectivity to the database if required.

Additionally you can utilise the ArangoShell via scripts which allows you to create databases, restore default data from a backup, create ArangoDB users, assign rights.

It sounds like you need to get more comfortable with ArangoDB as a product, and then start to mess around with installing, uninstalling, configuring, and backing up/restoring databases.

I've also evaluated ArangoDB versus OrientDB, and I picked ArangoDB because it runs faster, has many more updates, and their driver packs are well written.

When it comes to embedded databases, you really need a multi-model database, and being able to store standard documents as well as graph data in one database engine, is invaluable.

Additionally, have a really good look at the Foxx MicroService architecture of ArangoDB. It allows you to host business logic behind REST API's and Job Queues running right in the ArangoDB database. This means your application doesn't even need raw table access to the database, rather it can access your data via a REST API and your internal schema is hidden from users, and your business logic stops them doing silly things and wrecking the database.

By having a REST API data layer between your application and the database, it gives you more flexibility on how people consume your data, giving you more options about opening it up in a safe way, knowing your application logic will keep your data safe.

If you chose to use Foxx, there is a cool new tool ArangoDB has released called foxx-cli which lets you script the installation and configuration of Foxx MicroServices in your database. This is a super powerful tool as it's possible to fully install and configure an ArangoDB server, database, and internal settings via installation scripts.

Take time to learn ArangoDB, as with all skills it takes time to really get to know it. I'm still learning something every day and I've only been using it for 2 years :)

If you're using NodeJS (which I have to assume as you don't mention what programming language you're using) as your platform you can use Electron (https://electron.atom.io) and use the ArangoJS (http://npmjs.com/package/arangojs) Driver, if an ORM is necessary I'd recommend using (http://npmjs.com/package/caminte) which has built-in support for ArangoDB, although the documentation being to a poor standard, it should be suffice with some programming knowledge.

OFT: Electron lets you create cross platform Desktop applications in pure HTML, JS and CSS. You can also use Cordova if you're targeting the mobile platform.

You could also use Foxx to perform some of your application logic (this is down to your personal preference) or also create an API platform (with for example Restify).

Most of database systems are written in C++ but that does not mean can only access them via C++, additional drivers are provided for the popular languages. If you use a specific language then update the question so we can help further.

You might also want to read this: https://www.arangodb.com/2018/02/nosql-performance-benchmark-2018-mongodb-postgresql-orientdb-neo4j-arangodb/ as to why ArangoDB would be a better choice for you.


Edit

Due to my limited experience in C++ I can only provide some references which I've saved earlier, but I'm sure they'll be of use to you.

For C++ the driver you should be using is:

https://www.arangodb.com/2017/11/introduction-fuerte-arangodb-c-plus-plus-driver/

An example of the usage of the driver:

https://www.arangodb.com/wp-content/uploads/2017/10/C-Example-Source-Code-File.cc

A simple example / tutorial on how to use graphing in ArangoDB:

https://docs.arangodb.com/3.2/Manual/Graphs/

A free course by Arango on Graphing:

https://www.arangodb.com/arangodb-graph-course/

Hope they help!

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!