Setup Cockroach Cluster on Paas

Setup Cockroach Cluster on Paas

Introduction

CockroachDB is a distributed database with standard SQL for cloud applications, This tutorial shows you how to deploy a secure multi-node CockroachDB cluster on Paas.

Prerequisites

  • 2 or More Virtual Machine With this spesification :
  1. 4 vCPU
  2. 4 GB RAM
  3. Ubuntu 20.04 or Ubuntu 18.04
  4. Atleast 150 GB of Storage
  • Each node's use private IP Address to connect each other make sure your VM be on the same subnet.

Step 1 Login to your Paas.id Account

Login to your

Paas.id

account via

https://dash.paas.id/auth/login

https://blog.paas.id/content/images/2022/07/paas10-2.PNG
Login to paas dashboard

Step 2 Add VM machines to serve as Cockroach cluster node

After logging in you can start to add your Virtual Machine to create cokcroach cluster, First navigate to Services then click on New Cluster Database.

https://blog.paas.id/content/images/2022/07/paas.PNG
Services in paas dashboard

To deploy the cockroach cluster pick CockroachDB as Platform and you can fill database name and description as you want. Then click Next

https://blog.paas.id/content/images/2022/07/paas-1.PNG
Creating new cockroach cluster

After that you can add your VM by clicking on Add Node Database, fill all the information needed.

https://blog.paas.id/content/images/2022/07/paas2-2.PNG
Creating Node on cockroach cluster

In this tutorial i use 2 virtual machine so i add one more, by default the first node you add is Master Node but you can change it by clicking on the three dots next to the node name. After that you can click next.

https://blog.paas.id/content/images/2022/07/paas3.PNG
Changing master node

Click create.

https://blog.paas.id/content/images/2022/07/paas4-2.PNG
Cluster overview

Then click deploy

https://blog.paas.id/content/images/2022/07/paas4-1.PNG
Deploying new Cockroach Cluster

Wait until status of the cluster is installed.

https://blog.paas.id/content/images/2022/07/paas5.PNG
Cluster status On Install

Step 3 Accessing the cockroach Cluster

After the installation status change to installed, you can access the Cockroach Cluster. First open the Cluster services on the paas dashboard.

https://blog.paas.id/content/images/2022/07/paas6.PNG
Each node information on Cockraoch cluster

Then click on the Database Credential, you can see the credential of the cluster such as port, user and password.

https://blog.paas.id/content/images/2022/07/paas7.PNG
Credential for Cockroach Node

You can access the clusters with one of the public IP address of your Virtual Machine, using Database Management Application such as Beekeper Studio or DBeaver.

https://blog.paas.id/content/images/2022/07/paas8.PNG
Accessing Cockroach node with DBMS

Extra: Cockroach Console

You can also monitor the cockroach cluster through the the web, all you need is accessing one of your node IP address then add port 8080.
Example : https://116.192.168.144:8080. You can access the console using the user and password from the Database Credential.

paas9