首页 > 数据库 > MySQL > 正文

MySQL-MMM安装指南(Multi-Master Replication Manager for MySQL)

2024-07-24 12:47:38
字体:
来源:转载
供稿:网友

最基本的MMM安装必须至少需要2个数据库服务器和一个监控服务器下面要配置的MySQL Cluster环境包含四台数据库服务器和一台监控服务器,如下:

functioniphostnameserver id
monitoring host192.168.0.10mon-
master 1192.168.0.11db11
master 2192.168.0.12db22
slave 1192.168.0.13db33
slave 2192.168.0.14db44

如果是个人学习安装,一下子找5台机器不太容易,可以虚拟机就可以完成。

 配置完成后,使用下面的虚拟IP访问MySQL Cluster,他们通过MMM分配到不同的服务器。

iproledescription
192.168.0.100writer应用程序应该连接到这个ip进行写操作
192.168.0.101reader应用程序应该链接到这些ip中的一个进行读操作
192.168.0.102reader
192.168.0.103reader
192.168.0.104reader

结构图如下:

2. Basic configuration of master 1

First we install MySQL on all hosts:
aptitude install mysql-serverThen we edit the configuration file /etc/mysql/my.cnf and add the following lines - be sure to use different server ids for all hosts:

复制代码 代码如下:

server_id = 1
log_bin = /var/log/mysql/mysql-bin.log
log_bin_index = /var/log/mysql/mysql-bin.log.index
relay_log = /var/log/mysql/mysql-relay-bin
relay_log_index = /var/log/mysql/mysql-relay-bin.index
expire_logs_days = 10
max_binlog_size = 100M
log_slave_updates = 1


Then remove the following entry:
bind-address = 127.0.0.1Set to number of masters:
auto_increment_increment = 2Set to a unique, incremented number, less than auto_increment_increment, on each server

auto_increment_offset = 1Do not bind of any specific IP, use 0.0.0.0 instead:

bind-address = 0.0.0.0Afterwards we need to restart MySQL for our changes to take effect:

/etc/init.d/mysql restart

3. Create usersNow we can create the required users. We'll need 3 different users:

function
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表