花了小一天的时间,终于实现了centos7 mariadb主从复制配置搭建,下面记录一下过程
环境:
虚拟机:vm8; centos7 版本:7.2.1511; mariadb 版本:centos7.2内置的
主库服务器: 10.69.5.200,CentOS 7,MariaDB 10已安装,有数据。
从库服务器1: 10.69.5.201,CentOS 7,MariaDB 10已安装,无应用数据。
主服务器配置
以下操作在主服务器192.168.71.151的/etc/my.cnf上进行。
1.修改配置文件,命令:vim /etc/my.cnf,输入下列代码:
[root@localhost ~]# cat /etc/my.cnf[mysqld]datadir=/var/lib/mysqlsocket=/var/lib/mysql/mysql.sock`# 新添加的部分# 配置主从时需要添加以下信息 startinnodb_file_per_table=NOlog-bin=/var/lib/mysql/master-bin #log-bin没指定存储目录,则是默认datadir指向的目录binlog_format=mixedserver-id=200 #每个服务器都需要添加server_id配置,各个服务器的server_id需要保证唯一性,实践中通常设置为服务器IP地址的最后一位#配置主从时需要添加以下信息 end `# Disabling symbolic-links is recommended to prevent assorted security riskssymbolic-links=0# Settings user and group are ignored when systemd is used.# If you need to run mysqld under a different user or group,# customize your systemd unit file for mariadb according to the# instructions in http://fedoraproject.org/wiki/Systemd[mysqld_safe]log-error=/var/log/mariadb/mariadb.logpid-file=/var/run/mariadb/mariadb.pid## include all files from the config directory#!includedir /etc/my.cnf.d
评论列表()