Linux serverNETWORK ADMINISTRATIONS

Montaje cluster mariaDB, 3 nodos en centos 7 con virtualbox

En este video vamos a utilizar 3 servidores virtuales, con virtual box

nodo1: nodo1mariaDB
IP: 192.168.0.81

nodo2: nodo2mariaDB
IP: 192.168.0.82

nodo3: nodo3mariaDB
IP: 192.168.0.83

* Cambio de nombre de los hostname

hostnamectl set-shostname nodo1mariaDB

hostnamectl set-hostname nodo2mariaDB

hostnamectl set-hostname nodo3mariaDB

* Configurar el DNS local
vim /etc/hosts

192.168.0.81 nodo1mariaDB
192.168.0.82 nodo2mariaDB
192.168.0.83 nodo3mariaDB

***********************
**desactivar firewall**
***********************

sudo systemctl disable firewalld

sudo systemctl enable firewalld

sudo systemctl stop firewalld

sudo systemctl mask –now firewalld

*****************************************************************
**************** Instalacion cluster mariaDB ********************
*****************************************************************

yum -y update

yum -y install dnf

dnf install -y net-tools mlocate

dnf -y install mc nano nmap unzip

dnf -y install epel-release

dnf -y install nmon htop

dnf -y install rsync

dnf -y install policycoreutils-python

dnf -y install dnf-plugins-core

dnf -y copr enable konimex/neofetch

dnf -y install neofetch

# neofetch

curl -LsS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | sudo bash

yum -y update

yum -y install MariaDB-server MariaDB-client galera-4

systemctl start mariadb

# mysql_secure_installation

Switch to unix_socket authentication [Y/n] y

Change the root password? [Y/n] y

Remove anonymous users? [Y/n] n

Disallow root login remotely? [Y/n] y

Remove test database and access to it? [Y/n] n

Reload privilege tables now? [Y/n] y

firewall-cmd –permanent –zone=public –add-port=3306/tcp

firewall-cmd –permanent –zone=public –add-port=4567/tcp

firewall-cmd –permanent –zone=public –add-port=4568/tcp

firewall-cmd –permanent –zone=public –add-port=4444/tcp

firewall-cmd –permanent –zone=public –add-port=4567/udp

firewall-cmd –permanent –zone=public –add-source=10.10.10.10/32

firewall-cmd –permanent –zone=public –add-source=10.10.10.20/32

firewall-cmd –permanent –zone=public –add-source=10.10.10.30/32

firewall-cmd –reload

semanage port -a -t mysqld_port_t -p tcp 4567

semanage port -a -t mysqld_port_t -p udp 4567

semanage port -a -t mysqld_port_t -p tcp 4568

semanage port -a -t mysqld_port_t -p tcp 4444

semanage permissive -a mysqld_t

nano /etc/my.cnf.d/server.cnf

/////Primer nodo
# Mandatory settings
wsrep_on=ON
wsrep_provider=/usr/lib64/galera-4/libgalera_smm.so
wsrep_cluster_name=”galeracluster”
wsrep_cluster_address=”gcomm://192.168.0.81,192.168.0.82,192.168.0.83″
binlog_format=row
default_storage_engine=InnoDB
innodb_autoinc_lock_mode=2
wsrep_node_address=”192.168.0.81″
wsrep_node_name=”node1mariaDB”
wsrep_sst_method=rsync
#
# Allow server to accept connections on all interfaces.
#
bind-address=0.0.0.0
#
# Optional setting
#wsrep_slave_threads=1
innodb_flush_log_at_trx_commit=0

/////Segundo nodo

# Mandatory settings
wsrep_on=ON
wsrep_provider=/usr/lib64/galera-4/libgalera_smm.so
wsrep_cluster_name=”galeracluster”
wsrep_cluster_address=”gcomm://192.168.0.81,192.168.0.82,192.168.0.83″
binlog_format=row
default_storage_engine=InnoDB
innodb_autoinc_lock_mode=2
wsrep_node_address=”192.168.0.82″
wsrep_node_name=”node2mariaDB”
wsrep_sst_method=rsync
#
# Allow server to accept connections on all interfaces.
#
bind-address=0.0.0.0
#
# Optional setting
#wsrep_slave_threads=1
innodb_flush_log_at_trx_commit=0

/////Tercer nodo

# Mandatory settings
wsrep_on=ON
wsrep_provider=/usr/lib64/galera-4/libgalera_smm.so
wsrep_cluster_name=”galeracluster”
wsrep_cluster_address=”gcomm://192.168.0.81,192.168.0.82,192.168.0.83″
binlog_format=row
default_storage_engine=InnoDB
innodb_autoinc_lock_mode=2
wsrep_node_address=”192.168.0.83″
wsrep_node_name=”node3mariaDB”
wsrep_sst_method=rsync
#
# Allow server to accept connections on all interfaces.
#
bind-address=0.0.0.0
#
# Optional setting
#wsrep_slave_threads=1
innodb_flush_log_at_trx_commit=0

# systemctl stop mariadb
clear

nodo1:
galera_new_cluster

# mysql -u root -p123456

SHOW STATUS LIKE ‘wsrep_cluster_size’;

quit;

en el nodo 2

systemctl start mariadb
# mysql -u root -p123456

show databases;

SHOW STATUS LIKE ‘wsrep_cluster_size’;

en el nodo 3

systemctl start mariadb

# mysql -u root -p123456

mysql -u root –p123456 -e ‘INSERT INTO selinux.selinux_policy VALUES ();

SHOW STATUS LIKE ‘wsrep_cluster_size’;

source

centos 7

Leave a Reply

Your email address will not be published. Required fields are marked *