How to Install Orientdb Onto Linux
Total Page:16
File Type:pdf, Size:1020Kb
Introducing OrientDB December 2016 -- email any questions to [email protected] OrientDB and Java OrientDB offers many advantages to Java software developers including the ability to run their applications inside the same Java Virtual Machine (JVM) as OrientDB. As no ORM (object-relational mapping) layer exists between your POJO classes and OrientDB’s object schema, there is no impedance mismatch to drag down productivity. In brief we will install OrientDB and then get familiar with its object.load(), object.save(), and object.update() features of its object database through its Java Object API. Running OrientDB in a production environment however requires more knowledge. The A to Z of OrientDB These are the key knowledge buckets that lead to an expert grasp of OrientDB from both a Java Developer and System Administrator’s point of view is to 1. Install OrientDB onto a local or cloud Linux server 2. Configure OrientDB to run as a service (startup after reboot) 3. Learn to talk to OrientDB through its command console 4. Learn to talk to OrientDB through its web interface 5. Learn to connect to OrientDB via its Java Object API 6. Learn to copy, backup, replicate and recover OrientDB 7. Run OrientDB behind an Apache web server proxy There is more to OrientDB than initially meets the eye. It has an “in memory” feature so that your unit tests can work with OrientDB using memory based instead of disk based storage. You can also talk to its RESTful Web Services interface to simply create, read, update and delete both documents and objects with simple HTTP GET, PUT and POST commands. 1 | https://www.build-business-websites.co.uk/how-to-install-orientdb-on-linux/ Where to put OrientDB Running OrientDB in the Amazon AWS or Google clouds is a popular choice. If you do this you can skip the section that walks through the OrientDB install on Linux. Running OrientDB Inside Docker Docker is a popular virtual container for running OrientDB. If deploying your database to multiple environments with different configurations – Docker will result in significant efficiency / complexity savings. If performance is key then the Docker layer is a container that wraps a container. All JAVA software runs within a container that is abstracted away from the operating environment. The JVM container starts, stops and manages Java applications in much the same way as Docker (which abstracts middleware away from the operating environment). The JVM lacks an enterprise grade deployment tool which is where Docker excels. However if you don’t need that and you want to milk every gram of performance out of your OrientDB installation – it pays to register (install) OrientDB with your server’s JVM. Use Cases Unsuitable in Clouds Even though OrientDB can be wrapped by cloud managed and/or Docker containers, some use cases are ineffective within a cloud OrientDB installation. The cloud’s cost model can be the problem. Suppose your use case requires high bandwidth, massive storage and/or super-fast multi- core CPU processors – whilst not needing internet visibility. A local server still makes a lot of sense. No one counts the CPU cycles and charges you. No one monitors the bandwidth in your intranet (and charges you). Once your multi-terrabyte solid state drive is installed – no one charges you. In these instances it makes sense to install the middleware instance yourself. You must install OrientDB to process big data, deploy multiple developer sandboxes and run CPU intensive algorithms – perhaps in search of the next prime number. 2 | https://www.build-business-websites.co.uk/how-to-install-orientdb-on-linux/ OrientDB in your App’s Stack OrientDB is perfect for use inside developer sandboxes and within the Jenkins Continuous Integration Server. OrientDB is happy running within the confines of an IDE that is executing unit tests. And you can call it directly making the likes of HSQL redundant? You can run your app inside OrientDB or you can run OrientDB inside your app! As was mentioned earlier there are an unprecedented number of ways to communicate with OrientDB preferably with (but also without) Java. You can communicate with OrientDB 1. with RESTful web services (try Curl) 2. with direct API calls within the same JVM 3. by dropping in JARs that access its API 4. using the standard JDBC or other drivers 5. through a web console on port 2480 6. using the provided command line console How you can talk to OrientDB is one thing, where (what climates) OrientDB can happily survive in, is quite another. Where can OrientDB Live and Breathe You couldn’t run MySQL or Oracle inside your IDE – but you can with OrientDB. The good news is that OrientDB also performs on the big stage and its 100% Java tag allows it to run within Android smartphones and tablets, IDE’s, but also on top-end compute and storage optimized hardware. 3 | https://www.build-business-websites.co.uk/how-to-install-orientdb-on-linux/ The 7 OrientDB Data Model Choices Once you’ve chosen OrientDB, you are spoilt for choice in terms of your database model. OrientDB gives you 1. either NOSQL (or SQL-like) database queries 2. an object database (for Java, Scala and C#) 3. a graph database with vertices and nodes 4. an EAV (entity, attributes and values) database 5. a document database for JSON, CSV, XML and HTML 6. either a schemaless or a schemafull database 7. an in-memory database with few RAM(ifications) OrientDB is good, but it is not all things to all men. It isn’t suitable in certain situations. Don’t Use OrientDB when … OrientDB is not well-suited when 1. you already have a mature application with a stable schema 2. the application software is not predominantly Java (or Scala or Groovy) 3. things are strictly SQL – no web services, no API calls Please drop us a comment letting us know if the install went well. Also make a request for a post on any aspect of OrientDB or indeed any other technology. 4 | https://www.build-business-websites.co.uk/how-to-install-orientdb-on-linux/ How to Install OrientDB on Linux Email any questions to [email protected] OrientDB and Java OrientDB offers many advantages to Java software developers including the ability to run their applications inside the same Java Virtual Machine (JVM) as OrientDB. As no ORM (object-relational mapping) layer exists between your POJO classes and OrientDB’s object schema, there is no impedance mismatch to drag down productivity. Let’s install OrientDB and then visit its object.load(), object.save(), and object.update() features. There are 5 steps to perform in order to install OrientDB. How to Install OrientDB on Linux Use the below steps. 1. Install Oracle’s Java 1.8 with apt-get install 2. Create an orientdb operating system user 3. Download and Unpack the archive into orientdb home 4. Start the Orient database server with ./bin/server.sh 5. Launch the OrientDB console with ./bin/console.sh 1. Install the Oracle Java 8 Runtime To install Oracle JRE 8 run this command and then update your local repository before running the apt-get install command. sudo add-apt-repository ppa:webupd8team/java sudo apt-get update sudo apt-get install oracle-java8-set-default 5 | https://www.build-business-websites.co.uk/how-to-install-orientdb-on-linux/ Once you have given the go-ahead again. You will see a line that includes the following text. (3.53 MB/s) - ‘jdk-8u77-linux-x64.tar.gz’ saved It is important to check that Java version 1.8 is running. Just type in and run this simple command in Microsoft's Windows, Linux, Apple's iOS or Google's Android. java -version The output saying that Java 1.8 has been installed on Ubuntu will be similar to this. java version "1.8.0_77" Java(TM) SE Runtime Environment (build 1.8.0_77-b03) Java HotSpot(TM) 64-Bit Server VM (build 25.77-b03, mixed mode) 2. Create an orientdb operating system user Best practice is to create an orientdb operating system user so that the database does not run as root. sudo adduser orientdb Don’t worry, orientdb has been built to run this way so creating an orientdb user helps you run into fewer problems down the line. Verify by checking /home. Does an orientdb directory exist? 3. Download and Unpack the OrientDB Archive Download OrientDB via your browser or use wget to avoid moving files here there and everywhere. We unpack orientdb into a temporary location and then copy the contents into the newly created /home/orientdb home. 1. wget https://orientdb.com/download.php?file=orientdb-community- 2.2.9.tar.gz 2. sudo tar -xf download.php?file=orientdb-community-2.2.9.tar.gz - C /tmp 3. su - orientdb 4. cd $HOME 5. cp -R /tmp/orientdb-community-2.2.9/* . (mind the dot) 6 | https://www.build-business-websites.co.uk/how-to-install-orientdb-on-linux/ All the file ownership and permissions are correct as we copied the files as the orientdb user. If you didn’t use the above commands, remember to chown the orientdb directory tree. 4. Start the Orientdb Database Server Navigate to the home of OrientDB and fire it up. sudo bin/server.sh OrientDB should now prompt for the database administrator’s password with a message like the one below. +---------------------------------------------------------------+ | WARNING: FIRST RUN CONFIGURATION | +---------------------------------------------------------------+ | This is the first time the server is running. Please type a | | password of your choice for the 'root' user or leave it blank | | to auto-generate it.