High availability

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

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

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

apt update
apt -y dist-upgrade
apt -y install chrony openjdk-11-jdk ceph-fuse p7zip-full sysstat catdoc antiword html2text unrtf libid3-tools ffmpeg
apt -y purge snapd
apt -y autoremove

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

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


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
ceph-deploy osd create dn1:xvdb dn2:xvdb dn3:xvdb
ceph-deploy mds create dn1 dn2 dn3
for N in dn1 dn2 dn3 ; do
        ceph-deploy mon add $N
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 $IP1 $IP2 $IP3 ; do
	ssh $N "ceph-fuse -m $N:6789 /opt/Noodle/FSDB"

3) Install CockroachDB on all nodes;

cd /opt
wget -qO- https://binaries.cockroachdb.com/cockroach-v19.2.2.linux-amd64.tgz | tar  xvz
./cockroach-v19.2.2.linux-amd64/cockroach start --insecure --advertise-addr=${IP} --join=${IP1},${IP2},${IP3} --background

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" >> cfg/intranet.conf
perl -pi -e 's/^(DatabaseManager.DB.intranet.Connection.Url = ).*/$1"jdbc:postgresql:\/\/'"$IP"':26257\/noodledb"/g' cfg/intranet.conf
mv noodle.daemon /etc/init.d/noodle
update-rc.d noodle defaults
systemctl start noodle.service