MySQL – Setting Up Read Replicas on Different Ports

MySQLreplication

I have a specific need to create a single linux server which can host 4 MySQL instances with read replication. Here are a few questions I cannot seem to find answers to:

  1. Can you setup read replication through MySQL similar to Amazon RDS, or is
    Amazon using a propriety application to handle this read/write
    replication? If not, are there standalone packages for this kind of replication?
  2. Can you set individual settings for each MySQL installation? For instance I want a memory limit for MySQL running on port 64506 of 2GB, but MySQL installation on port 3306 should have a 16GB memory limit?

Best Answer

  1. Yes, Amazon uses standard replication for its instances. Not only it is documented here, but also is proven with the fact that you can replicate from and to MySQL instances outside of RDS. No need for any extra packages/software, a standard MySQL server can be a master and/or a slave with the appropriate configuration and preparation.

  2. Yes, if you run several MySQL instances on the same node (assuming you have changed its port, data directory, pid and socket), you can configure them with different buffer sizes, max_connections, etc. However, make sure to understand that there is no way to hard limit the maximum memory or CPU usage on MySQL configuration - if you want real isolation, you have to go to virtualization or other operating system limits (this is what Amazon actually does).

I recommend you to have a look at MySQL Sandbox, which makes easier to setup MySQL and replication among them on the same machine.