SEC440 WEEK 3 - snowgiant1312/SEC440-Week3 GitHub Wiki

u1,u2,u3 base configurations

IPV4 - 10.0.5.115, 10.0.5.116, 10.0.5.117

Gateway - virtual address 10.0.5.1

keepalived vrrp address - 10.0.5.10

Database servers mariadb install config:

sudo apt install mariadb-server

sudo mysql_secure_installation (-y to all)

mysqld replication settings

[mysqld]

bind-address = 10.0.5.X

server_id = (depends on server, 1 for u1)

log_bin = /var/log/mysql/mysql-bin.log

log_bin_index = /var/log/mysql-bin.log.index

relay_log = /var/log/mysql/mysql-relay-bin

relay_log_index = /var/log/mysql/mysql-relay-bin.index

expire_logs_days = 10

max_binlog_size = 100M

log_slave_updates = 1

auto-increment-increment = (different on each server to not cause conflicts)

auto-increment-offset = (different on each server to not cause conflicts)

edit bind-address to database server's address in /etc/mysql/mariadb.conf.d/50-server.cnf file

my.cnf

web02,03 configurations

settings.py django config

ALLOWED_HOST = ['server IPS connecting']

DATABASES = {

'default': {

'ENGINE': 'django.db.backends.mysql',

'NAME': 'djangodb',

'USER': 'djuser',

'PASSWORD': 'donch!420',

'HOST': '10.0.5.10',

'PORT': '3306',

'OPTIONS': {

     'init_command': "SET sql_mode='STRICT_TRANS_TABLES'"
}

}

}

django initialization

python manage.py migrate (database setup)

python manage.py createsuperuser