In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-10 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
Five virtual machines dual network cards first intranet, second external network 80.100 master database 180.101 master database 280.102 slave database 180.103 slave database 280.104 monitor monitor build Aliyun yum warehouse: vi / etc/yum.repos.d/ ali.repo. name=CentOS-$releasever-Basebaseurl= http://mirrors.aliyun.com/centos/$releasever/os/$basearch/gpgcheck=1gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
Scp / etc/yum.repos.d/ali.repo root@192.168.80.101:/etc/yum.repos.d/scp / etc/yum.repos.d/ali.repo root@192.168.80.102:/etc/yum.repos.d/scp / etc/yum.repos.d/ali.repo root@192.168.80.103:/etc/yum.repos.d/scp / etc/yum.repos.d/ali.repo root@192.168.80.104:/etc/yum.repos.d/
Note: if you have an ip address, turn off the network card and ping cannot access the web page. Modify the following content vi / etc/sysconfig/network-scripts/ifcfg-ens32 / / enter the configuration file of the network card.
Delete the command in the circle using the next command systemctl restart network / / restart the network card four servers install the following program: systemctl stop firewalld / / close the firewall setenforce 0 / / close the monitoring [root@lq5 yum.repos.d] # ifconfig ens34 down / / close the ens34 network card [root@lq5 yum.repos.d] # ifconfig ens34 up / / turn on the ens34 network card yum install-y wgetwget- O / etc/yum.repos.d/ali.repo http://mirrors.aliyun.com/repo/Centos-7.repoyum-y install epel-releaseyum clean all & & yum makecacheyum-y install mariadb-server mariadbyum install mariadb-server-y on the main server [root@NGINX ~] # systemctl start mariadb [root@NGINX ~] # vi / etc/ my.cnf [mysqld] log_error=/var/lib/mysql/mysql.errlog=/var/lib/mysql/mysql_log.loglog_slow_queries=/var/ Lib/mysql_slow_queris.logbinlog-ignore-db=mysql Information_schemacharacter_set_server=utf8log_bin=mysql_binserver_id=1log_slave_updatessync_binlog=1auto_increment_increment=2auto_increment_offset=1
[root@NGINX ~] # service mariadb restart [root@NGINX ~] # netstat-anpt | grep 3306
-when there is no problem, copy the configuration file to the other 3 database servers and start the server-
[root@NGINX ~] # scp / etc/my.cnf root@192.168.80.101:/etc/ [root@NGINX ~] # scp / etc/my.cnf root@192.168.80.102:/etc/ [root@NGINX ~] # scp / etc/my.cnf root@192.168.80.103:/etc/ [root@NGINX ~] # mysql-u root
MariaDB [(none)] > grant replication slave on *. * to 'replication'@'192.168.80.%' identified by' 123456 MariaDB [(none)] > flush privileges;MariaDB [(none)] > show master status\ G
On the slave server:
[root@test ~] # vi / etc/my.cnf
Modify Server-id, other slave servers also need to modify
[root@test ~] # service mariadb restart [root@test ~] # mysql-u rootMariaDB [(none)] > grant replication slave on *. * to 'replication'@'192.168.80.%' identified by' 123456 [(none)] > change master to master_host='192.168.80.100',master_user='replication',master_password='123456',master_log_file='mysql_bin.000003',master_log_pos=490;MariaDB [(none)] > start slave;MariaDB [(none)] > show slave status\ G
MariaDB [(none)] > show master status\ G
In the master server: MariaDB [(none)] > change master to master_host='192.168.80.101',master_user='replication',master_password='123456',master_log_file='mysql_bin.000003',master_log_pos=410;MariaDB [(none)] > start slave;MariaDB [(none)] > show slave status\ G
On slave server 1: vi / etc/my.cnf
[root@NGINX ~] # service mariadb restart [root@NGINX ~] # netstat-anpt | grep 3306
Mysql-u root
MariaDB [(none)] > change master to master_host='192.168.80.100',master_user='replication',master_password='123456',master_log_file='mysql_bin.000001',master_log_pos=490;MariaDB [(none)] > start slave;MariaDB [(none)] > show slave status\ G
On slave server 2: [root@test ~] # vi / etc/my.cnf
Modify Server-id, other slave servers also need to modify
[root@NGINX ~] # service mariadb restart [root@NGINX ~] # netstat-anpt | grep 3306
Mysql-u root
MariaDB [(none)] > change master to master_host='192.168.80.100',master_user='replication',master_password='123456',master_log_file='mysql_bin.000001',master_log_pos=490;MariaDB [(none)] > start slave;MariaDB [(none)] > show slave status\ G
Test: create an empty library on master / slave server: MariaDB [(none)] > create database aa;MariaDB [(none)] > show databases; on slave server 1:
On slave server 2:
At this point, master backup master slave synchronization is successful now configure mmm-install MMM---- on all servers-Note: epel source should be configured yum-y install mysql-mmm*- after installation, configure mmm-on the master server: [root@NGINX ~] # cd / etc/mysql-mmm/ [root@NGINX mysql-mmm] # ls
[root@NGINX mysql-mmm] # vi mmm_common.conf
Modify the following enclosure:
Send to other database server scp mmm_common.conf root@192.168.80.101:/etc/mysql-mmm/ scp mmm_common.conf root@192.168.80.102:/etc/mysql-mmm/ scp mmm_common.conf root@192.168.80.103:/etc/mysql-mmm/ scp mmm_common.conf root@192.168.80.104:/etc/mysql-mmm/ configure on monitor server: [root@MYSQL ~] # Cd / etc/mysql-mmm/ [root@MYSQL mysql-mmm] # vi mmm_mon.conf
On other mysql servers:
[root@NGINX mysql-mmm] # vi / etc/mysql-mmm/mmm_agent.conf
Master database 1:this db1 master database 2:this db2 slave database 1:this db3 slave database 2:this db4monitor server: this db5
Is in the respective configuration file modification, not in a virtual machine, each virtual machine has to perform the operation.
Grant replication client on for mmm_agent in four databases: grant super, replication client, process on *. * to 'mmm_agent'@'192.168.80.%' identified by' 123 grant replication client on *. * to 'mmm_monitor'@'192.168.80.%' identified by' 123 grant start mysql-mmm-agent
Configure on the monitor server:
[root@MYSQL mysql-mmm] # vi mmm_mon.conf
Systemctl start mysql-mmm-monitor / / launch mysql-mmm-monitornetstat-anp | grep 9988
Mmm_control checks all
Mmm_control show
Check if there is a drift address
Master Database 1
From Database 1
From Database 2
Simulate master database 1, slave database 1 failure, see if the drift address drifts from master database 1 to master database 2, and from database 1 address to slave database 2
Master Database 1
Systemctl stop mariadb
Master Database 2
From Database 1
Systemctl stop mariadb
From Database 2
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.