- ubuntu12.04环境下使用kvm ioctl接口实现最简单的虚拟机
- Ubuntu 通过无线网络安装Ubuntu Server启动系统后连接无线网络的方法
- 在Ubuntu上搭建网桥的方法
- ubuntu 虚拟机上网方式及相关配置详解
CFSDN坚持开源创造价值,我们致力于搭建一个资源共享平台,让每一个IT人在这里找到属于你的精彩世界.
这篇CFSDN的博客文章MySQL-MMM安装指南(Multi-Master Replication Manager for MySQL)由作者收集整理,如果你对这篇文章有兴趣,记得点赞哟.
最基本的MMM安装必须至少需要2个数据库服务器和一个监控服务器下面要配置的MySQL Cluster环境包含四台数据库服务器和一台监控服务器,如下:
。
function 。 |
ip 。 |
hostname 。 |
server id 。 |
---|---|---|---|
monitoring host 。 |
192.168.0.10 。 |
mon 。 |
- 。 |
master 1 。 |
192.168.0.11 。 |
db1 。 |
1 。 |
master 2 。 |
192.168.0.12 。 |
db2 。 |
2 。 |
slave 1 。 |
192.168.0.13 。 |
db3 。 |
3 。 |
slave 2 。 |
192.168.0.14 。 |
db4 。 |
4 。 |
。
。
如果是个人学习安装,一下子找5台机器不太容易,可以虚拟机就可以完成.
配置完成后,使用下面的虚拟IP访问MySQL Cluster,他们通过MMM分配到不同的服务器.
。
ip 。 |
role 。 |
description 。 |
---|---|---|
192.168.0.100 。 |
writer 。 |
应用程序应该连接到这个ip进行写操作 。 |
192.168.0.101 。 |
reader 。 |
应用程序应该链接到这些ip中的一个进行读操作 。 |
192.168.0.102 。 |
reader 。 |
|
192.168.0.103 。 |
reader 。 |
|
192.168.0.104 。 |
reader 。 |
。
。
结构图如下:
。
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: 。
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 。 |
description 。 |
privileges 。 |
---|---|---|
monitor user 。 |
used by the mmm monitor to check the health of the MySQL servers 。 |
REPLICATION CLIENT 。 |
agent user 。 |
used by the mmm agent to change read-only mode, replication master, etc. 。 |
SUPER, REPLICATION CLIENT, PROCESS 。 |
relication user 。 |
used for replication 。 |
REPLICATION SLAVE 。 |
。
。
Note: We could be more restrictive here regarding the hosts from which the users are allowed to connect: mmm_monitor is used from 192.168.0.10. mmm_agent and replication are used from 192.168.0.11 - 192.168.0.14. Note: Don't use a replication_password longer than 32 characters 。
4. Synchronisation of data between both databases 。
I'll assume that db1 contains the correct data. If you have an empty database, you still have to syncronize the accounts we have just created. First make sure that no one is altering the data while we create a backup. 。
。
。
Then get the current position in the binary-log. We will need this values when we setup the replication on db2, db3 and db4. 。
。
。
DON'T CLOSE this mysql-shell. If you close it, the database lock will be removed. Open a second console and type
db1$ mysqldump -u root -p --all-databases > /tmp/database-backup.sql 。
Now we can remove the database-lock. Go to the first shell
(db1) mysql> UNLOCK TABLES;Copy the database backup to db2, db3 and db4. 。
。
。
Then import this into db2, db3 and db4
。
。
Then flush the privileges on db2, db3 and db4. We have altered the user-table and mysql has to reread this table. 。
。
。
On debian and ubuntu, copy the passwords in /etc/mysql/debian.cnf from db1 to db2, db3 and db4. This password is used for starting and stopping mysql. Both databases now contain the same data. We now can setup replication to keep it that way. Note: Import just only add records from dump file. You should drop all databases before import dump file. 。
5. Setup replication 。
Configure replication on db2, db3 and db4 with the following commands
。
。
Please insert the values return by “show master status” on db1 at the <file> and <position> tags. Start the slave-process on all 3 hosts
。
。
Now check if the replication is running correctly on all hosts
。
。
Now we have to make db1 replicate from db2. First we have to determine the values for master_log_file and master_log_pos
。
。
Now we configure replication on db1 with the following command
。
。
Now insert the values return by “show master status” on db2 at the <file> and <position> tags. 。
Start the slave-process
(db1) mysql> START SLAVE;Now check if the replication is running correctly on db1
。
。
Replication between the nodes should now be complete. Try it by inserting some data into both db1 and db2 and check that the data will appear on all other nodes. 。
6. Install MMM 。
Create user Optional: Create user that will be the owner of the MMM scripts and configuration files. This will provide an easier method to securely manage the monitor scripts. 。
useradd --comment "MMM Script owner" --shell /sbin/nologin mmmdMonitoring host First install dependencies
。
。
Then fetch the latest mysql-mmm-common*.deb and mysql-mmm-monitor*.deb and install it
dpkg -i mysql-mmm-common_*.deb mysql-mmm-monitor*.deb 。
Database hosts On Ubuntu First install dependencies
aptitude install liblog-log4perl-perl libmailtools-perl liblog-dispatch-perl iproute libnet-arp-perl libproc-daemon-perl libalgorithm-diff-perl libdbi-perl libdbd-mysql-perlThen fetch the latest mysql-mmm-common*.deb and mysql-mmm-agent*.deb and install it
dpkg -i mysql-mmm-common_*.deb mysql-mmm-agent_*.debOn RedHat 。
yum install -y mysql-mmm-agentThis will take care of all the dependencies, which may include
Installed
mysql-mmm-agent.noarch 0:2.2.1-1.el5 。
Dependency Installed
。
。
Configure MMM 。
All generic configuration-options are grouped in a separate file called /etc/mysql-mmm/mmm_common.conf. This file will be the same on all hosts in the system
。
active_master_role writer 。
。
<host default> cluster_interface eth0 pid_path /var/run/mmmd_agent.pid bin_path /usr/lib/mysql-mmm/ replication_user replication replication_password replication_password agent_user mmm_agent agent_password agent_password </host> <host db1> ip 192.168.0.11 mode master peer db2 </host> <host db2> ip 192.168.0.12 mode master peer db1 </host> <host db3> ip 192.168.0.13 mode slave </host> <host db4> ip 192.168.0.14 mode slave </host> 。
<role writer> hosts db1, db2 ips 192.168.0.100 mode exclusive </role> <role reader> hosts db1, db2, db3, db4 ips 192.168.0.101, 192.168.0.102, 192.168.0.103, 192.168.0.104 mode balanced </role> 。
。
Don't forget to copy this file to all other hosts (including the monitoring host). 。
On the database hosts we need to edit /etc/mysql-mmm/mmm_agent.conf. Change “db1” accordingly on the other hosts
。
。
On the monitor host we need to edit /etc/mysql-mmm/mmm_mon.conf
。
include mmm_common.conf 。
。
<monitor> ip 127.0.0.1 pid_path /var/run/mmmd_mon.pid bin_path /usr/lib/mysql-mmm/ status_path /var/lib/misc/mmmd_mon.status ping_ips 192.168.0.1, 192.168.0.11, 192.168.0.12, 192.168.0.13, 192.168.0.14 </monitor> 。
<host default> monitor_user mmm_monitor monitor_password monitor_password </host> 。
debug 0 。
。
ping_ips are some ips that are pinged to determine whether the network connection of the monitor is ok. I used my switch (192.168.0.1) and the four database server. 。
7. Start MMM 。
。
Start the agents (On the database hosts) 。
Debian/Ubuntu Edit /etc/default/mysql-mmm-agent to enable the agent
ENABLED=1Red Hat RHEL/Fedora does not enable packages to start at boot time per default policy, so you might have to turn it on manually so the agents will start automatically when server is rebooted
chkconfig mysql-mmm-agent onThen start it
/etc/init.d/mysql-mmm-agent startStart the monitor (On the monitoring host) Edit /etc/default/mysql-mmm-monitor to enable the monitor
ENABLED=1Then start it
/etc/init.d/mysql-mmm-monitor start 。
Wait some seconds for mmmd_mon to start up. After a few seconds you can use mmm_control to check the status of the cluster
。
。
Because its the first startup the monitor does not know our hosts, so it sets all hosts to state AWAITING_RECOVERY and logs a warning message
。
。
Now we set or hosts online (db1 first, because the slaves replicate from this host)
。
。
参考:http://mysql-mmm.org/mmm2:guide 。
最后此篇关于MySQL-MMM安装指南(Multi-Master Replication Manager for MySQL)的文章就讲到这里了,如果你想了解更多关于MySQL-MMM安装指南(Multi-Master Replication Manager for MySQL)的内容请搜索CFSDN的文章或继续浏览相关文章,希望大家以后支持我的博客! 。
我目前正在制作一个将订阅作为 Multi-Tenancy 应用程序出售的 web 应用程序。我使用的技术是导轨。 但是,它不仅仅是使用当前应用程序的孤立租户。 每个租户创建产品并将其发布到他们的个人应
我们计划将 Azure Service Fabric 用于面向数据的 Multi-Tenancy 应用程序。通常有 100 多个客户,每个客户有 5 - 100 个用户。 查看文档,我得出的结论是,最
我们正在为我们正在构建的自定义 Saas 应用程序评估 Shiro。似乎一个伟大的框架可以完成我们想要的 90% 的工作,开箱即用。我对 Shiro 的理解是基本的,这就是我想要完成的。 我们有多个客
希望使用 NestJS 6 的新请求注入(inject)范围功能实现 Multi-Tenancy NestJS 解决方案。 对于任何给定的服务,我认为我可以做这样的事情: @Injectable({s
我正在寻找一个基于 PHP 的框架,该框架已准备好具有以下功能 1.带有登录/注销的简单仪表板 2. 多个数据库,每个数据库代表一个客户端 只是基本框架。 3.简单的注册支持 用例: 我从 githu
我正在尝试对这个已经回答的问题进行一些跟进...... Service Fabric multi-tenant 如果我要将我的租户设置为 Azure Service Fabric 无状态服务(他们将获
首先,我很清楚 Keycloak 中的多领域 Multi-Tenancy 方法。我接手了一个没有人想到 Multi-Tenancy 的遗留项目。现在,两年后,突然,客户需要这个功能。实际上,微服务已经
我正在使用 Apache Nifi 开发基于云的应用程序,为此我们需要支持 Multi-Tenancy 。但是当前的 Nifi 实现只支持基于角色的用户访问,对于单个流。 我可以理解流状态被保存为 N
对于我积极维护的客户基于 Web 的 CRM 的分支机构数量不断增加的 Multi-Tenancy ,我需要做出一个艰难的数据库设计决策。 我很早就决定为每个分支使用具有单独数据库的单独应用程序,因为
关闭。这个问题是opinion-based .它目前不接受答案。 想要改进这个问题? 更新问题,以便 editing this post 可以用事实和引用来回答它. 关闭 9 年前。 Improve
很抱歉我的英语不好,希望你能看到我说的。 在Lucene3 Junit测试代码中:org.apache.lucene.queryParser.TestMultiAnalyzer.testMultiAn
假设我们有一个多维数组。 multi[3][10] 那么&multi[0][0]将是multi 如果我们想访问这个数组中的任何元素。我们只需要一次解除引用。因为它位于连续的位置。我无法理解双重取消引用
表结构和示例数据 Wall_Update [INT VARCHAR VARCHAR TIMESTAMP TinyText]
我们需要构建一个软件框架(或中间件),以便在一台机器上运行的不同软件组件(或模块)之间实现消息传递。该框架将提供以下功能: 模块之间的通信是通过“消息传递”。 每个模块都有自己的消息队列和消息处理线程
我正在开发一个在多个域上运行的应用程序。 我想对所有这些都使用 Google 自定义搜索。但是 GCS 需要提供要搜索的网站域。 有没有办法动态指定域?理论上,我可以拥有数千个域,但我不喜欢手动添加所
在 here.com map 类 MapMarker 中,此方法 showInfoBubble () 无法在多 map 标记上显示多信息气泡,对此有任何解决方案吗? 最佳答案 来自 showInfoB
我正在开发一个 Multi-Tenancy 解决方案,我想使用最新的 ASP.NET Identity框架特别是Entity Framework执行。 基本上,我需要允许两个用户使用相同的用户名,尽管
我有 50 台可用台式计算机(配备 i5),每台都运行 Ubuntu 14.04 LTS。我需要通过 C 代码计算某些事件的概率,样本大小至少为 2^45。显然,在一台计算机上运行 C 代码不是一种选
我正在按照页面上的示例进行操作:Multi-input and multi-output models 用于预测新闻标题将收到多少转发和点赞的模型设置。那么 main_output 正在预测有多少
硬件:我们使用 24 核(2*12 核)机器。 SSD 磁盘和 SAS-RAID 0 磁盘有 2 个独立的 Controller 。操作系统:Windows 8.1。超线程已禁用。 软件: 2.1。有
我是一名优秀的程序员,十分优秀!