MySQL代理替代数据库分片

时间:2023-01-19 19:19:47

Are there any alternatives for MySQL Proxy. I don't want to use it since it's still in alpha.

有没有MySQL代理的替代方案。我不想用它,因为它还在。

I will have 10 MySQL servers with table_1 table_2 table_3 table_4 ... table_10 spread across the 10 servers. Each table is identical in their structure, their just shards with different data sets.

我将有10个MySQL服务器和table_1 table_2 table_3 table_4…table_10分布在10个服务器上。每个表在结构上都是相同的,只是使用不同的数据集进行切分。

Is there a alternative to MySQL Proxy, where I can have my client application connect to a single SQL Server (A proxy), which looks at the query and fetches the data on behalf of it.

有没有MySQL代理的替代方案,我可以让我的客户端应用程序连接到一个SQL服务器(代理),它会查看查询并代表查询获取数据。

For example, if the client requests "SELECT * FROM table_5 WHERE user=123" from the Proxy, which connects to the 5th SQL Server that houses table_5 and gets the data?

例如,如果客户端从代理请求“SELECT * FROM table_5,其中user=123”,该代理连接到包含table_5并获取数据的第五个SQL服务器?

2 个解决方案

#1


4  

Spock Proxy supports range-based horizontal paritioning of a large MySQL database. The proxy intercepts SQL queries from the client, sends queries to the correct databases based on how the database is partitioned, then aggregates the results from each database and returns them to the client as a regular MySQL result set.

Spock代理支持大型MySQL数据库的基于范围的水平分割。代理从客户端截取SQL查询,根据数据库的分区方式向正确的数据库发送查询,然后从每个数据库收集结果,并将它们作为常规的MySQL结果集返回给客户端。

#2


0  

I can see that adding a proxy could enable you to change little or nothing in the app but it's worth considering that you're adding a big single point of failure.

我可以看到,添加一个代理可以让你在应用程序中改变很少或根本不改变,但是考虑到你添加了一个很大的失败点是值得的。

I would suggest that you move the logic required to decide which database to go looking in up into the application layer.

我建议您将决定在应用程序层中查找哪个数据库所需的逻辑移到其中。

#1


4  

Spock Proxy supports range-based horizontal paritioning of a large MySQL database. The proxy intercepts SQL queries from the client, sends queries to the correct databases based on how the database is partitioned, then aggregates the results from each database and returns them to the client as a regular MySQL result set.

Spock代理支持大型MySQL数据库的基于范围的水平分割。代理从客户端截取SQL查询,根据数据库的分区方式向正确的数据库发送查询,然后从每个数据库收集结果,并将它们作为常规的MySQL结果集返回给客户端。

#2


0  

I can see that adding a proxy could enable you to change little or nothing in the app but it's worth considering that you're adding a big single point of failure.

我可以看到,添加一个代理可以让你在应用程序中改变很少或根本不改变,但是考虑到你添加了一个很大的失败点是值得的。

I would suggest that you move the logic required to decide which database to go looking in up into the application layer.

我建议您将决定在应用程序层中查找哪个数据库所需的逻辑移到其中。