Oracle Developers
Published in

Oracle Developers

Deploy Aerospike CE Database on Oracle Cloud Infrastructure VM

Aerospike is a distributed real-time NoSQL Database which can be used for web scale applications. Aerospike is a key-value store with a schema-less model. The data model contains a namespace (equivalent to a RDBMS database), within namespace are sets (tables in RDBMS) and sets contains records (rows in RDBMS). Every record has an index key which is unique to that particular set, with one or more bins (RDBMS columns) that hold the data associated with that particular record. More information about Aerospike Architecture can be found here.

In this article we will explore how we can build and deploy Aerospike on Oracle Cloud using Oracle Linux 7 VM. After the deployment we will connect to the database and query it.

Credit : Unsplash

Prerequisites

Make sure the prerequisites documented here are followed before proceeding to the installation steps.

Installation Steps

$ ssh -i <private-key> opc@<OCI-VM-IP>#/artifacts/aerospike-server-community/<aerospike_version>/aerospike-server-community-<aerospike_version>-<oraclelinux_version>.tgz$ wget -O aerospike.tgz https://download.aerospike.com/artifacts/aerospike-server-community/5.7.0.17/aerospike-server-community-5.7.0.17-el7.tgz$ tar -xvf aerospike.tgz$ cd aerospike-server-<community_or_enterprise-<aerospike_version>-<oraclelinux_version>sudo ./asinstall

Aerospike installs with the default server configuration. There is a default in-memory test namespace created. To change the default server configuration refer here.

The configuration file of Aerospike is located at: /etc/aerospike/aerospike.conf

Start Aerospike

$ sudo systemctl start aerospike$ sudo systemctl status aerospike

Install Aerospike Tools

Make sure the tools prerequisites documented here are followed before proceeding to the next steps.

$ wget -O aerospike-tools.tgz https://www.aerospike.com/download/tools/latest/artifact/el7
# For OL 8, replace “el7” with “el8”.
$ tar -xvf aerospike-tools.tgz$ cd aerospike-tools-<version>.el7
# Replace <version> with the version number.
# For OL 8, replace “el7” with “el8”.
$ sudo ./asinstall
$ asadm --version
$ aql --version
$ asinfo --version
$ asbackup --version
$ asrestore --version

Connect and Query Data from Aerospike

Connect to Aerospike database (default port of Aerospike is TCP/3000)

aql -h localhostaql> show namespaces
+ — — — — — — +
| namespaces |
+ — — — — — — +
| “test” |
| “bar” |
+ — — — — — — +
[127.0.0.1:3000] 2 rows in set (0.002 secs)

Perform basic operations on the sample namespaces.


INSERT INTO test.demo (PK, foo, bar) VALUES (‘key1’, 123, ‘abc’)
INSERT INTO test.demo (PK, foo, bar) VALUES (‘key1’, CAST(‘123’ AS INT), JSON(‘{“a”: 1.2, “b”: [1, 2, 3]}’))
INSERT INTO test.demo (PK, foo, bar) VALUES (‘key1’, LIST(‘[1, 2, 3]’), MAP(‘{“a”: 1, “b”: 2}’))
INSERT INTO test.demo (PK, gj) VALUES (‘key1’, GEOJSON(‘{“type”: “Point”, “coordinates”: [123.4, -56.7]}’))

SELECT * FROM test.demo
DELETE FROM test.demo WHERE PK = ‘key1’

Conclusion

We can see how easy it is to install Aerospike on Oracle Linux 7 and connect and query the database. In a future blog we will explore adding SSD’s to Aerospike and creating a multi-node cluster.

Ready to learn more? Please visit oracle.com/au/cloud/free/ for more information.

You can also visit our public Slack to discuss!

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Shadab Mohammad

Shadab Mohammad

149 Followers

Principal Cloud Solutions Architect@Oracle ***Views, thoughts and opinions expressed in here belongs solely to the author and not the author's employer***