Skip to content
This repository has been archived by the owner on May 11, 2022. It is now read-only.

Master-Replicant Setup #1

Open
ag2244 opened this issue Apr 26, 2022 · 0 comments
Open

Master-Replicant Setup #1

ag2244 opened this issue Apr 26, 2022 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@ag2244
Copy link
Contributor

ag2244 commented Apr 26, 2022

Allow MariaDB port
sudo ufw allow 3306

Edit Config File
sudo nano /etc/mysql/mariadb.conf.d/50-server.cnf

#bind-address (Comment out)
server-id        = X
report_host    = masterX
log_bin          = /var/log/mysql/mysql-bin.log
relay_log       = /var/lib/mysql/relay-bin
relay_log_index = /var/lib/mysql/relay-bin.index
log-slave-updates
auto_increment_increment=2
auto_increment_offset=X

Where X is the master number

Create User on Database 1

CREATE USER 'repl'@'%' IDENTIFIED BY 'repl_passwd';
GRANT REPLICATION SLAVE ON *.* TO 'repl'@'%';

Create User on Database 2

CREATE USER 'repl2'@'%' IDENTIFIED BY 'repl_passwd2';
GRANT REPLICATION SLAVE ON *.* TO 'repl2'@'%';

Create Slave on Database 1

CHANGE MASTER TO MASTER_HOST='10.0.2.4', MASTER_USER='repl_master2', MASTER_PASSWORD='repl_passwd2';
START SLAVE;

Create Slave on Database 2

CHANGE MASTER TO MASTER_HOST='10.0.2.15', MASTER_USER='repl', MASTER_PASSWORD='repl_passwd';
START SLAVE;
@ag2244 ag2244 added the enhancement New feature or request label Apr 26, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants