April 5, 2023

How to deploy HarperDB on the Atlantic.Net Cloud Platform

Welcome to Community Posts
Click below to read the full article.
Arrow
Summary of What to Expect
Table of Contents

HarperDB is a distributed data platform that is designed for ease of use, scalability, and flexibility. It is a NoSQL database that combines the features of a traditional relational database with those of a document-oriented database. HarperDB is known for its ability to handle complex data types and its compatibility with multiple programming languages. It also includes a built-in API, making integrating with other applications easy. HarperDB is particularly useful for IoT applications, real-time analytics, and edge computing, as it can operate in a distributed manner across multiple devices and locations.

This procedure will provide a detailed guide to creating a HarperDB database on an Ubuntu instance running on the Atlantic.Net Cloud Platform.

Pre-requisites

To create an Atlantic.Net account, you can follow these steps:

  1. Go to the Atlantic.Net website at https://www.atlantic.net/ and click on the "Sign Up" button in the top right corner of the page.
  2. On the sign-up page, fill in your information, including your name, email address, and password. You will also need to select a security question and provide an answer.
  3. Review the terms and conditions and privacy policy, and then click on the "Create Account" button to submit your registration.
  4. Once you have submitted your registration, you will receive an email from Atlantic.Net with a link to activate your account. Click on the link in the email to activate your account.
  5. Once your account is activated, you can log in to the Atlantic.Net Cloud Control Panel to create and manage your cloud servers and other services.

You may need to provide additional information, such as your billing information and verification documents, to complete your registration and start using Atlantic.Net services.

Step 1 - Log in to your Atlantic.Net Account

Click the following link to be directed to the Login page. Fill in your details to log in.

Step 2 - Create an Ubuntu Instance on Atlantic.Net

Now it's time to build it; in this example, we will install Ubuntu 22.04 LTS 64bit 

  • Click on the "Add Server" button to create a new cloud server.

  • On the "Add a Server" page, type a name for your server.

  • Scroll down to find the Ubuntu operating system and click the "Ubuntu" button to see the versions. We installed 22.04 LTS 64-bit; select it and continue.

  • Choose the region that you want to use for your Ubuntu instance. In this example, we will use USA-East-3 (Ashburn, VA).
  • Choose the payment term: on-demand, one year, or three years. Various discounts are available, but we will choose on-demand for added flexibility.

 

  • Choose the instance plan. HarperDB recommends at least 4GB RAM (more for production workloads). In this demo, we will choose the G3.4GB plan

  • You can also select additional options, such as backups and IPV6, and add your own SSH keys if needed.
  • When you have selected everything you need, click the “Create Server” button.

  • Wait about 30 seconds for your server to be created. Once your server is ready, you can log in to it using SSH and start using it. The credentials are provided on screen and emailed to the primary email address on your account.

Step 3 - Enable SSH on your instance

There are numerous ways to enable SSH protocol on your server. To connect to the server, use a GUI SSH client, such as PuTTY on Windows or iTerm2 on macOS. Download and install the client on your local machine, enter the server's IP address and login credentials, and connect to the server.

In this example, I will be using iTerm2 on macOS.

ssh username@server_ip_address

Replace username with your VPS username and server_ip_address with your VPS's public IP address.

Step 4 - Update OS and Prep System for HarperDB

  • Update the Ubuntu package list by running the following command:
apt update -y
  • Create a username for HarperDB to use; it requires a non-root username to run.
useradd -m -s /bin/bash  HarperDB
  • Set a password for the HarperDB username
passwd HarperDB

  • Create a 2GB swapfile on your server.
sudo dd if=/dev/zero of=/swapfile bs=128M count=16
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
echo "/swapfile swap swap defaults 0 0" | sudo tee -a /etc/fstab
  • Increase the Ubuntu security limits config file.
echo "ubuntu soft nofile 500000" | sudo tee -a /etc/security/limits.conf
echo "ubuntu hard nofile 1000000" | sudo tee -a /etc/security/limits.conf
  • Download and install NVM.
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash

You should see this output:

  • Load NVM into the current shell session.
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"
  • Install NodeJS.
nvm install node

Step 5 - Install HarperDB

  • Use this oneliner to install HarperDB.
npm install -g HarperDB
HarperDB install --TC_AGREEMENT "yes" --ROOTPATH "/home/ubuntu/hdb" --OPERATIONSAPI_NETWORK_PORT "9925" --HDB_ADMIN_USERNAME "HDB_ADMIN" --HDB_ADMIN_PASSWORD "abc123!"

Note: Please ensure you create a secure password.

  • Create a crontab entry to make HarperDB start after every reboot.
(crontab -l 2>/dev/null; echo "@reboot PATH=\"/home/ubuntu/.nvm/versions/node/v18.13.0/bin:$PATH\" && HarperDB run") | crontab -

Conclusion

In this tutorial, we explained how to install HarperDB on Ubuntu Linux. We also showed you how to create a simple database using HarperDB. You can now start exploring the possibilities of this super fast database. You can try to install HarperDB on dedicated hosting from Atlantic.Net!

About the Author

Rich Bailey is the lead IT consultant and frequent blogger for Atlantic.Net, with 20 years of experience in Linux, Cloud, automation, and infrastructure, as well as code. He is a graduate of the University of Bradford, England.