英文:
server failover with Quarkus Reactive MySQL Clients / io.vertx.mysqlclient
问题
io.vertx.mysqlclient
是否支持服务器故障转移 就像MySQL Connector/J中可以设置的那样?
我的应用程序基于使用io.vertx.mutiny.mysqlclient.MySQLPool
的Quarkus,该池反过来又基于io.vertx.mysqlclient
。如果在该堆栈中支持服务器故障转移,该如何设置?我在文档和代码中没有找到任何提示。
英文:
Does io.vertx.mysqlclient
support server failover as it can be set up with MySQL Connector/J?
My application is based on quarkus using io.vertx.mutiny.mysqlclient.MySQLPool
which in turn is based on io.vertx.mysqlclient
. If there is support for server failover in that stack, how can it be set up? I did not find any hints in the documentation and code.
答案1
得分: 5
不,它不支持故障转移。
您可以创建两个客户端,然后使用Munity故障转移方法来达到相同的效果:
MySQLPool client1 = ...
MySQLPool client2 = ...
private Uni<List<Data>> query(MySQLPool client) {
// 使用client参数将查询发送到数据库
}
Uni<List<Data>> results = query(client1)
.onFailure().recoverWithUni(() -> query(client2));
英文:
No it doesn't support failover.
You could create two clients and then use Munity failover methods to get the same effect:
MySQLPool client1 = ...
MySQLPool client2 = ...
private Uni<List<Data>> query(MySQLPool client) {
// Use client param to send queries to the database
}
Uni<List<Data>> results = query(client1)
.onFailure().recoverWithUni(() -> query(client2));
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论