# Project 3 - Web Application and Database Redundancy

Setup u1, u2, u3

‘’’

sudo hostnamectl set-hostname db0X-paul

sudo passwd champuser

sudo adduser paul

sudo usermod -aG sudo paul

‘’’

Setup networking

‘’’

sudo nano /etc/netplan/00-installer-config.yaml

‘’’

![](https://lh4.googleusercontent.com/2NN8IC2oQXzgx5-oAEInvQIFO3CsHyT1Go2ppt3d1Qs8JSyaO0hnTY_3kC6M3DEDm1a13fx2KcLY_L7BmEjqARJjm_0OS9tatQDmXRaCtoU0qdsAPDV7CTdFp8-a7cDQP_SomN3Eov0hBHu9RL8Wy5E)

\
\


Setup MariaDB with Galera Cluster

\


‘’’

Sudo apt install mariadb-server

‘’’

\


Edit the Galera Config

‘’’

Sudo nano /etc/mysql/mariadb.conf.d/60-galera.cnf

‘’’

![](https://lh5.googleusercontent.com/xv59-Q0SnrdEPjN-1tHUpjLW1t8llyrXpDDQUi6Pk4bAUxKJ3cPkSrOkSDLcqHtEUeSDz1qfMjcwydhkxVCn1YqhxP0ws17yXk9BewOjh-CXD_Bf4B27_kLMIlXK1QabSBuhAN6504AoyhbXTfV4Hko)

Resources:

[https://www.server-world.info/en/note?os=Ubuntu\_22.04\&p=mariadb\&f=1](https://www.server-world.info/en/note?os=Ubuntu_22.04\&p=mariadb\&f=1)&#x20;

[https://www.linuxbabe.com/mariadb/galera-cluster-ubuntu](https://www.linuxbabe.com/mariadb/galera-cluster-ubuntu)&#x20;

\
\


Update ha proxy to support db:

‘’’

Sudo nano /etc/haproxy/haproxy.cfg

‘’’

![](https://lh6.googleusercontent.com/JXzfG6DUBTz4wYIBFbTXfuoXFiaJFoFCDmAtLMVeCEKCpmK_V2KBtYVM-3vLA5q2cBW8-DZTnLLeItpuN76gOSXaXBGhUULyIPpYH4KyyqJU8hsp96Tuw09cMDYri6oGMBYgmS2b8mu5LNNqlKSTDH8)

\


Now restart haproxy

\


Now check if lan can connect the database

![](https://lh3.googleusercontent.com/USlMM1jNaT1QgUyLOk17-XYfk561ZENnKlCHA0VC05X65zA1iMrp5O9b8vyTqaIYPtRiTuK2JwxqCR2GIx56BEFW_Lfe6raZ7X50ISj8JfAuOFQzsK9_prCp95YOJIQXjrR4zTSvW_31s4HyzOw4JPs)

\


GRANT ALL PRIVILEGES ON \*.\* TO 'root'@'%'&#x20;

&#x20; IDENTIFIED BY 'my-new-password' WITH GRANT OPTION;

\
\


Make Database:

\


CREATE DATABASE futurama;

USE futurama;

![](https://lh4.googleusercontent.com/qJ0ZtberwOpHM--HQsw_AMplv06bd1NjyTLRTw9q18sMuOVOMhsc8PuLu34C5OgJHUxeZt1h3mOVbtME-XQ_FAj22Cfo8rMUitgpTdBCD_y2GmmcZD1HGysZ_3ZyQ_OpB0toiS_N55UcxRRFaAD6YsQ)

\
\


WEB:

\


Yum install php php-mysql mysql

sudo setsebool -P httpd\_can\_network\_connect\_db on

\
