测试MySQL复制的开发环境
有没有一种简单的方法可以通过 MySQL 复制在一台机器(或虚拟机)上设置环境?我想将 MySQL 复制的概念证明与一个主写入实例和两个用于读取的从属实例放在一起。
我可以看到在我的计算机上运行的 2 或 3 个虚拟机上执行此操作,但这确实会使我的系统陷入困境。我宁愿让所有东西都在同一个虚拟机上运行。在本地开发环境中证明此类可扩展性解决方案的最佳方法是什么?
谢谢你的帮助,
戴夫
Is there an easy way to setup an environment on one machine (or a VM) with MySQL replication? I would like to put together a proof of concept of MySQL replication with one Master write instance and two slave instances for reads.
I can see doing it across 2 or 3 VMs running on my computer, but that would really bog down my system. I'd rather have everything running on the same VM. What's the best way to proof out scalability solutions like this in a local dev environment?
Thanks for your help,
Dave
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我认为要真正测试 MySQL 复制,在现实约束中进行测试非常重要。
如果将所有复制节点放在一个操作系统下,则不再有带宽限制,数据传输速度将比这些复制数据库位于不同站点时获得的速度快得多。
一个虚拟机下的所有内容都是配置的快捷方式,例如它不会让您完成网络配置。
我建议您使用多个虚拟机,即使您必须将它们放在一台物理机下,您也可以随时配置虚拟机管理程序以使数据包通过路由器,在这种情况下,I/O 将受到网络接口所具有的任何限制作为吞吐量。
您可以尝试使用您想要的操作系统的 JeOS(Just Enough OS)版本制作一些虚拟机。我知道 Ubuntu 有一个,它可以在 128 RAM 上启动,这使得在一台物理机上部署大量克隆虚拟机而无需巨大的 RAM 变得很方便。
下一步将在云(基础设施即服务,IaaS)提供商上执行相同的操作,并尝试在不同地理位置的站点上进行设置。
I think to truly test MySQL Replication it is important to do so in realistic constraints.
If you put all the replicate nodes under one operating system then you no longer have the bandwidth constraint, the data transfer speed would be much higher that what you would get if those replicate DBs are on different sites.
Everything under one VM is a shortcut to configurations, for instance it does not make you go through the configuration of the networking.
I suggest you use multiple VMs, even if you have to put them under one physical machine, you can always configure the hypervisor to make the packets go through a router, in which case the I/O will be bound by whatever the network interface has as throughput.
You can try and make a few VMs with JeOS (Just Enough OS) versions of the operating system you want. I know Ubuntu has one and it can boot on 128 RAM, which makes it convenient to deploy lots of cloned VMs under one physical machine without monster RAM.
Next step would be doing the same thing on a cloud (Infrastructure as a Service, IaaS) provider, and try your setup on different geographical sites.
如果您要测试的是机器到机器的复制,那么在虚拟专用网络上设置多个虚拟机将是测试它的正确环境。如果您使用 Ubuntu Server,则不必安装超出实际需要的内容 - 只需提供VM 有足够的空间用于基本安装 + MySQL + 您的数据。每个虚拟机的内存使用量可以低至 256MB。您所要做的就是在不运行全面测试时暂停或关闭虚拟机。
我曾经遇到过在工作站上同时运行 4 个或更多虚拟机的情况,无论是出于开发还是测试目的 - 除非您尝试在每个虚拟机中进行视频渲染,否则这并不费力。
If what you're testing is machine-to-machine replication, then setting up multiple VMs on a virtual private network would be the correct environment to test it. If you use Ubuntu Server, you don't have to install more than you actually need -- just give the VMs enough space for a base install + MySQL + your data. Memory usage can be as little as 256MB per VM. All you have to do is suspend or shutdown the VMs when you're not running a full-up test.
I've had situations where I was running 4 or more VMs simultaneously on my workstation, either for development or testing purposes -- it's not that taxing unless you're trying to do video rendering in each VM.