Table of Contents

Overview

The whole setup of Oracle NoSQL, in my opinion, is bananas. Each time I tried to set it up, something always failed. Luckily, or because of it, some people (oracle) create a script to facilitate the configuration. The script can be downloaded by cloning this repo:

In this repo, there is a folder called: cluster_setup into which, there is a script called: cluster_setup.sh, they should really come up with a better names :)

Either way, so in our case, we will just configure 2 VMs (using vagrant) and run that setup.

Virtual Machines

I have done it many times, but the setup of the VMs using vagrant is pretty easy. I have created the following Vagrantfile, based on another Vagrantfile for other shenanigans:

Vagrantfile

$allow_shell = <<SCRIPT
sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/g' /etc/ssh/sshd_config    
systemctl restart sshd.service
SCRIPT

$edit_hosts_file = <<SCRIPT
cat > /etc/hosts <<EOF
127.0.0.1 localhost
192.168.0.101 sn1.example.com sn1
192.168.0.102 sn2.example.com sn2
192.168.0.103 sn3.example.com sn3
EOF
SCRIPT

$install_vnc_server = <<SCRIPT
yum -y install net-tools
yum -y install unzip
yum -y install curl
yum -y install lvm2
yum -y remove java
yum -y install java-1.8.0-openjdk-1.8.0.352.b08-2.el7_9.x86_64
SCRIPT

$config_storage = <<SCRIPT
vgcreate vg_nosql /dev/sdb
lvcreate -L 1G -n lv_disk1 vg_nosql
lvcreate -L 1G -n lv_disk2 vg_nosql
lvcreate -L 1G -n lv_disk3 vg_nosql
mkfs.ext4 /dev/vg_nosql/lv_disk1
mkfs.ext4 /dev/vg_nosql/lv_disk2
mkfs.ext4 /dev/vg_nosql/lv_disk3
cat >> /etc/fstab <<EOF
/dev/vg_nosql/lv_disk1     /disks/disk1    ext4    defaults 0 0
/dev/vg_nosql/lv_disk2     /disks/disk2    ext4    defaults 0 0
/dev/vg_nosql/lv_disk3     /disks/disk3    ext4    defaults 0 0
EOF
mkdir -p /disks/disk1
mkdir -p /disks/disk2
mkdir -p /disks/disk3
mount /disks/disk1
mount /disks/disk2
mount /disks/disk3
mkdir -p /app/oracle/ondb
cp /vagrant/V1030945-01.zip /app/oracle/ondb/
unzip /app/oracle/ondb/V1030945-01.zip
rpm -Uvh /vagrant/jdk-19_linux-x64_bin.rpm
SCRIPT

Vagrant.configure("2") do |config|
 (1..2).each do |i|
  config.vm.provision :shell, inline: "setenforce 0", run: "always"
  config.vm.define "sn#{i}" do |sn|
    sn.vm.box = "centos/7"
    sn.vm.hostname = "sn#{i}"
    sn.vm.synced_folder "./lpar_binaries", "/vagrant", type: "virtualbox"
	sn.vm.network "public_network", ip: "192.168.0.10#{i}"
	sn.vm.provision "shell", inline: $install_vnc_server, privileged: true
	sn.vm.provision "shell", inline: $allow_shell, privileged: true
	sn.vm.provision "shell", inline: $edit_hosts_file, privileged: true
	second_disk = "C:\\Users\\julie\\VirtualBox VMs\\sn#{i}\\disk_nosql_data.vdi"
    sn.vm.provider :virtualbox do |v|
	# Get disk path
	  v.customize ["modifyvm", :id, "--memory", 2560]
      v.customize ["modifyvm", :id, "--name", "sn#{i}"]
	  v.customize ["storageattach", :id, 
                "--storagectl", "IDE", 
                "--port", "0", "--device", "1", 
                "--type", "dvddrive", 
                "--medium", "emptydrive"]
	  v.customize ['createhd', '--filename', second_disk, '--size', 500 * 1024]
	  v.customize ['storageattach', :id, 
				'--storagectl',
				'IDE',
				'--port', 1, '--device', 0,
				'--type', 'hdd',
				'--medium', second_disk]
     end
	 sn.vm.provision "shell", inline: $config_storage, privileged: true
    end
  end
end

As, maybe, you will guess, that will create us 2 Virtual machines, with an additional disk which we will create a volume group, which we will split into 3 and which we will mount each LV to a separate File system…geeesh that is a lot. Anywho, after this, we should have 2 VMs, running and all installed…but the Oracle NoSQL of course

Oracle NoSQL

The script pretty much guides you through the entire process, but let's set the steps:

  1. Intro screen (Enter)
  2. Location of the Oracle NoSQL ZIP file (Enter)
  3. Host/IPs of the nodes in the cluster and username to connect (Enter)
  4. Installation path (Enter)
  5. Store name: DefaultStore (I leave my default) (Enter)
  6. A lot of connections and password entering (Unless you configure passwordless authentication…too lazy to do so)
  7. Data directory: Enter disks (Enter)
  8. Log directories (Up to you if you wanna keep logs) (Enter)
  9. Port: 5000 (Enter)
  10. Replication Factor: 1, it is a test after all (Enter)

There might be some issues with the JAVA, don't ask me….Oracle