High availability

Example scripts for a High availability install of Noodle 7.08.05+.

1) Install 3+ Linux instances with password-less key authentication, run the following on each (using real IPs and domains);

hostname must match domain name.

IP1=192.168.0.141 #dn1
IP2=192.168.0.142 #dn2
IP3=192.168.0.143 #dn3
IP="$(ip addr show | grep "inet " | grep -v 127.0.0.1 | head -n 1 | perl -pe 's/\/.*//g;s/.* //g')"

apt update
apt -y dist-upgrade
apt -y install ceph-fuse openjdk-11-jre
apt -y purge snapd landscape-common
apt -y autoremove

#if public domains are not in use;
echo "
$IP1 dn1 dn
$IP2 dn2 dn
$IP3 dn3 dn
" >> /etc/hosts

2) Install Ceph from the admin node (all nodes will wipe /dev/xvdb);

(Ubuntu 20.04 requires this patch first.)

POOL=noodle
apt-get -y install ceph-deploy

ceph-deploy new dn1 dn2 dn3
ceph-deploy install dn1 dn2 dn3
ceph-deploy mon create-initial
ceph-deploy admin dn1 dn2 dn3
ceph-deploy mgr create dn1 dn2 dn3
for N in dn1 dn2 dn3 ; do
        ceph-deploy osd create $N --data /dev/xvdb
done
ceph-deploy mds create dn1 dn2 dn3
for N in dn1 dn2 dn3 ; do
        ceph-deploy mon add $N
done
ceph osd pool create ${POOL}_data 16
ceph osd pool create ${POOL}_meta 16
ceph fs new ${POOL}_fs ${POOL}_meta ${POOL}_data
for N in dn1 dn2 dn3 ; do
	ssh $N "echo 'none /opt/Noodle/FSDB fuse.ceph ceph.name=client.admin,_netdev,defaults 0 0' >> /etc/fstab && mount -a"
done

3) Install CockroachDB on all nodes;

cd /opt
wget -qO- https://binaries.cockroachdb.com/cockroach-v19.2.2.linux-amd64.tgz | tar  xvz
cp /opt/Noodle/cockroachdb.service /lib/systemd/system/
perl -pi -e "s/\$IPS/${IP1},${IP2},${IP3}/g;s/\$IP/${IP1}/g" /lib/systemd/system/cockroachdb.service
systemctl enable cockroachdb
systemctl start cockroachdb

4) initialize CockroachDB from the admin node;

./cockroach-v19.2.2.linux-amd64/cockroach init --insecure --host=${IP}
echo "CREATE USER noodleuser; CREATE DATABASE noodledb WITH ENCODING = 'UNICODE'; GRANT ALL ON DATABASE noodledb to noodleuser;" | ./cockroach-v19.2.2.linux-amd64/cockroach sql --insecure --host=${IP}:26257

5) Install Noodle on all nodes;

cd /opt
tar -xf Noodle.tar.gz
cd ./Noodle
echo "NoodleNodes[] = ${IP1}, ${IP2}, ${IP3}
FSDB = /opt/Noodle/FSDB" >> conf/noodle.properties
perl -pi -e 's/^(DatabaseManager.DB.intranet.Connection.Url = ).*/$1"jdbc:postgresql:\/\/'"$IP"':26257\/noodledb"/g' conf/noodle.properties
cp noodle.service /lib/systemd/system/
perl -pi -e 's/postgreql.service/ceph.target cockroachdb.service/g' /lib/systemd/system/noodle.service
systemctl enable noodle
systemctl start noodle