- Newest
- Most votes
- Most comments
It seems you're encountering some challenges in setting up a cluster configuration for MariaDB on AWS. Let me clarify a few points and provide some guidance.
First, it's important to understand that MariaDB on Amazon RDS doesn't offer the same native clustering capabilities as Aurora. The setup you described with Aurora, where you could use a single cluster endpoint to automatically route read and write queries, is a feature specific to Aurora and not available in the same way for MariaDB.
For MariaDB on RDS, you can create read replicas, but the routing of read and write queries is not automatically managed through a single endpoint. This explains why you're seeing all traffic go to whichever instance you specify in your environment variables.
To achieve a setup similar to what you had with Aurora, you would need to implement this routing logic at the application level. This means your application would need to be aware of which instance is the primary (for writes) and which are the read replicas (for reads), and direct queries accordingly.
Some possible approaches to manage this include:
- Use separate connection strings in your application for read and write operations.
- Implement a connection pooling solution that can route queries based on their type (read vs write).
- Consider using a proxy layer (like ProxySQL) that can handle the routing of queries to appropriate instances.
If you require the advanced clustering features you experienced with Aurora, you might want to consider migrating to Aurora MariaDB, which provides similar capabilities to what you had in your previous Aurora setup.
Remember, while MariaDB on RDS offers high availability through Multi-AZ deployments and scalability through read replicas, it doesn't provide the same level of integrated clustering features as Aurora. This is why you're experiencing these limitations in your current setup.
Sources
Aurora MySQL cluster failing to connect internmently | AWS re:Post
Amazon RDS Multi-AZ with two readable standbys: Under the hood | AWS Database Blog
Perhaps look at Multi-AZ instead of a read replica. Only have aread replica if you want to keep your reads and writes on seperate servers
