Getting started with orientdb
Installation or Setup
OrientDB is available in two editions:
Enterprise Edition is commercial software built on top of the Community Edition. Enterprise is developed by the same team that developed the OrientDB engine. It serves as an extension of the Community Edition, providing Enterprise features, such as:
- Non-Stop Backup and Restore
- Scheduled FULL and Incremental Backups
- Query Profiler
- Distributed Clustering configuration
- Metrics Recording
- Live Monitoring with configurable Alerts
The Community Edition is available as a binary package for download or as source code on GitHub. The Enterprise Edition license is included with Support purchases.
Both editions of OrientDB run on any operating system that implements the Java Virtual machine (JVM). Examples of these include:
- Linux, all distributions, including ARM (Raspberry Pi, etc.)
- Mac OS X
- Microsoft Windows, from 95/NT and later
- IBM AIX
OrientDB requires Java, version 1.7 or higher.
Note: In OSGi containers, OrientDB uses a
ConcurrentLinkedHashMapimplementation provided by concurrentlinkedhashmap to create the LRU based cache. This library actively uses the sun.misc package which is usually not exposed as a system package. To overcome this limitation you should add property
sun.miscto your list of framework properties.
It may be as simple as passing an argument to the VM starting the platform:
$ java -Dorg.osgi.framework.system.packages.extra=sun.misc
If you have Docker installed in your computer, this is the easiest way to run OrientDB. From the command line type:
$ docker run -d –-name orientdb -p 2424:2424 -p 2480:2480 -e ORIENTDB_ROOT_PASSWORD=root orientdb:latest
Where instead of “root”, type the root’s password you want to use.
OrientDB provides a pre-compiled binary package to install the database on your system. Depending on your operating system, this is a tarred or zipped package that contains all the relevant files you need to run OrientDB. For desktop installations, go to OrientDB Downloads and select the package that best suits your system.
On server installations, you can use the
$ wget https://orientdb.com/download.php?file=orientdb-community-2.2.0.tar.gz
Whether you use your web browser or
wget, unzip or extract the downloaded file into a directory convenient for your use, (for example,
/opt/orientdb/ on Linux). This creates a directory called
orientdb-community-2.2.0 with relevant files and scripts, which you will need to run OrientDB on your system.
Source Code Installation
In addition to downloading the binary packages, you also have the option of compiling OrientDB from the Community Edition source code, available on GitHub. This process requires that you install Git and Apache Maven on your system.
To compile OrientDB from source code, clone the Community Edition repository, then run Maven (
mvn) in the newly created directory:
$ git clone https://github.com/orientechnologies/orientdb $ git checkout develop $ cd orientdb $ mvn clean install
It is possible to skip tests:
$ mvn clean install -DskipTests
The develop branch contains code for the next version of OrientDB. Stable versions are tagged on master branch.
For each maintained version OrientDB has its own
As the time of writing this notes, the state of branches is:
- develop: work in progress for next 3.0.x release (3.0.x-SNAPSHOT)
- 2.2.x: hot fix for next 2.2.x stable release (2.2.x-SNAPSHOT)
- 2.1.x: hot fix for next 2.1.x stable release (2.1.x-SNAPSHOT)
- 2.0.x: hot fix for next 2.0.x stable release (2.0.x-SNAPSHOT)
- last tag on master is 2.2.0
The build process installs all jars in the local maven repository and creates archives under the
distribution module inside the
target directory. At the time of writing, building from branch 2.1.x gave:
$ls -l distribution/target/ total 199920 1088 26 Jan 09:57 archive-tmp 102 26 Jan 09:57 databases 102 26 Jan 09:57 orientdb-community-3.0.0-SNAPSHOT.dir 48814386 26 Jan 09:57 orientdb-community-3.0.0-SNAPSHOT.tar.gz 53542231 26 Jan 09:58 orientdb-community-3.0.0-SNAPSHOT.zip $
orientdb-community-3.0.0-SNAPSHOT.dir contains the OrientDB distribution uncompressed.
Take a look to Contribute to OrientDB if you want to be involved.
Each distribution package contains a sample database called GratefulDeadConcerts. It is possible to generate the database:
$ cd distribution/ $ mvn prepare-package [INFO] Scanning for projects... [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building OrientDB Community Distribution ... ... Importing GRAPHML database from ../graphdb/src/test/resources/graph-example-2.xml with options ()... Done: imported 809 vertices and 8049 edges Imported in 1141ms. Vertexes: 809
The database is created inside the target directory
$ ls target/databases/ GratefulDeadConcerts/
For Linux, Mac OS X and UNIX-based operating system, you need to change the permissions on some of the files after compiling from source.
$ chmod 755 bin/*.sh $ chmod -R 777 config
These commands update the execute permissions on files in the
config/ directory and shell scripts in
bin/, ensuring that you can run the scripts or programs that you’ve compiled.
For desktop users installing the binary, OrientDB is now installed and can be run through shell scripts found in the package
bin directory of the installation. For servers, there are some additional steps that you need to take in order to manage the database server for OrientDB as a service. The procedure for this varies, depending on your operating system.
When the time comes to upgrade to a newer version of OrientDB, the methods vary depending on how you chose to install it in the first place. If you installed from binary downloads, repeat the download process above and update any symbolic links or shortcuts to point to the new directory.
For systems where OrientDB was built from source, pull down the latest source code and compile from source.
$ git pull origin master $ mvn clean install
Bear in mind that when you build from source, you can switch branches to build different versions of OrientDB using Git. For example,
$ git checkout 2.2.x $ mvn clean install
2.2.x branch, instead of
Building a single executable jar with OrientDB
OrientDB for internal components like engines, operators, factories uses Java SPI Service Provider Interface. That means that the jars of OrientDB are shipped with files in
META-INF/services that contains the implementation of components. Bear in mind that when building a single executable jar, you have to concatenate the content of files with the same name in different orientdb-*.jar . If you are using Maven Shade Plugin you can use Service Resource Transformer to do that.
To learn more about how to install OrientDB on specific environments, please refer to the guides below: