Getting started with orientdb
Remarks#
This section provides an overview of what orientdb is, and why a developer might want to use it.
It should also mention any large subjects within orientdb, and link out to the related topics. Since the Documentation for orientdb is new, you may need to create initial versions of those related topics.
Installation or Setup
OrientDB is available in two editions:
-
Community Edition is released as an open source project under the Apache 2 license. This license allows unrestricted free usage for both open source and commercial projects.
-
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.
Prerequisites
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
- Solaris
- HP-UX
- IBM AIX
OrientDB requires Java, version 1.7 or higher.
Note: In OSGi containers, OrientDB uses a
ConcurrentLinkedHashMap
implementation 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 propertyorg.osgi.framework.system.packages.extra
with valuesun.misc
to 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
Use Docker
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.
Binary Installation
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
utility:
$ 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 hotfix
branch.
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
$
The directory 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/
Update Permissions
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.
Post-installation Tasks
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.
Upgrading
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
builds the 2.2.x
branch, instead of master
.
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.
Other Resources
To learn more about how to install OrientDB on specific environments, please refer to the guides below: