2

I am using Innodb-cluster with three instances with "Single-Primary" topology. Now when I configure MysqlRouter it gives me following two ports for reading and writing:

- Read/Write Connections: localhost:6446
- Read/Only Connections: localhost:6447

However in my Spring boot application I do not want to keep read and write separation, because it forces me to keep two datasources.

Is there any way that I can just use one connection/datasource for both reading and writing?

Ashish
  • 198
  • 3
  • 11
  • You could use a "routed datasource" (https://spring.io/blog/2007/01/23/dynamic-datasource-routing/, https://www.baeldung.com/spring-abstract-routing-data-source) ... you would then just have to determine (from the context), which datasource to use. (which sounds also easy/feasible) – xerx593 May 17 '21 at 13:37

0 Answers0