MariaDB +Centos+MMM 叢集安裝除錯

老驥又出發發表於2020-10-06

流行的mysql叢集的使用

環境

伺服器環境是Centos7.8,MariaDB版本 5.5.65-MariaDB

主機ip備註
mmm-monitor192.168.137.124獨立機器
mmm-master1192.168.137.201與master2互為備份,是slave1的主
mmm-master2192.168.137.202和master互為高可用。
mmm-slave1192.168.137.203是master1的從

 

總圖架構。

安裝mariadb

1) 在mmm-master,mmm-master2,mmm-slave2 上安裝mariadb

在這三臺機器上 執行查詢我們需要安裝的版本

[root@mmm-monitor ~]# yum list |grep mariadb
mariadb.x86_64                            1:5.5.65-1.el7               @base    
mariadb-libs.x86_64                       1:5.5.65-1.el7               @anaconda
mariadb-bench.x86_64                      1:5.5.65-1.el7               base     
mariadb-devel.i686                        1:5.5.65-1.el7               base     
mariadb-devel.x86_64                      1:5.5.65-1.el7               base     
mariadb-embedded.i686                     1:5.5.65-1.el7               base     
mariadb-embedded.x86_64                   1:5.5.65-1.el7               base     
mariadb-embedded-devel.i686               1:5.5.65-1.el7               base     
mariadb-embedded-devel.x86_64             1:5.5.65-1.el7               base     
mariadb-libs.i686                         1:5.5.65-1.el7               base     
mariadb-server.x86_64                     1:5.5.65-1.el7               base     
mariadb-test.x86_64                       1:5.5.65-1.el7               ba

2)安裝到上述三臺機器上

yum install mariadb.x86_64  mariadb-server.x86_64  -y

 

安裝MMM

1) 在所有機器上安裝epel源, 然後安裝 mmm監控和代理

yum -y install epel-release

yum -y install mysql-mmm-agent
yum -y install mysql-mmm-monitor

測試並且配置maraidb

1)預設啟用maraidb,並啟動,在mmm-maste1,mmm-master2,mmm-slave1上都要去執行。

[root@mmm-master1 ~]# systemctl enable mariadb
Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /usr/lib/systemd/system/mariadb.service.
root@mmm-master1 ~]# systemctl start mariadb
[root@mmm-master1 ~]# mysql -uroot -p -hlocalhost
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 5
Server version: 5.5.65-MariaDB MariaDB Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> exit
Bye
[root@mmm-master1 ~]# mysql -uroot -p  -hlocalhost
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 6
Server version: 5.5.65-MariaDB MariaDB Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> 

2)配置所有伺服器的host檔案 ,在四臺機器上都需要配置。

[root@mmm-monitor ~]# cat <<EOF >>/etc/hosts
> 192.168.137.124 mmm-monitor
> 192.167.137.201 mmm-master1
> 192.167.137.202 mmm-master2
> 192.167.137.203 mmm-slave1
> EOF

3)

相關文章