SEC 440 Week 3 Project 3 - JadenGil/Jaden-Tech-Journal GitHub Wiki
Initial setup:
Before attempting to install a database on any of the new machines it's important to do a few things first.
Make sure that all the network adapters are "LAN" or the machines wont be able to properly get a connection.
Just like the 2 HAProxy VMs we will be using "netplan" in order to give these machines internet.
This is what my config files look like:
The addresses on each are 5.201, 5.202, and 5.203 and after running sudo netplan apply
they're able to connect to the internet.
Downloading MariaDB:
Guide I followed:
https://www.digitalocean.com/community/tutorials/how-to-install-mariadb-on-ubuntu-20-04
To start enter the following on all 3 machines:
sudo apt update
sudo apt install mariadb-server mariadb-client -y
sudo mysql_secure_installation
sudo apt install galera-4
(You should probably do one machine at a time to ensure everything is properly set up)
Once those commands are entered you'll be prompted to answer a handful of questions. You can safely say yes to all of them but I'd read them to make sure you know what you're agreeing to.
Make sure to do this on all 3 machines.
Setting Up Galera:
Guides used:
https://www.linode.com/docs/guides/how-to-set-up-mariadb-galera-clusters-on-ubuntu-2204/
Before doing any of this it is important to make a new database in mariadb by using the commands sudo mariadb
followed by CREATE DATABASE 'DB_NAME';
We will need to set up the galera.cnf
file for all of the machines that will be used. This is what mine looks like on the primary machine:
This is the cnf file on the secondary machine:
It should be noted that the wsrep_node_name
section of the cnf file should always be unique to each machine. NEVER USE THE SAME NAME TWICE
Once the cnf files are configured enter sudo systemctl stop mariadb
on all of the machines and back on the primary machine enter sudo galera_new_cluster
This command will initialize the cluster based on the parameters that we set when we made the cnf files. This command will also start mariadb automatically so no need to start it again. (That only applies the primary machine you'll still need to enter sudo systemctl start mariadb
on the other machines)
After that has been done enter sudo mysql -u root -p -e "SHOW STATUS LIKE 'wsrep_cluster_size'"
and you should get the following result:
Run those commands on all the machines to make sure that they all have access to the database and are connected.
Validate galera using the following commands:
When all is set and done enter the following commands to configure the firewall:
NOTE: This is not the best security practice you should usually set what IP to allow from on each of the active nodes but for the sake of simplicity I chose to allow from all IPs in this case. YOU SHOULD NEVER DO THIS IN A WORK/PUBLIC ENVIRONMENT
Giving U1-3 VIPs
Back on both the HA machines that run HAProxy add the following lines to both cfg files
Make sure they're valid using sudo haproxy -f /etc/haproxy/haproxy.cfg -c
you might get a warning but if it says "file valid" you're fine.
Last things to do before moving forward are adding the ports listed in the "Setting up Galera" section to the firewall on both HA machines. Then restart HAProxy and go to the Xubuntu LAN machine and run the following:
Installing MediaWiki
Guide used:
https://www.digitalocean.com/community/tutorials/how-to-install-mediawiki-on-centos-7
Back on the Web machines it's time to install mediawiki
#Video Submission