数据库主从复制部署
数据库服务器环境
系统: Centos7.9
数据库版本: Mariadb 10.6
数据库服务器:
1 2
| 172.16.11.31 mysql01(Master) 172.16.11.32 mysql02(Slave)
|
安装数据库服务
添加Mariadb10.6的源
1
| vim /etc/yum.repos.d/mariadb106.repo
|
1 2 3 4 5 6 7 8 9 10 11
| # MariaDB 10.6 CentOS repository list - created 2023-05-12 04:01 UTC # https://mariadb.org/download/ [mariadb] name = MariaDB # rpm.mariadb.org is a dynamic mirror if your preferred mirror goes offline. See https://mariadb.org/mirrorbits/ for details. # baseurl = https://rpm.mariadb.org/10.6/centos/$releasever/$basearch baseurl = https://mirrors.neusoft.edu.cn/mariadb/yum/10.6/centos/$releasever/$basearch module_hotfixes = 1 # gpgkey = https://rpm.mariadb.org/RPM-GPG-KEY-MariaDB gpgkey = https://mirrors.neusoft.edu.cn/mariadb/yum/RPM-GPG-KEY-MariaDB gpgcheck = 1
|
更新yum源后安装数据库
1
| yum update -y && yum install mariadb-server
|
进行数据库初始化
1
| mariadb-secure-installation
|
主从复制的文章
https://hexo.skybridair.cn/post/mariadb-zhu-cong-fu-zhi