æ¥åã§Amazon Auroraãå©ç¨ãã¦ãã¾ãããã§ã¤ã«ãªã¼ãã¼ããµãã¼ããã¦ããã¦ããMariaDB Connector/Jãå©ç¨ãã¦ããã®ã§ããã1.3.0ãããã§ã¤ã«ãªã¼ãã¼ã®ãµãã¼ããããªããªã£ãã®ã§ãä¹ãæãå
ãæ¢ãã¦ãã¾ããã
About MariaDB Connector/J - MariaDB Knowledge Base
調ã¹ã¦ã¿ãããaws-mysql-jdbcã¨ãaws-advanced-jdbc-wrapperãé¸æè¢ã¨ãã¦ä¸ããã¾ãããã©ã¡ããAWS謹製ãªã®ã§ããããã£ããè¨ãã¨åè
ãJDBCãã©ã¤ãã¼ã§ãå¾è
ãJDBCãã©ã¤ãã¼ã®Wrapperã§MySQLãPostgreSQLãªã©ã®JDBCãã©ã¤ãã¼ã¨ä½µãã¦ä½¿ããã®ã«ãªãã¾ãã
æ¤è¨¼
å
ã«æãã2ã¤ã®ã©ã¤ãã©ãªã®æ¤è¨¼ããã¾ãããçµè«ããè¨ãã¨ãRead-Writeã§æ¥ç¶å
ãæ¯ãåããï¼èªã¿è¾¼ã¿æã¯Readerãæ¸ãè¾¼ã¿æã¯Writerã«æ¥ç¶ããï¼ã¨ããè¦ä»¶ãæºããã¦ããã®ããaws-advanced-jdbc-wrapper
ã ãã ã£ãã®ã§ãããããå©ç¨ãããã¨ã決ãã¾ããã
aws-mysql-jdbcã®ããã«é¢ããè°è«ã¯ãã¡ãã§è¡ããã¦ãã¾ãã
ä»åã®ç°å¢
- Java 17
- Spring Boot 3.1.0
- aws-mysql-jdbc 1.1.7
- aws-advanced-jdbc-wrapper 2.2.2
- Amazon Aurora MySQL 8.0.mysql_aurora.3.03.1
- Readerã¯1å°
æ¤è¨¼æé
1. ã¢ããªã±ã¼ã·ã§ã³ã®æ¥ç¶å
URLãã¯ã©ã¹ã¿ã¼ã¨ã³ããã¤ã³ãã«ãã
2. APIãèµ·å
3. curlã§é£ç¶çã«ãã¼ã¿æ¸ãè¾¼ã¿ç¨ã¨ã³ããã¤ã³ããå©ã
4. curlã§é£ç¶çã«ãã¼ã¿åç
§ç¨ã¨ã³ããã¤ã³ããå©ã
5. æåã§ãã§ã¤ã«ãªã¼ãã¼ãèµ·ãã
MySQL Connector/J
æ¯è¼ã®ããã«ãMySQL Connector/Jã«ã¤ãã¦ãæ¤è¨¼ãã¦ã¿ã¾ããã
ã¢ããªã±ã¼ã·ã§ã³ã®è¨å®
application.yml
spring:
datasource:
url: jdbc:mysql:replication://${ã¯ã©ã¹ã¿ã¼ã¨ã³ããã¤ã³ã},${Read-Onlyã¯ã©ã¹ã¿ã¼ã¨ã³ããã¤ã³ã}/test_db
build.gradle
dependencies {
runtimeOnly 'com.mysql:mysql-connector-j'
}
ãã§ã¤ã«ãªã¼ãã¼å®è¡
ãã§ã¤ã«ãªã¼ãã¼å®è¡ããã¨ãDBæ¥ç¶ã«å¤±æå¾ã«ãéæ ¼ããï¼WriterããReaderã«ãªã£ãï¼ã¤ã³ã¹ã¿ã³ã¹ã«æ¥ç¶ãã¤ã¥ããããread-onlyã®ãã©ã³ã¶ã¯ã·ã§ã³ã§æ¸ãè¾¼ã¿ãããã¨ãã¦ããã¨æããã¾ããããã¡ããAuroraã®ãã§ã¤ã«ãªã¼ãã¼ã«ã¯å¯¾å¿ãã¦ãã¾ããã§ããã
2023-06-25T19:26:17.301+09:00 WARN 26196 --- [nio-8080-exec-1] com.zaxxer.hikari.pool.ProxyConnection : HikariPool-1 - Connection com.mysql.cj.jdbc.ConnectionImpl@61e86192 marked as broken because of SQLSTATE(08S01), ErrorCode(0)
com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure
The last packet successfully received from the server was 34 milliseconds ago. The last packet sent successfully to the server was 37 milliseconds ago.
...
2023-06-25T19:26:17.397+09:00 WARN 26196 --- [nio-8080-exec-2] com.zaxxer.hikari.pool.PoolBase : HikariPool-1 - Failed to validate connection com.mysql.cj.jdbc.ConnectionImpl@29bd6f67 (No operations allowed after connection closed.). Possibly consider using a shorter maxLifetime value.
Hibernate: insert into shop (name) values (?)
2023-06-25T19:26:27.762+09:00 WARN 26196 --- [nio-8080-exec-2] o.h.engine.jdbc.spi.SqlExceptionHelper : SQL Error: 1836, SQLState: HY000
2023-06-25T19:26:27.763+09:00 ERROR 26196 --- [nio-8080-exec-2] o.h.engine.jdbc.spi.SqlExceptionHelper : Running in read-only mode
Amazon Web Services (AWS) JDBC Driver for MySQLã¯ã¯ã©ã¹ã¿ãªã³ã°ãããMySQLãã¼ã¿ãã¼ã¹ãå©ç¨ããã¢ããªã±ã¼ã·ã§ã³ã«ã¡ãªãããããã¾ããããã¯ãMySQL Connector/J driverããã¼ã¹ã«ãã¦ãããããããã¤ã³äºææ§ãããã¾ãã
The AWS JDBC Driver for MySQLã¯ãMySQLäºæã®Amazon Auroraã®ããã®ç´ æ©ããã§ã¤ã«ãªã¼ãã¼ããµãã¼ããã¦ãã¾ããã¯ã©ã¹ã¿ãªã³ã°ããããã¼ã¿ãã¼ã¹ã®æ©è½ã«å ãã¦ãAmazon RDS for MySQLããªã³ãã¬ãã¹ç°å¢ã®MySQLã®ããã®æ©è½ãå«ãã§ãµãã¼ããã¦ãã¾ãã
ãã詳ãããã¨ã¯ãå
¬å¼ããã¥ã¡ã³ããåç
§ãã¦ãã ããã
ã¢ããªã±ã¼ã·ã§ã³ã®è¨å®
application.yml
spring:
datasource:
url: jdbc:mysql:aws://${ã¯ã©ã¹ã¿ã¼ã¨ã³ããã¤ã³ã}/test_db
driver-class-name: software.aws.rds.jdbc.mysql.Driver
build.gradle
dependencies {
runtimeOnly "software.aws.rds:aws-mysql-jdbc:1.1.7"
}
ãã§ã¤ã«ãªã¼ãã¼å®è¡
常ã«ã¯ã©ã¹ã¿ã¼ã¨ã³ããã¤ã³ãã«æ¥ç¶ãã¦ããã®ã§ããã§ã¤ã«ãªã¼ãã¼ãå®è¡å¾ããã®ã¾ã¾ã¯ã©ã¹ã¿ã¼ã¨ã³ããã¤ã³ãã«æ¥ç¶ãç¶ãã¾ãããã ããã§ã¤ã«ãªã¼ãã¼ä¸ã«æ¸ãè¾¼ã¿ãã¦ããã³ãã¯ã·ã§ã³ã¯å¤±ããã¾ãã
2023-07-09T17:16:36.030+09:00 INFO 26316 --- [nio-8080-exec-6] c.b.j.controller.ShopController : saved shop.(id = 27420)
2023-07-09T17:16:48.181+09:00 WARN 26316 --- [nio-8080-exec-3] com.zaxxer.hikari.pool.ProxyConnection : HikariPool-1 - Connection software.aws.rds.jdbc.mysql.shading.com.mysql.cj.jdbc.ConnectionImpl@28814a75 marked as broken because of SQLSTATE(08007), ErrorCode(0)
java.sql.SQLException: Transaction resolution unknown. Please re-configure session state if required and try restarting transaction.
2023-07-09T17:16:48.204+09:00 ERROR 26316 --- [nio-8080-exec-3] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed: org.springframework.orm.jpa.JpaSystemException: Unable to commit against JDBC Connection] with root cause
java.sql.SQLException: Transaction resolution unknown. Please re-configure session state if required and try restarting transaction.
2023-07-09T17:16:48.645+09:00 WARN 26316 --- [nio-8080-exec-7] com.zaxxer.hikari.pool.ProxyConnection : HikariPool-1 - Connection software.aws.rds.jdbc.mysql.shading.com.mysql.cj.jdbc.ConnectionImpl@61d94a02 marked as broken because of SQLSTATE(08S02), ErrorCode(0)
java.sql.SQLException: The active SQL connection has changed due to a connection failure. Please re-configure session state if required.
2023-07-09T17:16:50.323+09:00 WARN 26316 --- [nio-8080-exec-2] com.zaxxer.hikari.pool.PoolBase : HikariPool-1 - Failed to validate connection software.aws.rds.jdbc.mysql.shading.com.mysql.cj.jdbc.ConnectionImpl@7708a0c5 (The active SQL connection has changed due to a connection failure. Please re-configure session state if required.). Possibly consider using a shorter maxLifetime value.
2023-07-09T17:16:50.763+09:00 WARN 26316 --- [io-8080-exec-10] com.zaxxer.hikari.pool.PoolBase : HikariPool-1 - Failed to validate connection software.aws.rds.jdbc.mysql.shading.com.mysql.cj.jdbc.ConnectionImpl@540afcc8 (The active SQL connection has changed due to a connection failure. Please re-configure session state if required.). Possibly consider using a shorter maxLifetime value.
2023-07-09T17:16:52.421+09:00 WARN 26316 --- [nio-8080-exec-2] com.zaxxer.hikari.pool.PoolBase : HikariPool-1 - Failed to validate connection software.aws.rds.jdbc.mysql.shading.com.mysql.cj.jdbc.ConnectionImpl@33480b36 (The active SQL connection has changed due to a connection failure. Please re-configure session state if required.). Possibly consider using a shorter maxLifetime value.
2023-07-09T17:16:52.845+09:00 WARN 26316 --- [io-8080-exec-10] com.zaxxer.hikari.pool.PoolBase : HikariPool-1 - Failed to validate connection software.aws.rds.jdbc.mysql.shading.com.mysql.cj.jdbc.ConnectionImpl@7a3aa305 (The active SQL connection has changed due to a connection failure. Please re-configure session state if required.). Possibly consider using a shorter maxLifetime value.
2023-07-09T17:16:54.516+09:00 WARN 26316 --- [nio-8080-exec-2] com.zaxxer.hikari.pool.PoolBase : HikariPool-1 - Failed to validate connection software.aws.rds.jdbc.mysql.shading.com.mysql.cj.jdbc.ConnectionImpl@2adac41f (The active SQL connection has changed due to a connection failure. Please re-configure session state if required.). Possibly consider using a shorter maxLifetime value.
2023-07-09T17:16:54.929+09:00 WARN 26316 --- [io-8080-exec-10] com.zaxxer.hikari.pool.PoolBase : HikariPool-1 - Failed to validate connection software.aws.rds.jdbc.mysql.shading.com.mysql.cj.jdbc.ConnectionImpl@4f352185 (The active SQL connection has changed due to a connection failure. Please re-configure session state if required.). Possibly consider using a shorter maxLifetime value.
2023-07-09T17:16:56.601+09:00 WARN 26316 --- [nio-8080-exec-2] com.zaxxer.hikari.pool.PoolBase : HikariPool-1 - Failed to validate connection software.aws.rds.jdbc.mysql.shading.com.mysql.cj.jdbc.ConnectionImpl@23c98d1f (The active SQL connection has changed due to a connection failure. Please re-configure session state if required.). Possibly consider using a shorter maxLifetime value.
2023-07-09T17:16:56.641+09:00 INFO 26316 --- [nio-8080-exec-2] c.b.j.controller.ShopController : saved shop.(id = 27421)
Amazon Web Services (AWS) JDBC Driverã¯ãé²åããJDBC wrapperã¨ãã¦åè¨è¨ããã¾ããããã®wrapperã¯ãAmazon Auroraã®ãããªã¯ã©ã¹ã¿ãªã³ã°ããããã¼ã¿ãã¼ã¹ã®æ©è½ãæ´»ç¨ããã¢ããªã±ã¼ã·ã§ã³ããµãã¼ãããããã«åå¨ããJDBCãã©ã¤ãã¼ãæ©è½æ¡å¼µãããã®ã§ããAWS JDBC Driverã¯ããã¤ãã®ãã¼ã¿ãã¼ã¹èªèº«ã«æ¥ç¶ããå®è£
ã¯ãã¦ããªãã§ãããã¦ã¼ã¶ãé¸æãã¦ããJDBCãã©ã¤ãã¼ãAWSãAuroraã®æ©è½æ§ããµãã¼ããæå¹ã«ã§ãã¾ãã
詳ãããã¨ã¯ãå
¬å¼ããã¥ã¡ã³ããåç
§ãã¦ãã ããã
ã¢ããªã±ã¼ã·ã§ã³ã®è¨å®
application.yml
spring:
datasource:
url: jdbc:aws-wrapper:mysql://${ã¯ã©ã¹ã¿ã¼ã¨ã³ããã¤ã³ã}/test_db
driver-class-name: software.amazon.jdbc.Driver
hikari:
data-source-properties:
wrapperPlugins: readWriteSplitting,failover,efm
failoverMode: reader-or-writer
exception-override-class-name: software.amazon.jdbc.util.HikariCPSQLException
logging:
level:
software.amazon.jdbc.Driver: trace
software.amazon.jdbc.plugin.readwritesplitting: trace
software.amazon.jdbc.plugin.staledns: trace
software.amazon.jdbc.plugin.failover: trace
build.gradle
dependencies {
implementation 'software.amazon.jdbc:aws-advanced-jdbc-wrapper:2.2.2'
runtimeOnly 'com.mysql:mysql-connector-j'
}
ãã§ã¤ã«ãªã¼ãã¼å®è¡
ã¯ã©ã¹ã¿ã¼ã¨ã³ããã¤ã³ããæå®ããã ãã§ãã©ã¤ã¿ã¼ã¤ã³ã¹ã¿ã³ã¹ã¨ã³ããã¤ã³ãã¨ãªã¼ãã¼ã¤ã³ã¹ã¿ã³ã¹ã¨ã³ããã¤ã³ããæ¤åºãã¦ããã¾ãã
é£ç¶çã«ãã¼ã¿æ¸ãè¾¼ã¿&èªã¿è¾¼ã¿ç¨ã¨ã³ããã¤ã³ããå©ãä¸ã®ãã°ãè¦ãã¨ãReadOnlyã®ã³ãã¯ã·ã§ã³ã¯Readerã«æ¥ç¶ãã¦ãããã¨ããããã¾ããã念ã®çºãCloudWatchã¡ããªã¯ã¹ã§DatabaseConnectionsãè¦ã¦ã¿ã¾ããããã¡ããã¨Readerã«æ¥ç¶ããã¦ãã¾ããã
ãã§ã¤ã«ãªã¼ãã¼éå§ããå®äºã¾ã§ã»ã¼ãã¦ã³ã¿ã¤ã ãçºçããªããã¨ããããã¾ããã
> Task :bootRun
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v3.1.0)
2023-07-05T00:32:43.445+09:00 TRACE 44369 --- [ main] software.amazon.jdbc.Driver : Opening connection to jdbc:aws-wrapper:mysql://${ã¯ã©ã¹ã¿ã¼ã¨ã³ããã¤ã³ã}/test_db
2023-07-05T00:32:43.509+09:00 DEBUG 44369 --- [ main] s.a.j.p.f.FailoverConnectionPlugin : failoverMode=READER_OR_WRITER
2023-07-05T00:32:43.513+09:00 TRACE 44369 --- [ main] s.a.j.p.f.FailoverConnectionPlugin : Changes:
Host '${ã¯ã©ã¹ã¿ã¼ã¨ã³ããã¤ã³ã}/': [NODE_ADDED]
2023-07-05T00:32:43.971+09:00 TRACE 44369 --- [ main] s.a.j.p.staledns.AuroraStaleDnsHelper : Cluster endpoint resolves to x.x.x.x.
2023-07-05T00:32:43.986+09:00 TRACE 44369 --- [ main] s.a.j.p.f.FailoverConnectionPlugin : Changes:
Host '${ã¯ã©ã¹ã¿ã¼ã¨ã³ããã¤ã³ã}': [NODE_DELETED]
Host '${ãªã¼ãã¼ã¤ã³ã¹ã¿ã³ã¹ã¨ã³ããã¤ã³ã}': [NODE_ADDED]
Host '${ã©ã¤ã¿ã¼ã¤ã³ã¹ã¿ã³ã¹ã¨ã³ããã¤ã³ã}': [NODE_ADDED]
2023-07-05T00:32:43.988+09:00 TRACE 44369 --- [ main] s.a.j.p.staledns.AuroraStaleDnsHelper : Topology:
HostSpec[host=${ãªã¼ãã¼ã¤ã³ã¹ã¿ã³ã¹ã¨ã³ããã¤ã³ã}, port=-1, READER, AVAILABLE, weight=2450, 2023-07-04 15:32:44.108693]
HostSpec[host=${ã©ã¤ã¿ã¼ã¤ã³ã¹ã¿ã³ã¹ã¨ã³ããã¤ã³ã}, port=-1, WRITER, AVAILABLE, weight=4, 2023-07-04 15:32:43.890895]
2023-07-05T00:32:43.989+09:00 TRACE 44369 --- [ main] s.a.j.p.staledns.AuroraStaleDnsHelper : Writer host: HostSpec[host=${ã©ã¤ã¿ã¼ã¤ã³ã¹ã¿ã³ã¹ã¨ã³ããã¤ã³ã}, port=-1, WRITER, AVAILABLE, weight=4, 2023-07-04 15:32:43.890895]
2023-07-05T00:32:43.991+09:00 TRACE 44369 --- [ main] s.a.j.p.staledns.AuroraStaleDnsHelper : Writer host address: x.x.x.x
2023-07-05T00:32:43.998+09:00 TRACE 44369 --- [ main] s.a.j.p.r.ReadWriteSplittingPlugin : Writer connection set to '${ã¯ã©ã¹ã¿ã¼ã¨ã³ããã¤ã³ã}'
2023-07-05T00:32:44.027+09:00 INFO 44369 --- [ main] com.zaxxer.hikari.pool.HikariPool : HikariPool-1 - Added connection software.amazon.jdbc.wrapper.ConnectionWrapper@53a50b0a - com.mysql.cj.jdbc.ConnectionImpl@74ba6ff5
2023-07-05T00:32:44.029+09:00 INFO 44369 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed.
2023-07-05T00:32:44.068+09:00 INFO 44369 --- [ main] o.f.c.i.database.base.BaseDatabaseType : Database: jdbc:mysql://${ã¯ã©ã¹ã¿ã¼ã¨ã³ããã¤ã³ã}/test_db (MySQL 8.0)
2023-07-05T00:32:44.131+09:00 TRACE 44369 --- [onnection adder] software.amazon.jdbc.Driver : Opening connection to jdbc:aws-wrapper:mysql://${ã¯ã©ã¹ã¿ã¼ã¨ã³ããã¤ã³ã}/test_db
2023-07-05T00:32:44.132+09:00 DEBUG 44369 --- [onnection adder] s.a.j.p.f.FailoverConnectionPlugin : failoverMode=READER_OR_WRITER
2023-07-05T00:32:44.133+09:00 TRACE 44369 --- [onnection adder] s.a.j.p.f.FailoverConnectionPlugin : Changes:
Host '${ãªã¼ãã¼ã¤ã³ã¹ã¿ã³ã¹ã¨ã³ããã¤ã³ã}': [NODE_ADDED]
Host '${ã©ã¤ã¿ã¼ã¤ã³ã¹ã¿ã³ã¹ã¨ã³ããã¤ã³ã}': [NODE_ADDED]
2023-07-05T00:32:44.217+09:00 TRACE 44369 --- [onnection adder] s.a.j.p.staledns.AuroraStaleDnsHelper : Cluster endpoint resolves to x.x.x.x.
2023-07-05T00:32:44.218+09:00 INFO 44369 --- [ main] o.f.core.internal.command.DbValidate : Successfully validated 1 migration (execution time 00:00.067s)
2023-07-05T00:32:44.224+09:00 TRACE 44369 --- [onnection adder] s.a.j.p.staledns.AuroraStaleDnsHelper : Topology:
HostSpec[host=${ãªã¼ãã¼ã¤ã³ã¹ã¿ã³ã¹ã¨ã³ããã¤ã³ã}, port=-1, READER, AVAILABLE, weight=2450, 2023-07-04 15:32:44.108693]
HostSpec[host=${ã©ã¤ã¿ã¼ã¤ã³ã¹ã¿ã³ã¹ã¨ã³ããã¤ã³ã}, port=-1, WRITER, AVAILABLE, weight=4, 2023-07-04 15:32:43.890895]
2023-07-05T00:32:44.225+09:00 TRACE 44369 --- [onnection adder] s.a.j.p.staledns.AuroraStaleDnsHelper : Writer host: HostSpec[host=${ã©ã¤ã¿ã¼ã¤ã³ã¹ã¿ã³ã¹ã¨ã³ããã¤ã³ã}, port=-1, WRITER, AVAILABLE, weight=4, 2023-07-04 15:32:43.890895]
2023-07-05T00:32:44.225+09:00 TRACE 44369 --- [onnection adder] s.a.j.p.staledns.AuroraStaleDnsHelper : Writer host address: x.x.x.x
2023-07-05T00:32:44.231+09:00 TRACE 44369 --- [onnection adder] s.a.j.p.r.ReadWriteSplittingPlugin : Writer connection set to '${ã¯ã©ã¹ã¿ã¼ã¨ã³ããã¤ã³ã}'
2023-07-05T00:32:44.248+09:00 TRACE 44369 --- [onnection adder] software.amazon.jdbc.Driver : Opening connection to jdbc:aws-wrapper:mysql://${ã¯ã©ã¹ã¿ã¼ã¨ã³ããã¤ã³ã}/test_db
2023-07-05T00:32:44.249+09:00 DEBUG 44369 --- [onnection adder] s.a.j.p.f.FailoverConnectionPlugin : failoverMode=READER_OR_WRITER
2023-07-05T00:32:44.250+09:00 TRACE 44369 --- [onnection adder] s.a.j.p.f.FailoverConnectionPlugin : Changes:
Host '${ãªã¼ãã¼ã¤ã³ã¹ã¿ã³ã¹ã¨ã³ããã¤ã³ã}': [NODE_ADDED]
Host '${ã©ã¤ã¿ã¼ã¤ã³ã¹ã¿ã³ã¹ã¨ã³ããã¤ã³ã}': [NODE_ADDED]
# é£ç¶çã«ãã¼ã¿æ¸ãè¾¼ã¿&èªã¿è¾¼ã¿ç¨ã¨ã³ããã¤ã³ããå©ãä¸
2023-07-05T00:32:58.666+09:00 INFO 44369 --- [nio-8080-exec-4] c.b.j.controller.ShopController : saved shop.(id = 22272)
2023-07-05T00:32:58.704+09:00 INFO 44369 --- [nio-8080-exec-6] c.b.j.controller.ShopController : saved shop.(id = 22273)
2023-07-05T00:32:58.737+09:00 TRACE 44369 --- [nio-8080-exec-8] s.a.j.p.r.ReadWriteSplittingPlugin : Successfully connected to a new reader host: ${ãªã¼ãã¼ã¤ã³ã¹ã¿ã³ã¹ã¨ã³ããã¤ã³ã}'
2023-07-05T00:32:58.738+09:00 TRACE 44369 --- [nio-8080-exec-8] s.a.j.p.r.ReadWriteSplittingPlugin : Reader connection set to '${ãªã¼ãã¼ã¤ã³ã¹ã¿ã³ã¹ã¨ã³ããã¤ã³ã}'
2023-07-05T00:32:58.744+09:00 INFO 44369 --- [nio-8080-exec-9] c.b.j.controller.ShopController : saved shop.(id = 22274)
2023-07-05T00:32:58.753+09:00 TRACE 44369 --- [nio-8080-exec-8] s.a.j.p.r.ReadWriteSplittingPlugin : Reader connection set to '${ãªã¼ãã¼ã¤ã³ã¹ã¿ã³ã¹ã¨ã³ããã¤ã³ã}'
2023-07-05T00:32:58.754+09:00 TRACE 44369 --- [nio-8080-exec-8] s.a.j.p.r.ReadWriteSplittingPlugin : Setting the current connection to '${ãªã¼ãã¼ã¤ã³ã¹ã¿ã³ã¹ã¨ã³ããã¤ã³ã}'
2023-07-05T00:32:58.755+09:00 DEBUG 44369 --- [nio-8080-exec-8] s.a.j.p.r.ReadWriteSplittingPlugin : Switched from a writer to a reader host. New reader host: '${ãªã¼ãã¼ã¤ã³ã¹ã¿ã³ã¹ã¨ã³ããã¤ã³ã}'
2023-07-05T00:32:58.782+09:00 INFO 44369 --- [nio-8080-exec-1] c.b.j.controller.ShopController : saved shop.(id = 22275)
2023-07-05T00:32:58.822+09:00 INFO 44369 --- [nio-8080-exec-3] c.b.j.controller.ShopController : saved shop.(id = 22276)
2023-07-05T00:32:58.860+09:00 INFO 44369 --- [nio-8080-exec-5] c.b.j.controller.ShopController : saved shop.(id = 22277)
2023-07-05T00:32:58.900+09:00 INFO 44369 --- [nio-8080-exec-7] c.b.j.controller.ShopController : saved shop.(id = 22278)
2023-07-05T00:32:58.961+09:00 INFO 44369 --- [io-8080-exec-10] c.b.j.controller.ShopController : saved shop.(id = 22279)
2023-07-05T00:32:59.010+09:00 INFO 44369 --- [nio-8080-exec-2] c.b.j.controller.ShopController : saved shop.(id = 22280)
2023-07-05T00:32:59.020+09:00 TRACE 44369 --- [nio-8080-exec-8] s.a.j.p.r.ReadWriteSplittingPlugin : Writer connection set to '${ã©ã¤ã¿ã¼ã¤ã³ã¹ã¿ã³ã¹ã¨ã³ããã¤ã³ã}'
2023-07-05T00:32:59.020+09:00 TRACE 44369 --- [nio-8080-exec-8] s.a.j.p.r.ReadWriteSplittingPlugin : Setting the current connection to '${ã©ã¤ã¿ã¼ã¤ã³ã¹ã¿ã³ã¹ã¨ã³ããã¤ã³ã}'
2023-07-05T00:32:59.020+09:00 DEBUG 44369 --- [nio-8080-exec-8] s.a.j.p.r.ReadWriteSplittingPlugin : Switched from a reader to a writer host. New writer host: '${ã©ã¤ã¿ã¼ã¤ã³ã¹ã¿ã³ã¹ã¨ã³ããã¤ã³ã}'
2023-07-05T00:33:33.372+09:00 INFO 44369 --- [nio-8080-exec-5] c.b.j.controller.ShopController : saved shop.(id = 23087)
2023-07-05T00:33:33.387+09:00 DEBUG 44369 --- [nio-8080-exec-6] s.a.j.p.f.FailoverConnectionPlugin : Detected an exception while executing a command: Communications link failure
The last packet successfully received from the server was 124 milliseconds ago. The last packet sent successfully to the server was 137 milliseconds ago.
2023-07-05T00:33:33.387+09:00 TRACE 44369 --- [nio-8080-exec-6] s.a.j.p.f.FailoverConnectionPlugin : Changes:
Host '${ãã§ã¤ã«ãªã¼ãã¼åã®ãªã¼ãã¼ã¤ã³ã¹ã¿ã³ã¹ã¨ã³ããã¤ã³ã}': [WENT_DOWN, NODE_CHANGED]
2023-07-05T00:33:33.388+09:00 DEBUG 44369 --- [nio-8080-exec-6] s.a.j.p.f.FailoverConnectionPlugin : Starting reader failover procedure.
2023-07-05T00:33:33.390+09:00 DEBUG 44369 --- [pool-4-thread-1] .j.p.f.ClusterAwareReaderFailoverHandler : Trying to connect to reader: '${ãã§ã¤ã«ãªã¼ãã¼åã®ã©ã¤ã¿ã¼ã¤ã³ã¹ã¿ã³ã¹ã¨ã³ããã¤ã³ã}', with properties '{failoverMode=reader-or-writer, password=rootroot, database=test_db, wrapperPlugins=readWriteSplitting,failover,efm, user=root}'
2023-07-05T00:33:33.390+09:00 DEBUG 44369 --- [pool-4-thread-2] .j.p.f.ClusterAwareReaderFailoverHandler : Trying to connect to reader: '${ãã§ã¤ã«ãªã¼ãã¼åã®ãªã¼ãã¼ã¤ã³ã¹ã¿ã³ã¹ã¨ã³ããã¤ã³ã}', with properties '{failoverMode=reader-or-writer, password=rootroot, database=test_db, wrapperPlugins=readWriteSplitting,failover,efm, user=root}'
2023-07-05T00:33:33.416+09:00 INFO 44369 --- [nio-8080-exec-2] c.b.j.controller.ShopController : saved shop.(id = 23088)
2023-07-05T00:33:33.455+09:00 INFO 44369 --- [nio-8080-exec-9] c.b.j.controller.ShopController : saved shop.(id = 23089)
2023-07-05T00:33:33.463+09:00 DEBUG 44369 --- [pool-4-thread-1] .j.p.f.ClusterAwareReaderFailoverHandler : Connected to reader: '${ãã§ã¤ã«ãªã¼ãã¼åã®ã©ã¤ã¿ã¼ã¤ã³ã¹ã¿ã³ã¹ã¨ã³ããã¤ã³ã}'
2023-07-05T00:33:33.463+09:00 DEBUG 44369 --- [pool-4-thread-1] .j.p.f.ClusterAwareReaderFailoverHandler : New reader connection object: com.mysql.cj.jdbc.ConnectionImpl@1312cce0
2023-07-05T00:33:33.464+09:00 TRACE 44369 --- [nio-8080-exec-6] s.a.j.p.r.ReadWriteSplittingPlugin : Writer connection set to '${ãã§ã¤ã«ãªã¼ãã¼åã®ã©ã¤ã¿ã¼ã¤ã³ã¹ã¿ã³ã¹ã¨ã³ããã¤ã³ã}'
2023-07-05T00:33:33.471+09:00 DEBUG 44369 --- [nio-8080-exec-6] s.a.j.p.f.FailoverConnectionPlugin : Connected to: HostSpec[host=${ãã§ã¤ã«ãªã¼ãã¼åã®ã©ã¤ã¿ã¼ã¤ã³ã¹ã¿ã³ã¹ã¨ã³ããã¤ã³ã} port=-1, WRITER, AVAILABLE, weight=4, 2023-07-04 15:32:43.890895]
2023-07-05T00:33:33.472+09:00 ERROR 44369 --- [nio-8080-exec-6] s.a.j.p.f.FailoverConnectionPlugin : The active SQL connection has changed due to a connection failure. Please re-configure session state if required.
2023-07-05T00:33:33.475+09:00 WARN 44369 --- [nio-8080-exec-6] o.h.engine.jdbc.spi.SqlExceptionHelper : SQL Error: 0, SQLState: 08S02
2023-07-05T00:33:33.475+09:00 ERROR 44369 --- [nio-8080-exec-6] o.h.engine.jdbc.spi.SqlExceptionHelper : The active SQL connection has changed due to a connection failure. Please re-configure session state if required.
2023-07-05T00:33:33.482+09:00 DEBUG 44369 --- [nio-8080-exec-6] s.a.j.p.f.FailoverConnectionPlugin : Detected an exception while executing a command: Can't call rollback when autocommit=true
2023-07-05T00:33:33.483+09:00 TRACE 44369 --- [nio-8080-exec-6] s.a.j.p.f.FailoverConnectionPlugin : Changes:
Host '${ãã§ã¤ã«ãªã¼ãã¼åã®ã©ã¤ã¿ã¼ã¤ã³ã¹ã¿ã³ã¹ã¨ã³ããã¤ã³ã}': [WENT_DOWN, NODE_CHANGED]
2023-07-05T00:33:33.483+09:00 DEBUG 44369 --- [nio-8080-exec-6] s.a.j.p.f.FailoverConnectionPlugin : Starting reader failover procedure.
2023-07-05T00:33:33.484+09:00 DEBUG 44369 --- [pool-6-thread-1] .j.p.f.ClusterAwareReaderFailoverHandler : Trying to connect to reader: '${ãã§ã¤ã«ãªã¼ãã¼åã®ã©ã¤ã¿ã¼ã¤ã³ã¹ã¿ã³ã¹ã¨ã³ããã¤ã³ã}', with properties '{failoverMode=reader-or-writer, password=rootroot, database=test_db, wrapperPlugins=readWriteSplitting,failover,efm, user=root}'
2023-07-05T00:33:33.484+09:00 DEBUG 44369 --- [pool-6-thread-2] .j.p.f.ClusterAwareReaderFailoverHandler : Trying to connect to reader: '${ãã§ã¤ã«ãªã¼ãã¼åã®ãªã¼ãã¼ã¤ã³ã¹ã¿ã³ã¹ã¨ã³ããã¤ã³ã}', with properties '{failoverMode=reader-or-writer, password=rootroot, database=test_db, wrapperPlugins=readWriteSplitting,failover,efm, user=root}'
2023-07-05T00:33:33.499+09:00 INFO 44369 --- [nio-8080-exec-8] c.b.j.controller.ShopController : saved shop.(id = 23090)
2023-07-05T00:33:33.515+09:00 DEBUG 44369 --- [pool-6-thread-2] .j.p.f.ClusterAwareReaderFailoverHandler : Failed to connect to reader: '${ãã§ã¤ã«ãªã¼ãã¼åã®ãªã¼ãã¼ã¤ã³ã¹ã¿ã³ã¹ã¨ã³ããã¤ã³ã}'
2023-07-05T00:33:33.517+09:00 DEBUG 44369 --- [pool-4-thread-2] .j.p.f.ClusterAwareReaderFailoverHandler : Failed to connect to reader: '${ãã§ã¤ã«ãªã¼ãã¼åã®ãªã¼ãã¼ã¤ã³ã¹ã¿ã³ã¹ã¨ã³ããã¤ã³ã}'
2023-07-05T00:33:33.536+09:00 TRACE 44369 --- [pool-6-thread-1] s.a.j.p.f.FailoverConnectionPlugin : Changes:
Host '${ãã§ã¤ã«ãªã¼ãã¼åã®ã©ã¤ã¿ã¼ã¤ã³ã¹ã¿ã³ã¹ã¨ã³ããã¤ã³ã}': [WENT_UP, NODE_CHANGED]
2023-07-05T00:33:33.537+09:00 DEBUG 44369 --- [pool-6-thread-1] .j.p.f.ClusterAwareReaderFailoverHandler : Connected to reader: '${ãã§ã¤ã«ãªã¼ãã¼åã®ã©ã¤ã¿ã¼ã¤ã³ã¹ã¿ã³ã¹ã¨ã³ããã¤ã³ã}'
2023-07-05T00:33:33.537+09:00 DEBUG 44369 --- [pool-6-thread-1] .j.p.f.ClusterAwareReaderFailoverHandler : New reader connection object: com.mysql.cj.jdbc.ConnectionImpl@55e4bfde
2023-07-05T00:33:33.537+09:00 TRACE 44369 --- [nio-8080-exec-6] s.a.j.p.r.ReadWriteSplittingPlugin : Writer connection set to '${ãã§ã¤ã«ãªã¼ãã¼åã®ã©ã¤ã¿ã¼ã¤ã³ã¹ã¿ã³ã¹ã¨ã³ããã¤ã³ã}'
2023-07-05T00:33:33.538+09:00 INFO 44369 --- [nio-8080-exec-1] c.b.j.controller.ShopController : saved shop.(id = 23091)
2023-07-05T00:33:33.542+09:00 DEBUG 44369 --- [nio-8080-exec-6] s.a.j.p.f.FailoverConnectionPlugin : Connected to: HostSpec[host=${ãã§ã¤ã«ãªã¼ãã¼åã®ã©ã¤ã¿ã¼ã¤ã³ã¹ã¿ã³ã¹ã¨ã³ããã¤ã³ã}, port=-1, WRITER, AVAILABLE, weight=4, 2023-07-04 15:32:43.890895]
2023-07-05T00:33:33.542+09:00 ERROR 44369 --- [nio-8080-exec-6] s.a.j.p.f.FailoverConnectionPlugin : The active SQL connection has changed due to a connection failure. Please re-configure session state if required.
2023-07-05T00:33:33.548+09:00 ERROR 44369 --- [nio-8080-exec-6] o.s.t.i.TransactionInterceptor : Application exception overridden by rollback exception
2023-07-05T00:33:33.581+09:00 INFO 44369 --- [nio-8080-exec-3] c.b.j.controller.ShopController : saved shop.(id = 23092)
2023-07-05T00:33:33.620+09:00 WARN 44369 --- [nio-8080-exec-9] s.a.j.p.r.ReadWriteSplittingPlugin : Failed to connect to reader host: '${ãã§ã¤ã«ãªã¼ãã¼åã®ãªã¼ãã¼ã¤ã³ã¹ã¿ã³ã¹ã¨ã³ããã¤ã³ã}'
2023-07-05T00:33:33.623+09:00 INFO 44369 --- [nio-8080-exec-4] c.b.j.controller.ShopController : saved shop.(id = 23093)
2023-07-05T00:33:33.628+09:00 WARN 44369 --- [nio-8080-exec-9] s.a.j.p.r.ReadWriteSplittingPlugin : Failed to connect to reader host: '${ãã§ã¤ã«ãªã¼ãã¼åã®ãªã¼ãã¼ã¤ã³ã¹ã¿ã³ã¹ã¨ã³ããã¤ã³ã}'
# ãã§ã¤ã«ãªã¼ãã¼å®äºå¾
2023-07-05T00:33:39.373+09:00 TRACE 44369 --- [ool-11-thread-2] s.a.j.p.f.FailoverConnectionPlugin : Changes:
Host '${ãã§ã¤ã«ãªã¼ãã¼åã®ã©ã¤ã¿ã¼ã¤ã³ã¹ã¿ã³ã¹ã¨ã³ããã¤ã³ã}': [WENT_UP, NODE_CHANGED]
2023-07-05T00:33:39.374+09:00 DEBUG 44369 --- [ool-11-thread-2] .j.p.f.ClusterAwareReaderFailoverHandler : Connected to reader: '${ãã§ã¤ã«ãªã¼ãã¼åã®ã©ã¤ã¿ã¼ã¤ã³ã¹ã¿ã³ã¹ã¨ã³ããã¤ã³ã}'
2023-07-05T00:33:39.374+09:00 DEBUG 44369 --- [ool-11-thread-2] .j.p.f.ClusterAwareReaderFailoverHandler : New reader connection object: com.mysql.cj.jdbc.ConnectionImpl@5d8bcb8e
2023-07-05T00:33:39.374+09:00 TRACE 44369 --- [nio-8080-exec-8] s.a.j.p.r.ReadWriteSplittingPlugin : Reader connection set to '${ãã§ã¤ã«ãªã¼ãã¼åã®ã©ã¤ã¿ã¼ã¤ã³ã¹ã¿ã³ã¹ã¨ã³ããã¤ã³ã}'
2023-07-05T00:33:39.384+09:00 TRACE 44369 --- [nio-8080-exec-8] s.a.j.p.f.FailoverConnectionPlugin : Changes:
Host '${ãã§ã¤ã«ãªã¼ãã¼åã®ãªã¼ãã¼ã¤ã³ã¹ã¿ã³ã¹ã¨ã³ããã¤ã³ã}': [PROMOTED_TO_WRITER, NODE_CHANGED]
Host '${ãã§ã¤ã«ãªã¼ãã¼åã®ã©ã¤ã¿ã¼ã¤ã³ã¹ã¿ã³ã¹ã¨ã³ããã¤ã³ã}': [NODE_DELETED]
2023-07-05T00:33:39.384+09:00 DEBUG 44369 --- [nio-8080-exec-8] s.a.j.p.f.FailoverConnectionPlugin : Connected to: HostSpec[host=${ãã§ã¤ã«ãªã¼ãã¼åã®ãªã¼ãã¼ã¤ã³ã¹ã¿ã³ã¹ã¨ã³ããã¤ã³ã}, port=-1, READER, AVAILABLE, weight=2450, 2023-07-04 15:32:44.108693]
2023-07-05T00:33:39.384+09:00 ERROR 44369 --- [nio-8080-exec-8] s.a.j.p.f.FailoverConnectionPlugin : The active SQL connection has changed due to a connection failure. Please re-configure session state if required.
2023-07-05T00:33:39.387+09:00 DEBUG 44369 --- [nio-8080-exec-8] s.a.j.p.f.FailoverConnectionPlugin : Detected an exception while executing a command: Can't call rollback when autocommit=true
2023-07-05T00:33:39.388+09:00 TRACE 44369 --- [nio-8080-exec-8] s.a.j.p.f.FailoverConnectionPlugin : Changes:
Host '${ãã§ã¤ã«ãªã¼ãã¼åã®ã©ã¤ã¿ã¼ã¤ã³ã¹ã¿ã³ã¹ã¨ã³ããã¤ã³ã}': [WENT_DOWN, NODE_CHANGED]
2023-07-05T00:33:39.388+09:00 DEBUG 44369 --- [nio-8080-exec-8] s.a.j.p.f.FailoverConnectionPlugin : Starting reader failover procedure.
2023-07-05T00:33:39.389+09:00 DEBUG 44369 --- [ool-14-thread-1] .j.p.f.ClusterAwareReaderFailoverHandler : Trying to connect to reader: '${ãã§ã¤ã«ãªã¼ãã¼åã®ã©ã¤ã¿ã¼ã¤ã³ã¹ã¿ã³ã¹ã¨ã³ããã¤ã³ã}', with properties '{failoverMode=reader-or-writer, password=rootroot, database=test_db, wrapperPlugins=readWriteSplitting,failover,efm, user=root}'
2023-07-05T00:33:39.391+09:00 DEBUG 44369 --- [ool-12-thread-2] .j.p.f.ClusterAwareReaderFailoverHandler : Connected to reader: '${ãã§ã¤ã«ãªã¼ãã¼åã®ã©ã¤ã¿ã¼ã¤ã³ã¹ã¿ã³ã¹ã¨ã³ããã¤ã³ã}'
2023-07-05T00:33:39.391+09:00 DEBUG 44369 --- [ool-12-thread-2] .j.p.f.ClusterAwareReaderFailoverHandler : New reader connection object: com.mysql.cj.jdbc.ConnectionImpl@6db7986c
2023-07-05T00:33:39.392+09:00 TRACE 44369 --- [io-8080-exec-10] s.a.j.p.r.ReadWriteSplittingPlugin : Reader connection set to '${ãã§ã¤ã«ãªã¼ãã¼åã®ã©ã¤ã¿ã¼ã¤ã³ã¹ã¿ã³ã¹ã¨ã³ããã¤ã³ã}'
2023-07-05T00:33:39.398+09:00 TRACE 44369 --- [io-8080-exec-10] s.a.j.p.f.FailoverConnectionPlugin : Changes:
Host '${ãã§ã¤ã«ãªã¼ãã¼åã®ãªã¼ãã¼ã¤ã³ã¹ã¿ã³ã¹ã¨ã³ããã¤ã³ã}': [PROMOTED_TO_WRITER, NODE_CHANGED]
Host '${ãã§ã¤ã«ãªã¼ãã¼åã®ã©ã¤ã¿ã¼ã¤ã³ã¹ã¿ã³ã¹ã¨ã³ããã¤ã³ã}': [NODE_DELETED]
2023-07-05T00:33:39.398+09:00 DEBUG 44369 --- [io-8080-exec-10] s.a.j.p.f.FailoverConnectionPlugin : Connected to: HostSpec[host=${ãã§ã¤ã«ãªã¼ãã¼åã®ãªã¼ãã¼ã¤ã³ã¹ã¿ã³ã¹ã¨ã³ããã¤ã³ã}, port=-1, READER, AVAILABLE, weight=2450, 2023-07-04 15:32:44.108693]
2023-07-05T00:33:39.398+09:00 ERROR 44369 --- [io-8080-exec-10] s.a.j.p.f.FailoverConnectionPlugin : The active SQL connection has changed due to a connection failure. Please re-configure session state if required.
2023-07-05T00:33:39.399+09:00 DEBUG 44369 --- [io-8080-exec-10] s.a.j.p.r.ReadWriteSplittingPlugin : Detected a failover exception while executing a command: 'Connection.setReadOnly'
2023-07-05T00:33:39.399+09:00 TRACE 44369 --- [io-8080-exec-10] s.a.j.p.r.ReadWriteSplittingPlugin : Closing all internal connections except for the current one.
2023-07-05T00:33:39.444+09:00 TRACE 44369 --- [ool-14-thread-1] s.a.j.p.f.FailoverConnectionPlugin : Changes:
Host '${ãã§ã¤ã«ãªã¼ãã¼åã®ãªã¼ãã¼ã¤ã³ã¹ã¿ã³ã¹ã¨ã³ããã¤ã³ã}': [WENT_UP, NODE_CHANGED]
2023-07-05T00:33:39.445+09:00 DEBUG 44369 --- [ool-14-thread-1] .j.p.f.ClusterAwareReaderFailoverHandler : Connected to reader: '${ãã§ã¤ã«ãªã¼ãã¼åã®ãªã¼ãã¼ã¤ã³ã¹ã¿ã³ã¹ã¨ã³ããã¤ã³ã}'
2023-07-05T00:33:39.445+09:00 DEBUG 44369 --- [ool-14-thread-1] .j.p.f.ClusterAwareReaderFailoverHandler : New reader connection object: com.mysql.cj.jdbc.ConnectionImpl@4cadd5e1
2023-07-05T00:33:39.446+09:00 TRACE 44369 --- [nio-8080-exec-8] s.a.j.p.r.ReadWriteSplittingPlugin : Writer connection set to '${ãã§ã¤ã«ãªã¼ãã¼åã®ãªã¼ãã¼ã¤ã³ã¹ã¿ã³ã¹ã¨ã³ããã¤ã³ã}'
2023-07-05T00:33:39.451+09:00 DEBUG 44369 --- [nio-8080-exec-8] s.a.j.p.f.FailoverConnectionPlugin : Connected to: HostSpec[host=${ãã§ã¤ã«ãªã¼ãã¼åã®ãªã¼ãã¼ã¤ã³ã¹ã¿ã³ã¹ã¨ã³ããã¤ã³ã}, port=-1, WRITER, AVAILABLE, weight=25, 2023-07-04 15:33:39.510702]
2023-07-05T00:33:39.451+09:00 ERROR 44369 --- [nio-8080-exec-8] s.a.j.p.f.FailoverConnectionPlugin : The active SQL connection has changed due to a connection failure. Please re-configure session state if required.
2023-07-05T00:33:39.452+09:00 WARN 44369 --- [nio-8080-exec-8] o.h.engine.jdbc.spi.SqlExceptionHelper : SQL Error: 0, SQLState: 08S02
2023-07-05T00:33:39.452+09:00 ERROR 44369 --- [nio-8080-exec-8] o.h.engine.jdbc.spi.SqlExceptionHelper : The active SQL connection has changed due to a connection failure. Please re-configure session state if required.
Liks