[Spring Boot][MariaDB] ์ด์ค‘ํ™”๋œ Data Base ์ดˆ๊ธฐ ๊ตฌ์„ฑ

2022. 11. 30. 23:34ใ†Back-End ์ž‘์—…์‹ค/Spring Framework

728x90
๋ฐ˜์‘ํ˜•

 

 

 

 

 

 

GitHub - junyharang-coding-study/JunyHarang-DataBase-duplication: MariaDB์™€ Spring Boot๋ฅผ ํ†ตํ•ด Data Base ์ด์ค‘ํ™”๋ฅผ ํ•˜๊ณ 

MariaDB์™€ Spring Boot๋ฅผ ํ†ตํ•ด Data Base ์ด์ค‘ํ™”๋ฅผ ํ•˜๊ณ , ๋ถ€ํ•˜ ๋ถ„์‚ฐํ•˜๋Š” ๋ฐฉ๋ฒ•์— ๋Œ€ํ•œ ์ฝ”๋“œ์—์š”. - GitHub - junyharang-coding-study/JunyHarang-DataBase-duplication: MariaDB์™€ Spring Boot๋ฅผ ํ†ตํ•ด Data Base ์ด์ค‘ํ™”๋ฅผ ํ•˜๊ณ , ๋ถ€ํ•˜

github.com

 

 

 

 

์ž๋ฐ” ORM ํ‘œ์ค€ JPA ํ”„๋กœ๊ทธ๋ž˜๋ฐ:์Šคํ”„๋ง ๋ฐ์ดํ„ฐ ์˜ˆ์ œ ํ”„๋กœ์ ํŠธ๋กœ ๋ฐฐ์šฐ๋Š” ์ „์ž์ •๋ถ€ ํ‘œ์ค€ ๋ฐ์ดํ„ฐ๋ฒ ์ด

COUPANG

www.coupang.com

 

 

 

์Šคํ”„๋ง ๋ถ€ํŠธ์™€ AWS๋กœ ํ˜ผ์ž ๊ตฌํ˜„ํ•˜๋Š” ์›น ์„œ๋น„์Šค:์ธํ…”๋ฆฌ์ œ์ด JPA JUnit ํ…Œ์ŠคํŠธ ๊ทธ๋ ˆ์ด๋“ค

COUPANG

www.coupang.com

 

 

 

์ฝ”๋“œ๋กœ ๋ฐฐ์šฐ๋Š” ์Šคํ”„๋ง ๋ถ€ํŠธ ์›น ํ”„๋กœ์ ํŠธ : ํ˜„์—… ๊ฐœ๋ฐœ์„ ์œ„ํ•œ ๋‹จ๊ณ„๋ณ„ ์‹ค์Šต์„œ

COUPANG

www.coupang.com

 

 

์ฝ”๋“œ๋กœ ๋ฐฐ์šฐ๋Š” ์Šคํ”„๋ง ์›น ํ”„๋กœ์ ํŠธ:ํ˜„์—… ๊ฐœ๋ฐœ์„ ์œ„ํ•œ ๋‹จ๊ณ„๋ณ„ ์‹ค์Šต์„œ

COUPANG

www.coupang.com

"์ด ํฌ์ŠคํŒ…์€ ์ฟ ํŒก ํŒŒํŠธ๋„ˆ์Šค ํ™œ๋™์˜ ์ผํ™˜์œผ๋กœ, ์ด์— ๋”ฐ๋ฅธ ์ผ์ •์•ก์˜ ์ˆ˜์ˆ˜๋ฃŒ๋ฅผ ์ œ๊ณต๋ฐ›์Šต๋‹ˆ๋‹ค."

 

 

 




๐Ÿ—‚ ๋ชฉ์ฐจ

โ— [Infra] Maria DB(MySQL) ์ด์ค‘ํ™”(Replication) ๋‹จ๋ฐฉํ–ฅ ๊ตฌ์„ฑ
โ— [Spring Boot][MariaDB] ์ด์ค‘ํ™”๋œ Data Base ์ดˆ๊ธฐ ๊ตฌ์„ฑ

 

 

 

 

๐Ÿš€ ๋‹จ๋ฐฉํ–ฅ ์ด์ค‘ํ™”๋œ Maria DB Spring Boot์—์„œ ๊ฐ€์ง€๊ณ  ๋†€๊ธฐ

    ๐Ÿ”ฝ  ๊ฐœ์š”

        ๐Ÿ“ฆ ์„ค๋ช…

์ด ์ „์— ๊ตฌ์„ฑํ–ˆ๋˜ ๊ฐœ๋ฐœ ํ™˜๊ฒฝ Maria DB๋ฅผ ๋‹จ๋ฐฉํ–ฅ ์ด์ค‘ํ™” ์ฒ˜๋ฆฌ๋ฅผ ํ–ˆ๊ณ , ์ •์ƒ ์ž‘๋™ํ•˜๋Š” ๊ฒƒ๊นŒ์ง€ ํ™•์ธํ•˜์˜€์–ด์š”.
์ด์ œ ๊ตฌ์„ฑ์„ ์™„๋ฃŒํ–ˆ์œผ๋‹ˆ ๋ณธ๊ฒฉ์ ์œผ๋กœ ์‚ฌ์šฉํ•˜๊ธฐ ์œ„ํ•ด ์„ค์ •ํ•˜๊ณ  ๊ฐ€์ง€๊ณ  ๋†€์•„๋ณด๋ ค๊ณ  ํ•ด์š”. ๐Ÿ˜€

Data Base๋ฅผ ๊ตฌ์„ฑํ•˜๊ณ , WEB, WAS ๋“ฑ์„ ๊ตฌ์„ฑํ•˜๊ณ , Service๋ฅผ Openํ•˜๊ฒŒ ๋˜๋ฉด ์ด์šฉ์ž๋“ค์€ ์“ฐ๋Š” ํ–‰์œ„ ์ฆ‰, Write ๋ณด๋‹ค ์ฝ๋Š” ํ–‰์œ„ ์ฆ‰, Read ํ–‰์œ„๋ฅผ ๋” ๋งŽ์ด ํ•˜๊ฒŒ ๋ฉ๋‹ˆ๋‹ค.

์ถœ์ฒ˜ : https://www.oracle.com/kr/database/


ํ˜„์—…์—์„œ Data Base ๋ถ€ํ•˜๋ฅผ ๋ถ„์‚ฐํ•˜๊ธฐ ์œ„ํ•ด ์œ„์™€ ๊ฐ™์ด Master - Slave ํ˜น์€ Master - Master ํ˜•์‹์œผ๋กœ ์ด์ค‘ํ™”๋ฅผ ํ•˜๊ณ  ์žˆ์–ด์š”.

์ด๋Ÿฌํ•œ ๊ตฌ์กฐ๋ฅผ ๊ฐ€์ง€๊ณ  ์žˆ์„ ๋•Œ, Transection์˜ ์†์„ฑ์ด readOnly = true์ผ ๊ฒฝ์šฐ Slave Data Base์— Select Query๋ฅผ ๋˜์ง€๊ฒŒ ์„ค์ •ํ•ด์ค˜์•ผ ํ•ด์š”.

 

๐Ÿ’ก ์ฐธ๊ณ  ์‚ฌํ•ญ
Transection์ด๋ž€?

๋” ์ด์ƒ ์ชผ๊ฐค ์ˆ˜ ์—†๋Š” ์—…๋ฌด ์ฒ˜๋ฆฌ์˜ ์ตœ์†Œ ๋‹จ์œ„๋กœ A๊ฐ€ B๋ผ๋Š” ์‚ฌ๋žŒ์—๊ฒŒ 1,000์›์„ ์ง€๊ธ‰ํ•˜๊ณ , B๊ฐ€ ๊ทธ ๋ˆ์„ ๋ฐ›์€ ๊ฒฝ์šฐ, ์ด ๊ฑฐ๋ž˜ ๊ธฐ๋ก์€ ๋” ์ด์ƒ ์ž‘๊ฒŒ ์ชผ๊ฐค ์ˆ˜ ์—†๋Š” ํ•˜๋‚˜์˜ ํŠธ๋žœ์žญ์…˜์„ ๊ตฌ์„ฑํ•œ๋‹ค๊ณ  ๋ณธ๋‹ค.

๋งŒ์•ฝ A๋Š” ๋ˆ์„ ์ง€๋ถˆํ–ˆ์œผ๋‚˜, B๊ฐ€ ๋ˆ์„ ๋ฐ›์ง€ ๋ชปํ–ˆ๋‹ค๋ฉด ๊ทธ ๊ฑฐ๋ž˜๋Š” ์„ฑ๋ฆฝํ•˜์ง€ ์•Š๋Š”๋‹ค. ์ด์ฒ˜๋Ÿผ A๊ฐ€ ๋ˆ์„ ์ง€๋ถˆํ•˜๋Š” ํ–‰์œ„์™€ B๊ฐ€ ๋ˆ์„ ๋ฐ›๋Š” ํ–‰์œ„๋Š” ๋ณ„๊ฐœ๋กœ ๋ถ„๋ฆฌ๋  ์ˆ˜ ์—†์œผ๋ฉฐ, ํ•˜๋‚˜์˜ ๊ฑฐ๋ž˜ ๋‚ด์—ญ์œผ๋กœ ์ฒ˜๋ฆฌ๋˜์–ด์•ผ ํ•˜๋Š” ๋‹จ์ผ ๊ฑฐ๋ž˜์ด๋ฉฐ, ์ด ๋•Œ, ์ด๋Ÿฐ ์ตœ์†Œ ๋‹จ์œ„๋ฅผ ํŠธ๋žœ์žญ์…˜์ด๋ผ ๋ถ€๋ฅธ๋‹ค.

ํŠธ๋žœ์žญ์…˜ ์ฒ˜๋ฆฌ๊ฐ€ ์ •์ƒ์ ์œผ๋กœ ์™„๋ฃŒ๋œ ๊ฒฝ์šฐ ์ปค๋ฐ‹(Commit)ํ•˜๊ณ , ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ•  ๊ฒฝ์šฐ ์›๋ž˜ ์ƒํƒœ๋Œ€๋กœ ๋กค๋ฐฑ(Rollback)ํ•œ๋‹ค.

ํŠธ๋žœ์žญ์…˜์€ DBMS์— ์—ฌ๋Ÿฌ๊ฐœ์˜ Client๊ฐ€ ๋™์‹œ์— ์ ‘๊ทผํ•˜๊ฑฐ๋‚˜, ์‘์šฉ ํ”„๋กœ๊ทธ๋žจ์ด ๊ฐฑ์‹  ์ฒ˜๋ฆฌ๋ฅผ ํ•˜๋Š” ๊ณผ์ •์—์„œ ์ค‘๋‹จ๋  ์ˆ˜ ์žˆ๋Š” ๊ฒฝ์šฐ ๋“ฑ Data ๋ถ€์ •ํ•ฉ์„ ๋ฐฉ์ง€ํ•˜๊ณ ์ž ํ•  ๋•Œ ์‚ฌ์šฉํ•œ๋‹ค. Data Base ๊ธฐ๋Šฅ ์ค‘ ํŠธ๋žœ์žญ์…˜์„ ์กฐ์ž‘ํ•˜๋Š” ๊ธฐ๋Šฅ์€ Data Base ์™„์ „์„ฑ(Integrity) ์œ ์ง€๋ฅผ ํ™•์‹ ํ•˜๊ฒŒ ํ•œ๋‹ค.

๋‹จ์ผ ํŠธ๋žœ์žญ์…˜์€ Data Base ๋‚ด์— ์ฝ๊ฑฐ๋‚˜, ์“ฐ๋Š” ์—ฌ๋Ÿฌ๊ฐœ Query๋ฅผ ์š”๊ตฌํ•˜๊ฒŒ ๋˜๋Š”๋ฐ, ์ด ๋•Œ, ์ค‘์š”ํ•œ ๊ฒƒ์€ Data Base๊ฐ€ ์ˆ˜ํ–‰๋œ ์ผ ๋ถ€ Query๊ฐ€ ๋‚จ์ง€ ์•Š๋Š”๋‹ค๋Š” ๊ฒƒ์ด๋‹ค.

์˜ˆ๋ฅผ ๋“ค์–ด ์†ก๊ธˆ์„ ํ•  ๋•Œ, ํ•œ ๊ณ„์ขŒ์—์„œ ์ธ์ถœ๋˜๋ฉด ๋‹ค๋ฅธ ๊ณ„์ขŒ์—์„œ ์ž…๊ธˆ ํ™•์ธ ๋˜๋Š” ๊ฒƒ์ด ์ค‘์š”ํ•˜๋‹ค. ๋˜ํ•œ, ํŠธ๋žœ์žญ์…˜์€ ์„œ๋กœ ๊ฐ„์„ญ์ด ์—†์–ด์•ผ ํ•œ๋‹ค.
๋งŒ์•ฝ Query ํ•˜๋‚˜๊ฐ€ ์‹คํŒจํ•˜๋ฉด Data Base๋Š” ์ „์ฒด ํŠธ๋žœ์žญ์…˜ ๋˜๋Š” ์‹คํŒจํ•œ Query๋ฅผ ๋กค๋ฐฑํ•œ๋‹ค. (DBMS์˜ ์‚ฌ์šฉ๋ฒ•๊ณผ ์„ค์ •์— ๋”ฐ๋ผ ์ƒ์ด) ํŠธ๋žœ์žญ์…˜์€ ์ปค๋ฐ‹์ „ ์–ธ์ œ๋“ ์ง€ ์ˆ˜๋™์œผ๋กœ ๋กค๋ฐฑ๋  ์ˆ˜ ์žˆ๋‹ค.

์ฆ‰, ํŠธ๋žœ์žญ์…˜์€ Data Base์˜ ์ƒํƒœ๋ฅผ ๋ณ€ํ™”์‹œํ‚ค๊ธฐ ์œ„ํ•ด ์ˆ˜ํ–‰ํ•˜๋Š” ์ž‘์—…์˜ ๋‹จ์œ„์ด๋‹ค.


์ฃผ๋‹ˆํ•˜๋ž‘์€ Spring Boot์— ์•„๋ž˜ ๋‚ด์šฉ์— ๋Œ€ํ•œ ์ƒํ™ฉ๊ณผ ์„ค์ •์„ ์ง„ํ–‰ํ•ด๋ณด๋ ค ํ•ด์š”.

โˆ™ @Transaction(readOnly = true) ์ธ ๊ฒฝ์šฐ Slave DB ์ ‘๊ทผ.
โˆ™ @Transaction(readOnly = false) ์ธ ๊ฒฝ์šฐ Master DB ์ ‘๊ทผ.

 

์ฃผ๋‹ˆํ•˜๋ž‘์€ ์•„๋ž˜์™€ ๊ฐ™์ด Data Base๋ฅผ ๊ตฌ์„ฑํ•ด ๋†“์•˜์–ด์š”.

๊ธฐ๊น”๋‚˜๋Š” ์‚ฌ๋žŒ๋“ค ์„œ๋ฒ„ ๊ตฌ์„ฑ๋„


์œ„์˜ ๊ทธ๋ฆผ๊ณผ ๊ฐ™์ด Sysnology NAS Docker๋ฅผ ์ด์šฉํ•˜์—ฌ Master DB์ธ Maria DB๋ฅผ ๊ตฌ์„ฑํ•˜๊ณ , WAS์šฉ์œผ๋กœ ๊ตฌ์„ฑ๋œ Laptop์— Docker๋ฅผ ์ด์šฉํ•˜์ง€ ์•Š๊ณ , ์ง์ ‘ Slave DB์ธ Maria DB๋ฅผ ๊ตฌ์„ฑํ•˜์˜€์–ด์š”.

 

 

 

    ๐Ÿ”ฝ  Project ๋งŒ๋“ค๊ธฐ

        ๐Ÿ“ฆ Project ์ƒ์„ฑ

์ฃผ๋‹ˆํ•˜๋ž‘์€ InteliJ Ultimate Version์„ ์‚ฌ์šฉํ•˜๊ณ  ์žˆ์–ด์„œ ์•„๋ž˜์™€ ๊ฐ™์ด Project๋ฅผ ๋งŒ๋“ค์–ด ์ค„๊ฑฐ์—์š”.




์˜์กด์„ฑ ์„ค์ •


์œ„์™€ ๊ฐ™์ด Test๋ฅผ ์œ„ํ•ด ํ•„์š”ํ•œ ์˜์กด์„ฑ์„ ๊ตฌ์„ฑํ•ด ์ค„ ๊ฑฐ์—์š”.



์ตœ์ดˆ application.properties๋ฅผ application.yml๋กœ ๋ฐ”๊ฟ”์ค„๊ฒŒ์š”.

 

 

    ๐Ÿ”ฝ  ์„ค์ •

        ๐Ÿ“ฆ Data Base ์„ค์ •

Master DBMS


์ตœ์ดˆ Test๋ฅผ ์œ„ํ•˜์—ฌ Master DBMS์—์„œ DB๋ฅผ ์ƒ์„ฑํ•˜๊ณ ,
๊ณ„์ •๋„ ๋งŒ๋“ค์–ด์ฃผ๊ณ , ํ•ด๋‹น ๊ณ„์ •์— Table ๊ถŒํ•œ๋„ ์œ„์™€ ๊ฐ™์ด ๋„ฃ์–ด์ฃผ์—ˆ์–ด์š”.


Slave DBMS


Slave์—๋„ ์œ„์™€ ๊ฐ™์ด repl_test DB๊ฐ€ ์ƒ๊ธด๊ฑธ ํ™•์ธํ•  ์ˆ˜ ์žˆ์–ด์š”.



 

        ๐Ÿ“ฆ application.yml

๋ณธ๊ฒฉ์ ์œผ๋กœ Spring Boot์— Data Base ์„ค์ •์„ ํ•ด์ค„๊ฒŒ์š”.

์‚ฌ์‹ค ์ฃผ๋‹ˆํ•˜๋ž‘์€ Local์—์„œ๋Š” H2 DB๋ฅผ ์ด์šฉํ•˜๊ณ , Dev ํ™˜๊ฒฝ์—์„œ๋Š” ์ด์ค‘ํ™”ํ•œ MariaDB๋ฅผ ์“ฐ๊ณ  ์‹ถ์—ˆ์ง€๋งŒ,
์•„๋ž˜์—์„œ ์„ค์ •ํ•˜๋Š” DataSource ์„ค์ •์— ์ด์ค‘ํ™”๊ฐ€ ๋˜์ง€ ์•Š์€ H2๋ฅผ ์ ์šฉํ•  ์ˆ˜๊ฐ€ ์—†์—ˆ์–ด์š”.

๋งŒ์•ฝ ์ด๋ ‡๊ฒŒ ๊ตฌ์„ฑํ•˜๋Š” ๋ฐฉ๋ฒ•์„ ์•„์‹ ๋‹ค๋ฉด ๋Œ“๊ธ€ ๋ถ€ํƒ๋“œ๋ฆฝ๋‹ˆ๋‹ค.

application.yml


์ตœ์ดˆ ์œ„์™€ ๊ฐ™์ด Local ํ™˜๊ฒฝ, ๊ฐœ๋ฐœ ํ™˜๊ฒฝ์„ ๊ตฌ๋ถ„ํ•˜๋„๋ก ํ•˜์˜€๊ณ ,
์ปฌ ํ™˜๊ฒฝ์€ H2 DB๋ฅผ ์ด์šฉํ•˜์—ฌ ์‚ฌ์šฉํ•  ๊ฒƒ์ด๋ผ ์œ„์™€ ๊ฐ™์ด ์„ค์ •์„ ํ•ด ์ฃผ์—ˆ์–ด์š”.

๊ทธ๋Ÿฐ ๋’ค ๊ฐœ๋ฐœ ํ™˜๊ฒฝ์˜ Data Base ํ™˜๊ฒฝ ๊ตฌ์„ฑ์„ ์œ„ํ•ด application-dev.yml์„ ๋งŒ๋“ค์–ด ์ฃผ์—ˆ์–ด์š”.

application-dev.yml

์œ„์™€ ๊ฐ™์ด ๊ฐœ๋ฐœ ํ™˜๊ฒฝ์—์„œ ์‚ฌ์šฉํ•  Master์™€ Slave DBMS ์„ค์ •์„ ํ•ด ์ฃผ์—ˆ์–ด์š”.

Master์™€ Slave DBMS ๋‘๊ฐœ๋ฅผ ์ด์šฉํ•˜๊ธฐ ๋•Œ๋ฌธ์— Datasource๋ฅผ ์ง์ ‘ ์ƒ์„ฑํ•ด ์ฃผ์–ด์•ผํ•ด์š”.


 

 

    ๐Ÿ”ฝ  Class ์ƒ์„ฑ

        ๐Ÿ“ฆ Config Code ์ž‘์„ฑ

์ด๋ฒˆ์—๋Š” ์œ„์—์„œ ์„ค์ •ํ•œ ๋‚ด์šฉ์„ ๊ฐ€์ง€๊ณ , readOnly ์†์„ฑ ๋ณ„๋กœ ๋ถ„๊ธฐ๋ฅผ ํ•˜๊ธฐ ์ „ DataSource๋ฅผ Bean์œผ๋กœ ๋“ฑ๋กํ•˜๋Š” ์ฝ”๋“œ๋ฅผ ์ž‘์„ฑํ•ด ์ค„๊ฒŒ์š”.


ํ•ด๋‹น Bean Class๋ฅผ ์ž‘์„ฑํ•˜๊ธฐ ์œ„ํ•ด ์œ„์™€ ๊ฐ™์ด Package์™€ Class๋ฅผ ์ƒ์„ฑํ•ด ์ฃผ์—ˆ์–ด์š”.



DataSourceConfiguration

๋ฐ˜์‘ํ˜•


์œ„์—์„œ application-dev.yml์— ์„ค์ •ํ•œ Data Base ์„ค์ • ๋‚ด์šฉ์„ ๊ฐ€์ ธ์˜ค๊ธฐ ์œ„ํ•ด
18๋ฒˆ์งธ ์ค„๊ณผ 26๋ฒˆ์งธ ์ค„์— ํ•ด๋‹น ๊ฐ’์„ ๊ฐ€์ ธ์˜ค๋„๋ก ํ•ด ์ฃผ์—ˆ์–ด์š”.

 

 

 

AbstractRoutingDataSource ๋งŒ๋“ค๊ธฐ

AbstractRoutingDataSource.class๋Š” ์กฐํšŒ Key ๊ธฐ๋ฐ˜์œผ๋กœ ๋“ฑ๋ก๋œ DataSource ์ค‘ ํ•˜๋‚˜๋ฅผ ํ˜ธ์ถœํ•˜๊ฒŒ ํ•ด ์ฃผ๋Š” ์นœ๊ตฌ์—์š”.

RoutingDataSource

 

ํ˜„์žฌ ์กฐํšŒ ํ‚ค๋ฅผ ๋ฐ˜ํ™˜๋ฐ›๊ธฐ ์œ„ํ•ด ์ถ”์ƒ Method๋ฅผ ๊ตฌํ˜„ํ•˜์—ฌ ์ฃผ์—ˆ์–ด์š”.
์ด๋ฅผ ํ†ตํ•ด readOnly ์†์„ฑ์„ ๊ตฌ๋ณ„ํ•˜์—ฌ Key๋ฅผ ๋ฐ˜ํ™˜ํ•˜๊ฒŒ ํ•ด์ค€๋‹ต๋‹ˆ๋‹ค.

์ฆ‰, determineCurrentLookupKey()๋Š” Logic์— ๋”ฐ๋ผ ๋‚ด๋ถ€ ๊ตฌํ˜„์ด ๋ฐ”๋€Œ๊ฒŒ ๋˜๋Š”๋ฐ, URL Pattern์— ๋”ฐ๋ฅธ ๋ถ„๊ธฐ, Enum์„ ์ด์šฉํ•˜์—ฌ ๋„˜์–ด์˜ค๋Š” Enum ๊ฐ’์— ๋”ฐ๋ฅธ DataSource ์„ ํƒ, Session์—์„œ Key ๊ฐ’์„ ํ†ตํ•œ ๋ถ„๊ธฐ ๋“ฑ์ด ๊ฐ€๋Šฅํ•ด์š”.

 

ํ•˜์ง€๋งŒ, ์œ„์™€ ๊ฐ™์ด ์„ค์ •๋งŒ ํ•˜๋ฉด ๋ฌธ์ œ๋ฅผ ๋งŒ๋‚˜๊ฒŒ ๋  ๊ฒƒ์ด์—์š”.
Spring์— ์žˆ๋Š” AbstractRoutingDataSource๋Š” ์—ฌ๋Ÿฌ๊ฐœ์˜ DataSource๋ฅผ ํ•˜๋‚˜๋กœ ๋ฌถ๊ณ , ์ž๋™์œผ๋กœ ๋ถ„๊ธฐ ์ฒ˜๋ฆฌ๋ฅผ ํ•ด์ฃผ๋Š” Spring Default Class์—์š”.

์•„๋งˆ ์œ„์™€ ๊ฐ™์ด DB ์ด์ค‘ํ™”๋ฅผ ํ•˜๊ฒŒ ๋˜๋ฉด ๊ตฌํ˜„ํ•˜์—ฌ Spring์˜ ํ˜„์žฌ ํŠธ๋žœ์žญ์…˜ ์†์„ฑ์„ ์ฝ์–ด์˜ค๋Š” TransactionSynchronizationManager์™€ ์กฐํ•ฉํ•˜์—ฌ ๋ถ„๊ธฐ ์ฒ˜๋ฆฌ๋ฅผ ํ•˜๋ ค ์„ค์ •์„ ํ•ด ์ฃผ์—ˆ์ง€๋งŒ, ์ด๋ ‡๊ฒŒ ํ•˜๊ฒŒ ๋˜๋ฉด TransactionSynchronizationManager๊ฐ€ ๋น„๋ก @Transactional๋กœ ์„ ์–ธ๋œ ํ˜„์žฌ ์“ฐ๋ ˆ๋“œ์˜ ํŠธ๋žœ์žญ์…˜ ์ƒํƒœ๋ฅผ ์ฝ์–ด๋…ธ๋Š”๊ฒŒ ๊ฐ€๋Šฅํ•˜๋”๋ผ๋„ ๋™๊ธฐํ™”(Syncronation) ์‹œ์ ๊ณผ Connection ๊ฐ์ฒด๋ฅผ ๊ฐ€์ ธ์˜ค๋Š” ์‹œ์ ์— ๋ฌธ์ œ๊ฐ€ ๋ฐœ์ƒํ•˜๊ธฐ ๋•Œ๋ฌธ์ด์—์š”.

๐Ÿ’ก ์ฐธ๊ณ  ์‚ฌํ•ญ
Spring์—์„œ์˜ @Transactional ์ฒ˜๋ฆฌ ๋ฐฉ์‹

1. TransactionManager ์„ ๋ณ„
2. DataSource์—์„œ Connection ํš๋“
3. Transaction ๋™๊ธฐํ™”


์œ„์˜ ์ฐธ๊ณ  ์‚ฌํ•ญ์—์„œ ๋ณด๋ฉด ํŠธ๋žœ์žญ์…˜ ๋™๊ธฐํ™”๋ฅผ ๋งˆ์นœ ๋’ค ReplicationRoutingDataSource์—์„œ Connection์„ ํš๋“ํ•ด์•ผ๋งŒ ์ •์ƒ ๋™์ž‘์„ ํ• ํ…๋ฐ, ์ด ์ˆœ์„œ๊ฐ€ ๋’ค ๋ฐ”๋€Œ์–ด ์žˆ๋‹ค๋Š” ๊ฒƒ์ด ๋ฌธ์ œ์—์š”.

์ด ๋ฌธ์ œ๋กœ ์ธํ•ด์„œ AbstractRoutingDataSource์„ ์ด์šฉํ•  ๊ฒฝ์šฐ ๋ชจ๋“  Query๊ฐ€ Master DBMS๋กœ ๊ฐ€๋Š” ํ˜„์ƒ์„ ๋ฐœ๊ฒฌํ•  ์ˆ˜ ์žˆ์„๊ฑฐ์—์š”.

์ด ๋ฌธ์ œ๋ฅผ ํ•ด๊ฒฐํ•˜๊ธฐ ์œ„ํ•ด์„œ๋Š” ReplicationRoutingDataSource๋ฅผ LazyConnectionDataSourceProxy๋กœ ๊ฐ์‹ธ์ฃผ์–ด์„œ ์ฒ˜๋ฆฌ๋ฅผ ํ•˜๋ฉด ๋˜์š”.

LazyConnectionDataSourceProxy๋Š” ์‹ค์งˆ์ ์ธ Query ์‹คํ–‰ ์—ฌ๋ถ€์™€ ์ƒ๊ด€์—†์ด ํŠธ๋žœ์žญ์…˜์ด ๊ฑธ๋ฆฌ๋ฉด ๋ฌด์กฐ๊ฑด Connection ๊ฐ์ฒด๋ฅผ ํ™•๋ณดํ•˜๋Š” Spring ๋‹จ์ ์„ ๋ถ€์™„ํ•˜์—ฌ ํŠธ๋žœ์žญ์…˜ ์‹œ์ž‘์‹œ Connection Proxy ๊ฐ์ฒด๋ฅผ ๋ฐ˜ํ™˜ํ•˜๊ณ , ์‹ค์ œ Query ๋ฐœ์ƒ ์‹œ์— DataSource์—์„œ getConnection()์„ ํ˜ธ์ถœํ•˜๋Š” ์—ญํ• ์„ ํ•ด์ค€๋‹ต๋‹ˆ๋‹ค.

๐Ÿ’ก ์ฐธ๊ณ  ์‚ฌํ•ญ
LazyConnectionDataSourceProxy์„ ์‚ฌ์šฉํ–ˆ์„ ๋•Œ, ์ฒ˜๋ฆฌ ๋ฐฉ์‹

1. TransactionManager ์„ ๋ณ„
2. LazyConnectionDataSourceProxy์—์„œ Connection Proxy ๊ฐ์ฒด ํš๋“
3. Transaction ๋™๊ธฐํ™”
4. ์‹ค์ œ Query Call ํ•  ๋•Œ, ReplicationRoutingDataSource.getConection() / determineCurrentLookupKey() Call


์œ„์˜ ์ˆœ์„œ์™€ ๊ฐ™์ด Spring์˜ ํŠธ๋žœ์žญ์…˜๊ณผ ์•Œ๋งž๋Š” ReplicationRoutingDataSource๊ฐ€ ๋งŒ๋“ค์–ด์ง€๊ฒŒ ๋œ๋‹ต๋‹ˆ๋‹ค.

์œ„์™€ ๊ฐ™์€ ์ด์œ ๋กœ Transaction ๋™๊ธฐํ™” ์‹œ์ ์— Connection ํš๋“์„ ์œ„ํ•ด LazyConnectionDataSourceProxy๋กœ ํ•œ๋ฒˆ ๊ฐ์‹ธ์ฃผ์–ด์•ผ ํ•˜๋Š” ์ž‘์—…์ด ํ•„์š”ํ•ด์š”.

 

 

DataSourceConfiguration ๋‚ด์šฉ ์ถ”๊ฐ€

DataSourceConfiguration 37 ~ 59


์œ„์—์„œ ๋งŒ๋“ค์—ˆ๋˜ DataSourceConfiguration์— ์œ„์˜ ๋‚ด์šฉ์„ ์ถ”๊ฐ€ํ•ด ์ฃผ์—ˆ์–ด์š”.

์ด๋ฅผ ํ†ตํ•ด DataSource Bean์„ ์ƒ์„ฑํ•˜๋Š” Configuration Class๋กœ ์ผ๋ฐ˜์ ์ธ DataSource๊ฐ€ ์•„๋‹Œ RoutingDataSource๋ฅผ ์ƒ์„ฑํ•˜์—ฌ ๋ฐ˜ํ™˜ํ•˜๊ฒŒ ํ•ด ์ฃผ์—ˆ์–ด์š”.


DataSourceConfiguration


์ „์ฒด Source Code๋ฅผ ๋ณด๋ฉด ์œ„์™€ ๊ฐ™์ด ์ž‘์„ฑ์„ ํ•ด ์ฃผ์—ˆ์–ด์š”.

์ตœ์ดˆ @ConfigurationProperties๋ฅผ ํ†ตํ•ด application.properties๋‚˜, application.yml์— master, slave๋กœ ๋‚˜๋ˆˆ ๊ฐ’๋“ค์„ ๊ฐ€์ง€๊ณ  ์™€์„œ ๊ฐ๊ฐ์˜ MasterDataSource, SlaveDataSource๋ฅผ ์ƒ์„ฑํ•˜๊ณ , Bean์œผ๋กœ ๋“ฑ๋กํ•ด ์ค๋‹ˆ๋‹ค.

๋ฐ˜ํ™˜๋˜๋Š” RoutingDataSource๋Š” ์—ฌ๋Ÿฌ ๊ฐœ(Master, Slave) DataSource ๊ฐ์ฒด๋ฅผ Key, Value ํ˜•ํƒœ๋กœ ๋‹ด๊ณ , determineCurrentLookupKey()๋ฅผ ํ†ตํ•ด ๋ฐ˜ํ™˜๋˜๋Š” Key ๊ฐ’๊ณผ ์ผ์น˜ํ•˜๋Š” DataSource ๊ฐ์ฒด๋ฅผ ๋ฐ˜ํ™˜ํ•˜๊ฒŒ ํ•ด์ฃผ์—ˆ์–ด์š”.

๊ทธ๋Ÿฐ ๋’ค RoutingDataSource๋Š” ์ตœ์ข…์ ์œผ๋กœ LazyConnectionDataSourceProxy์— ์Œ‡์—ฌ ๋ฐ˜ํ™˜๋˜๊ฒŒ ๋œ๋‹ต๋‹ˆ๋‹ค.


ํ•˜์ง€๋งŒ, ์—ฌ๊ธฐ๊นŒ์ง€๋งŒ ๋˜ ์„ค์ •ํ•˜๊ฒŒ ๋˜๋ฉด ์•„๋ž˜์™€ ๊ฐ™์ด ์ข…์†์„ฑ ์ˆœํ™˜ ๋ฌธ์ œ๋ฅผ ๊ฒช๊ฒŒ ๋  ๊ฒƒ์ด์—์š”.

์ข…์†์„ฑ ์ˆœํ™˜ Error


์ด ๋ฌธ์ œ๋ฅผ ํ•ด๊ฒฐํ•˜๊ธฐ ์œ„ํ•œ ์ฒซ๋ฒˆ์งธ ๋ฐฉ๋ฒ•์œผ๋กœ๋Š” @DependsOn์„ ํ†ตํ•ด Bean์˜ ์ดˆ๊ธฐํ™” ์ˆœ์„œ๋ฅผ ์ˆ˜๋™์œผ๋กœ ์ง€์ •ํ•ด ์ฃผ๋Š” ๊ฒƒ์ด์—์š”.


DataSourceConfiguration 38 ~ 62


์œ„์™€ ๊ฐ™์ด ์ˆ˜์ •์„ ํ•ด ์ฃผ๋ฉด ๋œ๋‹ต๋‹ˆ๋‹ค.



๋‘๋ฒˆ์งธ ๋ฐฉ๋ฒ•์€ main()์ด ์žˆ๋Š” Class์—์„œ @SpringBootApplication์—
DataSourceAutoConfiguration.class๋ฅผ ๋น„ํ™œ์„ฑํ™”(Exclude) ์‹œ์ผœ์ฃผ๋Š” ๋ฐฉ๋ฒ•์ด์—์š”.

 

duplicationTestApplication


์ด๋ ‡๊ฒŒ๋„ ํ•ด๊ฒฐํ•  ์ˆ˜ ์žˆ์–ด์š”.

 

/Users/junyss/Library/Java/JavaVirtualMachines/azul-11.0.16/Contents/Home/bin/java -agentlib:jdwp=transport=dt_socket,address=127.0.0.1:55113,suspend=y,server=n -XX:TieredStopAtLevel=1 -noverify -Dspring.profiles.active=dev -Dspring.output.ansi.enabled=always -Dcom.sun.management.jmxremote -Dspring.jmx.enabled=true -Dspring.liveBeansView.mbeanDomain -Dspring.application.admin.enabled=true -javaagent:/Users/junyss/Library/Caches/JetBrains/IntelliJIdea2022.2/captureAgent/debugger-agent.jar -Dfile.encoding=UTF-8 -classpath /Users/junyss/Programming/study/Test/JunyHarangTest/mariaDB-duplication-Test/duplication_test/build/classes/java/main:/Users/junyss/Programming/study/Test/JunyHarangTest/mariaDB-duplication-Test/duplication_test/build/resources/main:/Users/junyss/.gradle/caches/modules-2/files-2.1/org.projectlombok/lombok/1.18.24/13a394eed5c4f9efb2a6d956e2086f1d81e857d9/lombok-1.18.24.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/org.springframework.boot/spring-boot-starter-data-jpa/2.7.6/7eef599012347f2fb7f84ba71eba10caf094dfb5/spring-boot-starter-data-jpa-2.7.6.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/org.springframework.boot/spring-boot-starter-web/2.7.6/9d0166a0390df593243bdc798ca7a1db20ddea9c/spring-boot-starter-web-2.7.6.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/io.springfox/springfox-boot-starter/3.0.0/5486365e263f8acca014b97efa50c3419d58e8f6/springfox-boot-starter-3.0.0.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/org.springframework.boot/spring-boot-starter-aop/2.7.6/23061de1832242610092f212f99d49b9a4955a9d/spring-boot-starter-aop-2.7.6.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/org.springframework.boot/spring-boot-starter-jdbc/2.7.6/9db6def4ba06a11b67f0de3eac83441d00350dd6/spring-boot-starter-jdbc-2.7.6.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/jakarta.transaction/jakarta.transaction-api/1.3.3/c4179d48720a1e87202115fbed6089bdc4195405/jakarta.transaction-api-1.3.3.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/jakarta.persistence/jakarta.persistence-api/2.2.3/8f6ea5daedc614f07a3654a455660145286f024e/jakarta.persistence-api-2.2.3.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/org.hibernate/hibernate-core/5.6.14.Final/71e407089b71ed7c6e99385fd851c308fed7be44/hibernate-core-5.6.14.Final.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/org.springframework.data/spring-data-jpa/2.7.6/8d0414f5cca5e31509943cd5f97cacdddd7c7384/spring-data-jpa-2.7.6.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/org.springframework/spring-aspects/5.3.24/e97d36c3e516d3dd0579437428b6e26902da0c88/spring-aspects-5.3.24.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/org.springframework.boot/spring-boot-starter-json/2.7.6/77017e2aa78224c3fa10444d659c2ce8765b910/spring-boot-starter-json-2.7.6.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/org.springframework.boot/spring-boot-starter/2.7.6/d15341c0fc0b1d1362ce6c737b34679ad1f836c/spring-boot-starter-2.7.6.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/org.springframework.boot/spring-boot-starter-tomcat/2.7.6/ec920cd7f951f3cff3a0b7af80bb8f7116a3d8a5/spring-boot-starter-tomcat-2.7.6.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/org.springframework/spring-webmvc/5.3.24/33d2187c2bf1cb2c222bd1cc18b618736babcf3d/spring-webmvc-5.3.24.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/org.springframework/spring-web/5.3.24/d89bbcaabb1ff247a089875cbc4211bfe96c9a59/spring-web-5.3.24.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/io.springfox/springfox-oas/3.0.0/e7bc9c1319cf1b64ae714a249c3db3b8fe01e42b/springfox-oas-3.0.0.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/io.springfox/springfox-data-rest/3.0.0/40f5e834d6696ae1d3212fa5a2d5e1ec406bedc0/springfox-data-rest-3.0.0.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/io.springfox/springfox-bean-validators/3.0.0/80c646fdebe5f2b2b337a5a686e540fee0b7304f/springfox-bean-validators-3.0.0.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/io.springfox/springfox-swagger2/3.0.0/7bcb18d496576eff76ef7bb72684e149cbb75c1d/springfox-swagger2-3.0.0.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/io.springfox/springfox-swagger-ui/3.0.0/1e665fbe22148f7c36fa8a08e515a0047cd4390b/springfox-swagger-ui-3.0.0.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/com.fasterxml/classmate/1.5.1/3fe0bed568c62df5e89f4f174c101eab25345b6c/classmate-1.5.1.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/org.springframework.plugin/spring-plugin-metadata/2.0.0.RELEASE/6fb3a1fc0f05dc826687b7686ad8a5960ecdd57c/spring-plugin-metadata-2.0.0.RELEASE.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/org.springframework.plugin/spring-plugin-core/2.0.0.RELEASE/95fc8c13037630f4aba9c51141f535becec00fe6/spring-plugin-core-2.0.0.RELEASE.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/org.slf4j/slf4j-api/1.7.36/6c62681a2f655b49963a5983b8b0950a6120ae14/slf4j-api-1.7.36.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/org.springframework/spring-aop/5.3.24/efd01bc1048a2e1b6a7442fbd78170bc02c342b7/spring-aop-5.3.24.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/org.aspectj/aspectjweaver/1.9.7/158f5c255cd3e4408e795b79f7c3fbae9b53b7ca/aspectjweaver-1.9.7.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/com.zaxxer/HikariCP/4.0.3/107cbdf0db6780a065f895ae9d8fbf3bb0e1c21f/HikariCP-4.0.3.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/org.springframework/spring-jdbc/5.3.24/909c19ab470a59b9fd23177d26b8e880733b15d4/spring-jdbc-5.3.24.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/org.hibernate.common/hibernate-commons-annotations/5.1.2.Final/e59ffdbc6ad09eeb33507b39ffcf287679a498c8/hibernate-commons-annotations-5.1.2.Final.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/org.jboss.logging/jboss-logging/3.4.3.Final/c4bd7e12a745c0e7f6cf98c45cdcdf482fd827ea/jboss-logging-3.4.3.Final.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/net.bytebuddy/byte-buddy/1.12.19/178d26e6a95e50502ae16673e08269797f8b254a/byte-buddy-1.12.19.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/antlr/antlr/2.7.7/83cd2cd674a217ade95a4bb83a8a14f351f48bd0/antlr-2.7.7.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/org.jboss/jandex/2.4.2.Final/1e1c385990b258ff1a24c801e84aebbacf70eb39/jandex-2.4.2.Final.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/org.glassfish.jaxb/jaxb-runtime/2.3.7/ebcde6a44159eb9e3db721dfe6b45f26e6272341/jaxb-runtime-2.3.7.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/org.springframework.data/spring-data-commons/2.7.6/e3d15a8f4d5ef0d2323569445c66903d0188cb68/spring-data-commons-2.7.6.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/org.springframework/spring-context/5.3.24/e48634d7b8f40d4d0fe978830be0247bfc2ff2cd/spring-context-5.3.24.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/org.springframework/spring-orm/5.3.24/256e029c2d8200294fe7fb5352ca2d1d7310dcad/spring-orm-5.3.24.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/org.springframework/spring-tx/5.3.24/175a2157fce17669af6d4db1d094cb4baaa5c8fd/spring-tx-5.3.24.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/org.springframework/spring-beans/5.3.24/e487ea6de09b9a7c36548028feeafa511a593532/spring-beans-5.3.24.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/org.springframework/spring-core/5.3.24/d095c329f30baf2b6d44eccbd2352d7a2f840c72/spring-core-5.3.24.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/com.fasterxml.jackson.datatype/jackson-datatype-jsr310/2.13.4/e6d820112871f33cd94a1dcc54eef58874753b5/jackson-datatype-jsr310-2.13.4.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/com.fasterxml.jackson.module/jackson-module-parameter-names/2.13.4/858ccf6624b5fac6044813e845063edb6a62cf37/jackson-module-parameter-names-2.13.4.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/com.fasterxml.jackson.datatype/jackson-datatype-jdk8/2.13.4/557dbba5d8dfc7b7f944c58fe084109afcb5670b/jackson-datatype-jdk8-2.13.4.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/com.fasterxml.jackson.core/jackson-databind/2.13.4.2/325c06bdfeb628cfb80ebaaf1a26cc1eb558a585/jackson-databind-2.13.4.2.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/org.springframework.boot/spring-boot-starter-logging/2.7.6/33a2d9e08d33a6a6f8051ed38daac14046e2f97c/spring-boot-starter-logging-2.7.6.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/org.springframework.boot/spring-boot-autoconfigure/2.7.6/4ad7e89accd25c69bfe84f52202deaf09430be2/spring-boot-autoconfigure-2.7.6.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/org.springframework.boot/spring-boot/2.7.6/f96f89eba708a591704db5dcbfc03e8822a503aa/spring-boot-2.7.6.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/jakarta.annotation/jakarta.annotation-api/1.3.5/59eb84ee0d616332ff44aba065f3888cf002cd2d/jakarta.annotation-api-1.3.5.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/org.yaml/snakeyaml/1.30/8fde7fe2586328ac3c68db92045e1c8759125000/snakeyaml-1.30.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/org.apache.tomcat.embed/tomcat-embed-websocket/9.0.69/c5da77c17a667b4e7a6bb01fb3b28c46c2717123/tomcat-embed-websocket-9.0.69.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/org.apache.tomcat.embed/tomcat-embed-core/9.0.69/27f2530eba96238aca56593bbd98edfdb038d9ef/tomcat-embed-core-9.0.69.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/org.apache.tomcat.embed/tomcat-embed-el/9.0.69/9c89a289c35b9ec20bdfb692a22dab87256bbe67/tomcat-embed-el-9.0.69.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/org.springframework/spring-expression/5.3.24/ae7410418e7b4bd27a01e3fb1c2fed35b2bc1e84/spring-expression-5.3.24.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/io.springfox/springfox-swagger-common/3.0.0/2e2fae840984cfcabfd50e1b4b1c23422135ba12/springfox-swagger-common-3.0.0.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/io.springfox/springfox-spring-webmvc/3.0.0/7ed22363fdfd651cd811c0b2391f16bddb91db8b/springfox-spring-webmvc-3.0.0.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/io.springfox/springfox-spring-web/3.0.0/a76f2fbe805bfd2798e20dc8f2cfbfad554d52da/springfox-spring-web-3.0.0.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/io.springfox/springfox-schema/3.0.0/32c5d6965617830ef6480fadb9030008945bcd9c/springfox-schema-3.0.0.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/io.springfox/springfox-spi/3.0.0/bae0b820d4b5a922063d34a42aaf4f763308b828/springfox-spi-3.0.0.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/io.springfox/springfox-core/3.0.0/7c3367ce577c8acd9bf64c74488c9269253516c9/springfox-core-3.0.0.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/io.springfox/springfox-spring-webflux/3.0.0/efccbcfe1d23f2ba520bd87cc156bf2b81f3568e/springfox-spring-webflux-3.0.0.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/io.swagger.core.v3/swagger-models/2.1.2/e7edeed6456a16d707542c003af03a594ecafe3a/swagger-models-2.1.2.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/io.swagger.core.v3/swagger-annotations/2.1.2/d407a33aa71444802c640080eb4d5f499b027f96/swagger-annotations-2.1.2.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/io.swagger/swagger-models/1.5.20/fb3a23bad80c5ed84db9dd150db2cba699531458/swagger-models-1.5.20.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/io.swagger/swagger-annotations/1.5.20/16051f93ce11ca489a5313775d825f82fcc2cd6c/swagger-annotations-1.5.20.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/jakarta.xml.bind/jakarta.xml.bind-api/2.3.3/48e3b9cfc10752fba3521d6511f4165bea951801/jakarta.xml.bind-api-2.3.3.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/org.glassfish.jaxb/txw2/2.3.7/55cddcac1945150e09b09b0f89d86799652eee82/txw2-2.3.7.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/com.sun.istack/istack-commons-runtime/3.0.12/cbbe1a62b0cc6c85972e99d52aaee350153dc530/istack-commons-runtime-3.0.12.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/org.springframework/spring-jcl/5.3.24/2b30878663ceed2af07238dc54e92e5bf001438d/spring-jcl-5.3.24.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/com.fasterxml.jackson.core/jackson-annotations/2.13.4/858c6cc78e1f08a885b1613e1d817c829df70a6e/jackson-annotations-2.13.4.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/com.fasterxml.jackson.core/jackson-core/2.13.4/cf934c681294b97ef6d80082faeefbe1edadf56/jackson-core-2.13.4.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/ch.qos.logback/logback-classic/1.2.11/4741689214e9d1e8408b206506cbe76d1c6a7d60/logback-classic-1.2.11.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/org.apache.logging.log4j/log4j-to-slf4j/2.17.2/17dd0fae2747d9a28c67bc9534108823d2376b46/log4j-to-slf4j-2.17.2.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/org.slf4j/jul-to-slf4j/1.7.36/ed46d81cef9c412a88caef405b58f93a678ff2ca/jul-to-slf4j-1.7.36.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/io.github.classgraph/classgraph/4.8.83/7be289f451cedf9e35ed97caba3953226b4e6d9/classgraph-4.8.83.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/ch.qos.logback/logback-core/1.2.11/a01230df5ca5c34540cdaa3ad5efb012f1f1f792/logback-core-1.2.11.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/org.apache.logging.log4j/log4j-api/2.17.2/f42d6afa111b4dec5d2aea0fe2197240749a4ea6/log4j-api-2.17.2.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/com.h2database/h2/2.1.214/d5c2005c9e3279201e12d4776c948578b16bf8b2/h2-2.1.214.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/org.mariadb.jdbc/mariadb-java-client/3.0.9/8ebaa10da718ca9893e3c45e21951105cd6bfafb/mariadb-java-client-3.0.9.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/com.mysql/mysql-connector-j/8.0.31/3fd5850719d7e82d50705d34cc6a0037fab5731f/mysql-connector-j-8.0.31.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/org.mapstruct/mapstruct/1.3.1.Final/6ab184bbc7a7029738277a244e4c535fcdc3f558/mapstruct-1.3.1.Final.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/com.sun.activation/jakarta.activation/1.2.2/74548703f9851017ce2f556066659438019e7eb5/jakarta.activation-1.2.2.jar:/Users/junyss/Library/Application Support/JetBrains/Toolbox/apps/IDEA-U/ch-0/222.4459.24/IntelliJ IDEA.app/Contents/lib/idea_rt.jar com.junyharang.duplication_test.DuplicationTestApplication
๋Œ€์ƒ VM์— ์—ฐ๊ฒฐ๋˜์—ˆ์Šต๋‹ˆ๋‹ค, ์ฃผ์†Œ: '127.0.0.1:55113', ์ „์†ก: '์†Œ์ผ“'

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::                (v2.7.6)

2022-11-30 19:13:24.230  INFO 7762 --- [           main] c.j.d.DuplicationTestApplication         : Starting DuplicationTestApplication using Java 11.0.16 on juniui-MacBookPro.local with PID 7762 (/Users/junyss/Programming/study/Test/JunyHarangTest/mariaDB-duplication-Test/duplication_test/build/classes/java/main started by junyss in /Users/junyss/Programming/study/Test/JunyHarangTest/mariaDB-duplication-Test/duplication_test)
2022-11-30 19:13:24.231  INFO 7762 --- [           main] c.j.d.DuplicationTestApplication         : The following 3 profiles are active: "dev", "common", "dev-db"
2022-11-30 19:13:24.609  INFO 7762 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode.
2022-11-30 19:13:24.616  INFO 7762 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 3 ms. Found 0 JPA repository interfaces.
2022-11-30 19:13:24.900  INFO 7762 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8081 (http)
2022-11-30 19:13:24.905  INFO 7762 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2022-11-30 19:13:24.905  INFO 7762 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache Tomcat/9.0.69]
2022-11-30 19:13:24.972  INFO 7762 --- [           main] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2022-11-30 19:13:24.973  INFO 7762 --- [           main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 722 ms
2022-11-30 19:13:24.994  INFO 7762 --- [           main] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Starting...
2022-11-30 19:13:25.083  INFO 7762 --- [           main] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Start completed.
2022-11-30 19:13:25.090 ERROR 7762 --- [           main] com.zaxxer.hikari.HikariConfig           : HikariPool-2 - dataSource or dataSourceClassName or jdbcUrl is required.
2022-11-30 19:13:25.092  INFO 7762 --- [           main] com.zaxxer.hikari.HikariDataSource       : HikariPool-3 - Starting...
2022-11-30 19:13:25.804  INFO 7762 --- [           main] com.zaxxer.hikari.HikariDataSource       : HikariPool-3 - Start completed.
2022-11-30 19:13:25.812  INFO 7762 --- [           main] o.s.b.a.h2.H2ConsoleAutoConfiguration    : H2 console available at '/h2-console'. Databases available at 'jdbc:mysql://{Master DBMS IP:PORT}/repl_test?serverTimezone=UTC&characterEncoding=UTF-8', 'jdbc:mysql://{Slave DBMS IP:PORT}/repl_test?serverTimezone=UTC&characterEncoding=UTF-8', 'jdbc:mysql://{Master DBMS IP:PORT}/repl_test?serverTimezone=UTC&characterEncoding=UTF-8', 'jdbc:mysql://{Master DBMS IP:PORT}/repl_test?serverTimezone=UTC&characterEncoding=UTF-8'
2022-11-30 19:13:25.907  INFO 7762 --- [           main] o.hibernate.jpa.internal.util.LogHelper  : HHH000204: Processing PersistenceUnitInfo [name: default]
2022-11-30 19:13:25.927  INFO 7762 --- [           main] org.hibernate.Version                    : HHH000412: Hibernate ORM core version 5.6.14.Final
2022-11-30 19:13:25.985  INFO 7762 --- [           main] o.hibernate.annotations.common.Version   : HCANN000001: Hibernate Commons Annotations {5.1.2.Final}
2022-11-30 19:13:26.029  INFO 7762 --- [           main] org.hibernate.dialect.Dialect            : HHH000400: Using dialect: org.hibernate.dialect.MySQL5InnoDBDialect
2022-11-30 19:13:26.106  INFO 7762 --- [           main] o.h.e.t.j.p.i.JtaPlatformInitiator       : HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform]
2022-11-30 19:13:26.111  INFO 7762 --- [           main] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
2022-11-30 19:13:26.198  WARN 7762 --- [           main] JpaBaseConfiguration$JpaWebConfiguration : spring.jpa.open-in-view is enabled by default. Therefore, database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-view to disable this warning
2022-11-30 19:13:26.444  INFO 7762 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 8081 (http) with context path ''
2022-11-30 19:13:26.538  INFO 7762 --- [           main] c.j.d.DuplicationTestApplication         : Started DuplicationTestApplication in 2.552 seconds (JVM running for 2.939)


์œ„์™€ ๊ฐ™์ด ์ •์ƒ์ ์œผ๋กœ ์ž‘๋™ํ•˜๋Š” ๊ฒƒ์„ ํ™•์ธํ–ˆ์–ด์š”.

๊ทธ๋Ÿผ ๊ฐ„๋‹จํ•œ Test Code๋ฅผ ์ž‘์„ฑํ•ด์„œ ๋ณธ๊ฒฉ์ ์œผ๋กœ ์ž˜ ์ž‘๋™ํ•˜๋Š”์ง€ ํ™•์ธํ•ด๋ณผ๊ฒŒ์š”.

 

 

 

 

    ๐Ÿ”ฝ  ๊ฒ€์ฆ

        ๐Ÿ“ฆ ์ •์ƒ ์ž‘๋™ ์—ฌ๋ถ€ ํ™•์ธ

์ฃผ๋‹ˆํ•˜๋ž‘์€ Test๋ฅผ ์œ„ํ•ด ์•„๋ž˜์™€ ๊ฐ™์ด Controller, Service, Repository๋ฅผ ๋งŒ๋“ค์–ด ์ฃผ์—ˆ์–ด์š”.

JunyHarangTestController

 

JunyHarangTestService

 

package com.junyharang.duplication_test.service.Impl;

import com.junyharang.duplication_test.common.constant.DefaultResponse;
import com.junyharang.duplication_test.common.constant.DefaultResponseMessage;
import com.junyharang.duplication_test.model.dto.request.BoardRequestDTO;
import com.junyharang.duplication_test.model.dto.request.BoardUpdateRequestDTO;
import com.junyharang.duplication_test.model.dto.response.BoardResponseDTO;
import com.junyharang.duplication_test.model.entity.Board;
import com.junyharang.duplication_test.repository.BoardRepository;
import lombok.RequiredArgsConstructor;
import com.junyharang.duplication_test.service.JunyHarangTestService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Optional;

@RequiredArgsConstructor
@Service
public class JunyHarangTestServiceImpl implements JunyHarangTestService {

    private final BoardRepository boardRepository;

    @Override
    @Transactional
    public DefaultResponse<Long> insertBoard(BoardRequestDTO boardRequestDTO) {

        if (boardRequestDTO == null) {
            return DefaultResponse.response(DefaultResponseMessage.BAD_REQUEST,
                                            DefaultResponseMessage.KOREAN_400,
                                            DefaultResponseMessage.ENGLISH_400);
        }

        Board board = Board.builder()
                           .title(boardRequestDTO.getTitle())
                           .content(boardRequestDTO.getContent())
                           .build();

        Long saveId = boardRepository.save(board).getId();

        return DefaultResponse.response(DefaultResponseMessage.CREATE_SUCCESS,
                                        DefaultResponseMessage.KOREAN_201,
                                        DefaultResponseMessage.ENGLISH_201,
                                        saveId);
    }

    @Override
    @Transactional(readOnly = true)
    public DefaultResponse<List<Board>> getBoardList() {
        return DefaultResponse.response(
                DefaultResponseMessage.OK,
                DefaultResponseMessage.KOREAN_200,
                DefaultResponseMessage.ENGLISH_200,
                boardRepository.findAll());
    }

    @Override
    @Transactional(readOnly = true)
    public DefaultResponse<BoardResponseDTO> getBoard(Long id) {

        Optional<Board> boardById = findValueByID(id);

        if (boardById.isEmpty()) {
            return DefaultResponse.response(
                    DefaultResponseMessage.NOT_FOUND,
                    DefaultResponseMessage.KOREAN_404,
                    DefaultResponseMessage.ENGLISH_404);
        }

        return DefaultResponse.response(
                DefaultResponseMessage.OK,
                DefaultResponseMessage.KOREAN_200,
                DefaultResponseMessage.ENGLISH_200,

                BoardResponseDTO.builder()
                                .id(boardById.get().getId())
                                .title(boardById.get().getTitle())
                                .content(boardById.get().getContent())
                                .build());
    }

    @Override
    @Transactional
    public DefaultResponse<Long> updateBoard(Long id, BoardUpdateRequestDTO boardUpdateRequestDTO) {
        Optional<Board> boardById = findValueByID(id);

        if (boardById.isEmpty()) {
            return DefaultResponse.response(
                    DefaultResponseMessage.NOT_FOUND,
                    DefaultResponseMessage.KOREAN_404,
                    DefaultResponseMessage.ENGLISH_404);
        }

        Board updateBoard = boardById.get().update(boardUpdateRequestDTO);

        return DefaultResponse.response(
                DefaultResponseMessage.CREATE_SUCCESS,
                DefaultResponseMessage.KOREAN_201,
                DefaultResponseMessage.ENGLISH_201,
                boardRepository.save(updateBoard).getId());

    }

    @Override
    @Transactional
    public DefaultResponse<Long> deleteBoard(Long id) {

        Optional<Board> boardById = findValueByID(id);

        if (boardById.isEmpty()) {
            return DefaultResponse.response(
                    DefaultResponseMessage.NOT_FOUND,
                    DefaultResponseMessage.KOREAN_404,
                    DefaultResponseMessage.ENGLISH_404);
        }

        boardRepository.delete(boardById.get());

        return DefaultResponse.response(
                DefaultResponseMessage.OK,
                DefaultResponseMessage.KOREAN_200,
                DefaultResponseMessage.ENGLISH_200,
                id);
    }

    @Transactional(readOnly = true)
    public Optional<Board> findValueByID(Long id) {
        return boardRepository.findById(id);
    }
}

JunyHarangTestServiceImpl

728x90

BoardRepository




Board

 

์ž์„ธํ•œ Source Code๋Š” ์ฃผ๋‹ˆํ•˜๋ž‘์˜ GitHub ์ด ๊ณณ์— ์˜ฌ๋ ค๋‘์—ˆ์–ด์š”.

์œ„์™€ ๊ฐ™์ด ๋งŒ๋“ค๊ณ  ๋‚œ ๋’ค Spring Boot๋ฅผ ๊ธฐ๋™ํ•˜๋‹ˆ Data Base์— Table์ด ์ƒ๊ธด๊ฑธ ํ™•์ธํ•  ์ˆ˜ ์žˆ์—ˆ์–ด์š”.

Console์— ์ฐํžŒ Log๋Š” ์•„๋ž˜์™€ ๊ฐ™์ด ๋‚˜์™”์–ด์š”.

/Users/junyss/Library/Java/JavaVirtualMachines/azul-11.0.16/Contents/Home/bin/java -agentlib:jdwp=transport=dt_socket,address=127.0.0.1:56100,suspend=y,server=n -XX:TieredStopAtLevel=1 -noverify -Dspring.profiles.active=dev -Dspring.output.ansi.enabled=always -Dcom.sun.management.jmxremote -Dspring.jmx.enabled=true -Dspring.liveBeansView.mbeanDomain -Dspring.application.admin.enabled=true -javaagent:/Users/junyss/Library/Caches/JetBrains/IntelliJIdea2022.2/captureAgent/debugger-agent.jar -Dfile.encoding=UTF-8 -classpath /Users/junyss/Programming/study/Test/JunyHarangTest/mariaDB-duplication-Test/duplication_test/build/classes/java/main:/Users/junyss/Programming/study/Test/JunyHarangTest/mariaDB-duplication-Test/duplication_test/build/resources/main:/Users/junyss/.gradle/caches/modules-2/files-2.1/org.projectlombok/lombok/1.18.24/13a394eed5c4f9efb2a6d956e2086f1d81e857d9/lombok-1.18.24.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/org.springframework.boot/spring-boot-starter-data-jpa/2.7.6/7eef599012347f2fb7f84ba71eba10caf094dfb5/spring-boot-starter-data-jpa-2.7.6.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/org.springframework.boot/spring-boot-starter-web/2.7.6/9d0166a0390df593243bdc798ca7a1db20ddea9c/spring-boot-starter-web-2.7.6.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/io.springfox/springfox-boot-starter/3.0.0/5486365e263f8acca014b97efa50c3419d58e8f6/springfox-boot-starter-3.0.0.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/org.springframework.boot/spring-boot-starter-aop/2.7.6/23061de1832242610092f212f99d49b9a4955a9d/spring-boot-starter-aop-2.7.6.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/org.springframework.boot/spring-boot-starter-jdbc/2.7.6/9db6def4ba06a11b67f0de3eac83441d00350dd6/spring-boot-starter-jdbc-2.7.6.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/jakarta.transaction/jakarta.transaction-api/1.3.3/c4179d48720a1e87202115fbed6089bdc4195405/jakarta.transaction-api-1.3.3.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/jakarta.persistence/jakarta.persistence-api/2.2.3/8f6ea5daedc614f07a3654a455660145286f024e/jakarta.persistence-api-2.2.3.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/org.hibernate/hibernate-core/5.6.14.Final/71e407089b71ed7c6e99385fd851c308fed7be44/hibernate-core-5.6.14.Final.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/org.springframework.data/spring-data-jpa/2.7.6/8d0414f5cca5e31509943cd5f97cacdddd7c7384/spring-data-jpa-2.7.6.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/org.springframework/spring-aspects/5.3.24/e97d36c3e516d3dd0579437428b6e26902da0c88/spring-aspects-5.3.24.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/org.springframework.boot/spring-boot-starter-json/2.7.6/77017e2aa78224c3fa10444d659c2ce8765b910/spring-boot-starter-json-2.7.6.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/org.springframework.boot/spring-boot-starter/2.7.6/d15341c0fc0b1d1362ce6c737b34679ad1f836c/spring-boot-starter-2.7.6.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/org.springframework.boot/spring-boot-starter-tomcat/2.7.6/ec920cd7f951f3cff3a0b7af80bb8f7116a3d8a5/spring-boot-starter-tomcat-2.7.6.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/org.springframework/spring-webmvc/5.3.24/33d2187c2bf1cb2c222bd1cc18b618736babcf3d/spring-webmvc-5.3.24.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/org.springframework/spring-web/5.3.24/d89bbcaabb1ff247a089875cbc4211bfe96c9a59/spring-web-5.3.24.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/io.springfox/springfox-oas/3.0.0/e7bc9c1319cf1b64ae714a249c3db3b8fe01e42b/springfox-oas-3.0.0.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/io.springfox/springfox-data-rest/3.0.0/40f5e834d6696ae1d3212fa5a2d5e1ec406bedc0/springfox-data-rest-3.0.0.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/io.springfox/springfox-bean-validators/3.0.0/80c646fdebe5f2b2b337a5a686e540fee0b7304f/springfox-bean-validators-3.0.0.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/io.springfox/springfox-swagger2/3.0.0/7bcb18d496576eff76ef7bb72684e149cbb75c1d/springfox-swagger2-3.0.0.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/io.springfox/springfox-swagger-ui/3.0.0/1e665fbe22148f7c36fa8a08e515a0047cd4390b/springfox-swagger-ui-3.0.0.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/com.fasterxml/classmate/1.5.1/3fe0bed568c62df5e89f4f174c101eab25345b6c/classmate-1.5.1.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/org.springframework.plugin/spring-plugin-metadata/2.0.0.RELEASE/6fb3a1fc0f05dc826687b7686ad8a5960ecdd57c/spring-plugin-metadata-2.0.0.RELEASE.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/org.springframework.plugin/spring-plugin-core/2.0.0.RELEASE/95fc8c13037630f4aba9c51141f535becec00fe6/spring-plugin-core-2.0.0.RELEASE.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/org.slf4j/slf4j-api/1.7.36/6c62681a2f655b49963a5983b8b0950a6120ae14/slf4j-api-1.7.36.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/org.springframework/spring-aop/5.3.24/efd01bc1048a2e1b6a7442fbd78170bc02c342b7/spring-aop-5.3.24.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/org.aspectj/aspectjweaver/1.9.7/158f5c255cd3e4408e795b79f7c3fbae9b53b7ca/aspectjweaver-1.9.7.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/com.zaxxer/HikariCP/4.0.3/107cbdf0db6780a065f895ae9d8fbf3bb0e1c21f/HikariCP-4.0.3.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/org.springframework/spring-jdbc/5.3.24/909c19ab470a59b9fd23177d26b8e880733b15d4/spring-jdbc-5.3.24.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/org.hibernate.common/hibernate-commons-annotations/5.1.2.Final/e59ffdbc6ad09eeb33507b39ffcf287679a498c8/hibernate-commons-annotations-5.1.2.Final.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/org.jboss.logging/jboss-logging/3.4.3.Final/c4bd7e12a745c0e7f6cf98c45cdcdf482fd827ea/jboss-logging-3.4.3.Final.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/net.bytebuddy/byte-buddy/1.12.19/178d26e6a95e50502ae16673e08269797f8b254a/byte-buddy-1.12.19.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/antlr/antlr/2.7.7/83cd2cd674a217ade95a4bb83a8a14f351f48bd0/antlr-2.7.7.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/org.jboss/jandex/2.4.2.Final/1e1c385990b258ff1a24c801e84aebbacf70eb39/jandex-2.4.2.Final.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/org.glassfish.jaxb/jaxb-runtime/2.3.7/ebcde6a44159eb9e3db721dfe6b45f26e6272341/jaxb-runtime-2.3.7.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/org.springframework.data/spring-data-commons/2.7.6/e3d15a8f4d5ef0d2323569445c66903d0188cb68/spring-data-commons-2.7.6.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/org.springframework/spring-context/5.3.24/e48634d7b8f40d4d0fe978830be0247bfc2ff2cd/spring-context-5.3.24.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/org.springframework/spring-orm/5.3.24/256e029c2d8200294fe7fb5352ca2d1d7310dcad/spring-orm-5.3.24.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/org.springframework/spring-tx/5.3.24/175a2157fce17669af6d4db1d094cb4baaa5c8fd/spring-tx-5.3.24.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/org.springframework/spring-beans/5.3.24/e487ea6de09b9a7c36548028feeafa511a593532/spring-beans-5.3.24.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/org.springframework/spring-core/5.3.24/d095c329f30baf2b6d44eccbd2352d7a2f840c72/spring-core-5.3.24.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/com.fasterxml.jackson.datatype/jackson-datatype-jsr310/2.13.4/e6d820112871f33cd94a1dcc54eef58874753b5/jackson-datatype-jsr310-2.13.4.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/com.fasterxml.jackson.module/jackson-module-parameter-names/2.13.4/858ccf6624b5fac6044813e845063edb6a62cf37/jackson-module-parameter-names-2.13.4.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/com.fasterxml.jackson.datatype/jackson-datatype-jdk8/2.13.4/557dbba5d8dfc7b7f944c58fe084109afcb5670b/jackson-datatype-jdk8-2.13.4.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/com.fasterxml.jackson.core/jackson-databind/2.13.4.2/325c06bdfeb628cfb80ebaaf1a26cc1eb558a585/jackson-databind-2.13.4.2.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/org.springframework.boot/spring-boot-starter-logging/2.7.6/33a2d9e08d33a6a6f8051ed38daac14046e2f97c/spring-boot-starter-logging-2.7.6.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/org.springframework.boot/spring-boot-autoconfigure/2.7.6/4ad7e89accd25c69bfe84f52202deaf09430be2/spring-boot-autoconfigure-2.7.6.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/org.springframework.boot/spring-boot/2.7.6/f96f89eba708a591704db5dcbfc03e8822a503aa/spring-boot-2.7.6.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/jakarta.annotation/jakarta.annotation-api/1.3.5/59eb84ee0d616332ff44aba065f3888cf002cd2d/jakarta.annotation-api-1.3.5.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/org.yaml/snakeyaml/1.30/8fde7fe2586328ac3c68db92045e1c8759125000/snakeyaml-1.30.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/org.apache.tomcat.embed/tomcat-embed-websocket/9.0.69/c5da77c17a667b4e7a6bb01fb3b28c46c2717123/tomcat-embed-websocket-9.0.69.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/org.apache.tomcat.embed/tomcat-embed-core/9.0.69/27f2530eba96238aca56593bbd98edfdb038d9ef/tomcat-embed-core-9.0.69.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/org.apache.tomcat.embed/tomcat-embed-el/9.0.69/9c89a289c35b9ec20bdfb692a22dab87256bbe67/tomcat-embed-el-9.0.69.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/org.springframework/spring-expression/5.3.24/ae7410418e7b4bd27a01e3fb1c2fed35b2bc1e84/spring-expression-5.3.24.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/io.springfox/springfox-swagger-common/3.0.0/2e2fae840984cfcabfd50e1b4b1c23422135ba12/springfox-swagger-common-3.0.0.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/io.springfox/springfox-spring-webmvc/3.0.0/7ed22363fdfd651cd811c0b2391f16bddb91db8b/springfox-spring-webmvc-3.0.0.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/io.springfox/springfox-spring-web/3.0.0/a76f2fbe805bfd2798e20dc8f2cfbfad554d52da/springfox-spring-web-3.0.0.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/io.springfox/springfox-schema/3.0.0/32c5d6965617830ef6480fadb9030008945bcd9c/springfox-schema-3.0.0.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/io.springfox/springfox-spi/3.0.0/bae0b820d4b5a922063d34a42aaf4f763308b828/springfox-spi-3.0.0.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/io.springfox/springfox-core/3.0.0/7c3367ce577c8acd9bf64c74488c9269253516c9/springfox-core-3.0.0.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/io.springfox/springfox-spring-webflux/3.0.0/efccbcfe1d23f2ba520bd87cc156bf2b81f3568e/springfox-spring-webflux-3.0.0.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/io.swagger.core.v3/swagger-models/2.1.2/e7edeed6456a16d707542c003af03a594ecafe3a/swagger-models-2.1.2.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/io.swagger.core.v3/swagger-annotations/2.1.2/d407a33aa71444802c640080eb4d5f499b027f96/swagger-annotations-2.1.2.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/io.swagger/swagger-models/1.5.20/fb3a23bad80c5ed84db9dd150db2cba699531458/swagger-models-1.5.20.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/io.swagger/swagger-annotations/1.5.20/16051f93ce11ca489a5313775d825f82fcc2cd6c/swagger-annotations-1.5.20.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/jakarta.xml.bind/jakarta.xml.bind-api/2.3.3/48e3b9cfc10752fba3521d6511f4165bea951801/jakarta.xml.bind-api-2.3.3.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/org.glassfish.jaxb/txw2/2.3.7/55cddcac1945150e09b09b0f89d86799652eee82/txw2-2.3.7.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/com.sun.istack/istack-commons-runtime/3.0.12/cbbe1a62b0cc6c85972e99d52aaee350153dc530/istack-commons-runtime-3.0.12.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/org.springframework/spring-jcl/5.3.24/2b30878663ceed2af07238dc54e92e5bf001438d/spring-jcl-5.3.24.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/com.fasterxml.jackson.core/jackson-annotations/2.13.4/858c6cc78e1f08a885b1613e1d817c829df70a6e/jackson-annotations-2.13.4.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/com.fasterxml.jackson.core/jackson-core/2.13.4/cf934c681294b97ef6d80082faeefbe1edadf56/jackson-core-2.13.4.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/ch.qos.logback/logback-classic/1.2.11/4741689214e9d1e8408b206506cbe76d1c6a7d60/logback-classic-1.2.11.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/org.apache.logging.log4j/log4j-to-slf4j/2.17.2/17dd0fae2747d9a28c67bc9534108823d2376b46/log4j-to-slf4j-2.17.2.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/org.slf4j/jul-to-slf4j/1.7.36/ed46d81cef9c412a88caef405b58f93a678ff2ca/jul-to-slf4j-1.7.36.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/io.github.classgraph/classgraph/4.8.83/7be289f451cedf9e35ed97caba3953226b4e6d9/classgraph-4.8.83.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/ch.qos.logback/logback-core/1.2.11/a01230df5ca5c34540cdaa3ad5efb012f1f1f792/logback-core-1.2.11.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/org.apache.logging.log4j/log4j-api/2.17.2/f42d6afa111b4dec5d2aea0fe2197240749a4ea6/log4j-api-2.17.2.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/com.h2database/h2/2.1.214/d5c2005c9e3279201e12d4776c948578b16bf8b2/h2-2.1.214.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/org.mariadb.jdbc/mariadb-java-client/3.0.9/8ebaa10da718ca9893e3c45e21951105cd6bfafb/mariadb-java-client-3.0.9.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/com.mysql/mysql-connector-j/8.0.31/3fd5850719d7e82d50705d34cc6a0037fab5731f/mysql-connector-j-8.0.31.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/org.mapstruct/mapstruct/1.3.1.Final/6ab184bbc7a7029738277a244e4c535fcdc3f558/mapstruct-1.3.1.Final.jar:/Users/junyss/.gradle/caches/modules-2/files-2.1/com.sun.activation/jakarta.activation/1.2.2/74548703f9851017ce2f556066659438019e7eb5/jakarta.activation-1.2.2.jar:/Users/junyss/Library/Application Support/JetBrains/Toolbox/apps/IDEA-U/ch-0/222.4459.24/IntelliJ IDEA.app/Contents/lib/idea_rt.jar com.junyharang.duplication_test.DuplicationTestApplication
๋Œ€์ƒ VM์— ์—ฐ๊ฒฐ๋˜์—ˆ์Šต๋‹ˆ๋‹ค, ์ฃผ์†Œ: '127.0.0.1:56100', ์ „์†ก: '์†Œ์ผ“'

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::                (v2.7.6)

2022-11-30 21:06:46.055  INFO 9513 --- [           main] c.j.d.DuplicationTestApplication         : Starting DuplicationTestApplication using Java 11.0.16 on juniui-MacBookPro.local with PID 9513 (/Users/junyss/Programming/study/Test/JunyHarangTest/mariaDB-duplication-Test/duplication_test/build/classes/java/main started by junyss in /Users/junyss/Programming/study/Test/JunyHarangTest/mariaDB-duplication-Test/duplication_test)
2022-11-30 21:06:46.056  INFO 9513 --- [           main] c.j.d.DuplicationTestApplication         : The following 3 profiles are active: "dev", "common", "dev-db"
2022-11-30 21:06:46.453  INFO 9513 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode.
2022-11-30 21:06:46.480  INFO 9513 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 23 ms. Found 1 JPA repository interfaces.
2022-11-30 21:06:46.774  INFO 9513 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8080 (http)
2022-11-30 21:06:46.779  INFO 9513 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2022-11-30 21:06:46.779  INFO 9513 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache Tomcat/9.0.69]
2022-11-30 21:06:46.835  INFO 9513 --- [           main] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2022-11-30 21:06:46.835  INFO 9513 --- [           main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 756 ms
2022-11-30 21:06:46.879  INFO 9513 --- [           main] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Starting...
2022-11-30 21:06:46.968  INFO 9513 --- [           main] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Start completed.
2022-11-30 21:06:47.026  INFO 9513 --- [           main] o.hibernate.jpa.internal.util.LogHelper  : HHH000204: Processing PersistenceUnitInfo [name: default]
2022-11-30 21:06:47.045  INFO 9513 --- [           main] org.hibernate.Version                    : HHH000412: Hibernate ORM core version 5.6.14.Final
2022-11-30 21:06:47.107  INFO 9513 --- [           main] o.hibernate.annotations.common.Version   : HCANN000001: Hibernate Commons Annotations {5.1.2.Final}
2022-11-30 21:06:47.152  INFO 9513 --- [           main] org.hibernate.dialect.Dialect            : HHH000400: Using dialect: org.hibernate.dialect.MySQL5InnoDBDialect
Hibernate: 
    
    drop table if exists board
Hibernate: 
    
    create table board (
       id bigint not null auto_increment,
        create_date_time datetime,
        modified_date_time datetime,
        content TEXT not null,
        title varchar(500) not null,
        primary key (id)
    ) engine=InnoDB
2022-11-30 21:06:50.134  INFO 9513 --- [           main] o.h.e.t.j.p.i.JtaPlatformInitiator       : HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform]
2022-11-30 21:06:50.145  INFO 9513 --- [           main] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
2022-11-30 21:06:50.366  WARN 9513 --- [           main] JpaBaseConfiguration$JpaWebConfiguration : spring.jpa.open-in-view is enabled by default. Therefore, database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-view to disable this warning
2022-11-30 21:06:50.615  INFO 9513 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 8080 (http) with context path ''
2022-11-30 21:06:50.745  INFO 9513 --- [           main] c.j.d.DuplicationTestApplication         : Started DuplicationTestApplication in 4.908 seconds (JVM running for 5.291)


์œ„์™€ ๊ฐ™์ด Table์ด ๋งŒ๋“ค์–ด์ง„๊ฑธ ์•Œ ์ˆ˜ ์žˆ์–ด์š”.

Master DBMS

 

Master DBMS




Master์—์„œ board๋ผ๋Š” Table์„ ํ™•์ธํ•  ์ˆ˜ ์žˆ์–ด์š”.


Slave DBMS


Slave DBMS์—๋„ ๋™์ผํ•˜๊ฒŒ Table๊ณผ DB๋“ฑ์ด ๋งŒ๋“ค์–ด์ง„๊ฑธ ํ™•์ธํ•  ์ˆ˜ ์žˆ์–ด์š”.


๋งŒ์•ฝ ์•„๋ž˜์™€ ๊ฐ™์€ ๋ฌธ์ œ๊ฐ€ ๋‚˜์˜จ๋‹ค๋ฉด 

๋Œ€์ƒ VM์— ์—ฐ๊ฒฐ๋˜์—ˆ์Šต๋‹ˆ๋‹ค, ์ฃผ์†Œ: '127.0.0.1:56228', ์ „์†ก: '์†Œ์ผ“'

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::                (v2.7.6)

2022-11-30 21:14:59.300  INFO 9710 --- [           main] c.j.d.DuplicationTestApplication         : Starting DuplicationTestApplication using Java 11.0.16 on juniui-MacBookPro.local with PID 9710 (/Users/junyss/Programming/study/Test/JunyHarangTest/mariaDB-duplication-Test/duplication_test/build/classes/java/main started by junyss in /Users/junyss/Programming/study/Test/JunyHarangTest/mariaDB-duplication-Test/duplication_test)
2022-11-30 21:14:59.301  INFO 9710 --- [           main] c.j.d.DuplicationTestApplication         : The following 3 profiles are active: "dev", "common", "dev-db"
2022-11-30 21:14:59.677  INFO 9710 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode.
2022-11-30 21:14:59.706  INFO 9710 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 25 ms. Found 1 JPA repository interfaces.
2022-11-30 21:15:00.000  INFO 9710 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8080 (http)
2022-11-30 21:15:00.005  INFO 9710 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2022-11-30 21:15:00.005  INFO 9710 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache Tomcat/9.0.69]
2022-11-30 21:15:00.075  INFO 9710 --- [           main] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2022-11-30 21:15:00.075  INFO 9710 --- [           main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 754 ms
2022-11-30 21:15:00.121  INFO 9710 --- [           main] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Starting...
2022-11-30 21:15:31.198 ERROR 9710 --- [           main] com.zaxxer.hikari.pool.HikariPool        : HikariPool-1 - Exception during pool initialization.

com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure

The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
	at com.mysql.cj.jdbc.exceptions.SQLError.createCommunicationsException(SQLError.java:174) ~[mysql-connector-j-8.0.31.jar:8.0.31]
	at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:64) ~[mysql-connector-j-8.0.31.jar:8.0.31]
	at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:828) ~[mysql-connector-j-8.0.31.jar:8.0.31]
	at com.mysql.cj.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:448) ~[mysql-connector-j-8.0.31.jar:8.0.31]
	at com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:241) ~[mysql-connector-j-8.0.31.jar:8.0.31]
	at com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:198) ~[mysql-connector-j-8.0.31.jar:8.0.31]
	at com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:138) ~[HikariCP-4.0.3.jar:na]
	at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:364) ~[HikariCP-4.0.3.jar:na]
	at com.zaxxer.hikari.pool.PoolBase.newPoolEntry(PoolBase.java:206) ~[HikariCP-4.0.3.jar:na]
	at com.zaxxer.hikari.pool.HikariPool.createPoolEntry(HikariPool.java:476) ~[HikariCP-4.0.3.jar:na]
	at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:561) ~[HikariCP-4.0.3.jar:na]
	at com.zaxxer.hikari.pool.HikariPool.<init>(HikariPool.java:115) ~[HikariCP-4.0.3.jar:na]
	at com.zaxxer.hikari.HikariDataSource.getConnection(HikariDataSource.java:112) ~[HikariCP-4.0.3.jar:na]
	at org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource.getConnection(AbstractRoutingDataSource.java:194) ~[spring-jdbc-5.3.24.jar:5.3.24]
	at org.springframework.jdbc.datasource.LazyConnectionDataSourceProxy.afterPropertiesSet(LazyConnectionDataSourceProxy.java:164) ~[spring-jdbc-5.3.24.jar:5.3.24]
	at org.springframework.jdbc.datasource.LazyConnectionDataSourceProxy.<init>(LazyConnectionDataSourceProxy.java:108) ~[spring-jdbc-5.3.24.jar:5.3.24]
	at com.junyharang.duplication_test.common.config.DataBase.DataSourceConfiguration.dataSource(DataSourceConfiguration.java:58) ~[main/:na]
	at com.junyharang.duplication_test.common.config.DataBase.DataSourceConfiguration$$EnhancerBySpringCGLIB$$1b143e2e.CGLIB$dataSource$3(<generated>) ~[main/:na]
	at com.junyharang.duplication_test.common.config.DataBase.DataSourceConfiguration$$EnhancerBySpringCGLIB$$1b143e2e$$FastClassBySpringCGLIB$$4600f72a.invoke(<generated>) ~[main/:na]
	at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:244) ~[spring-core-5.3.24.jar:5.3.24]
	at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:331) ~[spring-context-5.3.24.jar:5.3.24]
	at com.junyharang.duplication_test.common.config.DataBase.DataSourceConfiguration$$EnhancerBySpringCGLIB$$1b143e2e.dataSource(<generated>) ~[main/:na]
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:na]
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
	at java.base/java.lang.reflect.Method.invoke(Method.java:566) ~[na:na]
	at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154) ~[spring-beans-5.3.24.jar:5.3.24]
	at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:653) ~[spring-beans-5.3.24.jar:5.3.24]
	at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:638) ~[spring-beans-5.3.24.jar:5.3.24]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1352) ~[spring-beans-5.3.24.jar:5.3.24]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1195) ~[spring-beans-5.3.24.jar:5.3.24]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582) ~[spring-beans-5.3.24.jar:5.3.24]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542) ~[spring-beans-5.3.24.jar:5.3.24]
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.24.jar:5.3.24]
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.24.jar:5.3.24]
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.24.jar:5.3.24]
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.24.jar:5.3.24]
	at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276) ~[spring-beans-5.3.24.jar:5.3.24]
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1391) ~[spring-beans-5.3.24.jar:5.3.24]
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1311) ~[spring-beans-5.3.24.jar:5.3.24]
	at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:887) ~[spring-beans-5.3.24.jar:5.3.24]
	at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:791) ~[spring-beans-5.3.24.jar:5.3.24]
	at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:541) ~[spring-beans-5.3.24.jar:5.3.24]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1352) ~[spring-beans-5.3.24.jar:5.3.24]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1195) ~[spring-beans-5.3.24.jar:5.3.24]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582) ~[spring-beans-5.3.24.jar:5.3.24]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542) ~[spring-beans-5.3.24.jar:5.3.24]
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.24.jar:5.3.24]
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.24.jar:5.3.24]
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.24.jar:5.3.24]
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.24.jar:5.3.24]
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322) ~[spring-beans-5.3.24.jar:5.3.24]
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.24.jar:5.3.24]
	at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1154) ~[spring-context-5.3.24.jar:5.3.24]
	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:908) ~[spring-context-5.3.24.jar:5.3.24]
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583) ~[spring-context-5.3.24.jar:5.3.24]
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:147) ~[spring-boot-2.7.6.jar:2.7.6]
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:731) ~[spring-boot-2.7.6.jar:2.7.6]
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:408) ~[spring-boot-2.7.6.jar:2.7.6]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:307) ~[spring-boot-2.7.6.jar:2.7.6]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1303) ~[spring-boot-2.7.6.jar:2.7.6]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1292) ~[spring-boot-2.7.6.jar:2.7.6]
	at com.junyharang.duplication_test.DuplicationTestApplication.main(DuplicationTestApplication.java:11) ~[main/:na]
Caused by: com.mysql.cj.exceptions.CJCommunicationsException: Communications link failure

The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:na]
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[na:na]
	at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:na]
	at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490) ~[na:na]
	at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:61) ~[mysql-connector-j-8.0.31.jar:8.0.31]
	at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:105) ~[mysql-connector-j-8.0.31.jar:8.0.31]
	at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:151) ~[mysql-connector-j-8.0.31.jar:8.0.31]
	at com.mysql.cj.exceptions.ExceptionFactory.createCommunicationsException(ExceptionFactory.java:167) ~[mysql-connector-j-8.0.31.jar:8.0.31]
	at com.mysql.cj.protocol.a.NativeSocketConnection.connect(NativeSocketConnection.java:89) ~[mysql-connector-j-8.0.31.jar:8.0.31]
	at com.mysql.cj.NativeSession.connect(NativeSession.java:120) ~[mysql-connector-j-8.0.31.jar:8.0.31]
	at com.mysql.cj.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:948) ~[mysql-connector-j-8.0.31.jar:8.0.31]
	at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:818) ~[mysql-connector-j-8.0.31.jar:8.0.31]
	... 60 common frames omitted
Caused by: java.net.SocketTimeoutException: connect timed out
	at java.base/java.net.PlainSocketImpl.socketConnect(Native Method) ~[na:na]
	at java.base/java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:412) ~[na:na]
	at java.base/java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:255) ~[na:na]
	at java.base/java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:237) ~[na:na]
	at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) ~[na:na]
	at java.base/java.net.Socket.connect(Socket.java:615) ~[na:na]
	at com.mysql.cj.protocol.StandardSocketFactory.connect(StandardSocketFactory.java:153) ~[mysql-connector-j-8.0.31.jar:8.0.31]
	at com.mysql.cj.protocol.a.NativeSocketConnection.connect(NativeSocketConnection.java:63) ~[mysql-connector-j-8.0.31.jar:8.0.31]
	... 63 common frames omitted

2022-11-30 21:15:31.201  INFO 9710 --- [           main] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Starting...
2022-11-30 21:16:02.215 ERROR 9710 --- [           main] com.zaxxer.hikari.pool.HikariPool        : HikariPool-1 - Exception during pool initialization.

com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure

The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
	at com.mysql.cj.jdbc.exceptions.SQLError.createCommunicationsException(SQLError.java:174) ~[mysql-connector-j-8.0.31.jar:8.0.31]
	at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:64) ~[mysql-connector-j-8.0.31.jar:8.0.31]
	at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:828) ~[mysql-connector-j-8.0.31.jar:8.0.31]
	at com.mysql.cj.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:448) ~[mysql-connector-j-8.0.31.jar:8.0.31]
	at com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:241) ~[mysql-connector-j-8.0.31.jar:8.0.31]
	at com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:198) ~[mysql-connector-j-8.0.31.jar:8.0.31]
	at com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:138) ~[HikariCP-4.0.3.jar:na]
	at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:364) ~[HikariCP-4.0.3.jar:na]
	at com.zaxxer.hikari.pool.PoolBase.newPoolEntry(PoolBase.java:206) ~[HikariCP-4.0.3.jar:na]
	at com.zaxxer.hikari.pool.HikariPool.createPoolEntry(HikariPool.java:476) ~[HikariCP-4.0.3.jar:na]
	at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:561) ~[HikariCP-4.0.3.jar:na]
	at com.zaxxer.hikari.pool.HikariPool.<init>(HikariPool.java:115) ~[HikariCP-4.0.3.jar:na]
	at com.zaxxer.hikari.HikariDataSource.getConnection(HikariDataSource.java:112) ~[HikariCP-4.0.3.jar:na]
	at org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource.getConnection(AbstractRoutingDataSource.java:194) ~[spring-jdbc-5.3.24.jar:5.3.24]
	at org.springframework.jdbc.datasource.LazyConnectionDataSourceProxy.afterPropertiesSet(LazyConnectionDataSourceProxy.java:164) ~[spring-jdbc-5.3.24.jar:5.3.24]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1863) ~[spring-beans-5.3.24.jar:5.3.24]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1800) ~[spring-beans-5.3.24.jar:5.3.24]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:620) ~[spring-beans-5.3.24.jar:5.3.24]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542) ~[spring-beans-5.3.24.jar:5.3.24]
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.24.jar:5.3.24]
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.24.jar:5.3.24]
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.24.jar:5.3.24]
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.24.jar:5.3.24]
	at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276) ~[spring-beans-5.3.24.jar:5.3.24]
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1391) ~[spring-beans-5.3.24.jar:5.3.24]
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1311) ~[spring-beans-5.3.24.jar:5.3.24]
	at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:887) ~[spring-beans-5.3.24.jar:5.3.24]
	at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:791) ~[spring-beans-5.3.24.jar:5.3.24]
	at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:541) ~[spring-beans-5.3.24.jar:5.3.24]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1352) ~[spring-beans-5.3.24.jar:5.3.24]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1195) ~[spring-beans-5.3.24.jar:5.3.24]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582) ~[spring-beans-5.3.24.jar:5.3.24]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542) ~[spring-beans-5.3.24.jar:5.3.24]
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.24.jar:5.3.24]
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.24.jar:5.3.24]
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.24.jar:5.3.24]
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.24.jar:5.3.24]
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322) ~[spring-beans-5.3.24.jar:5.3.24]
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.24.jar:5.3.24]
	at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1154) ~[spring-context-5.3.24.jar:5.3.24]
	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:908) ~[spring-context-5.3.24.jar:5.3.24]
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583) ~[spring-context-5.3.24.jar:5.3.24]
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:147) ~[spring-boot-2.7.6.jar:2.7.6]
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:731) ~[spring-boot-2.7.6.jar:2.7.6]
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:408) ~[spring-boot-2.7.6.jar:2.7.6]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:307) ~[spring-boot-2.7.6.jar:2.7.6]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1303) ~[spring-boot-2.7.6.jar:2.7.6]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1292) ~[spring-boot-2.7.6.jar:2.7.6]
	at com.junyharang.duplication_test.DuplicationTestApplication.main(DuplicationTestApplication.java:11) ~[main/:na]
Caused by: com.mysql.cj.exceptions.CJCommunicationsException: Communications link failure

The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:na]
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[na:na]
	at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:na]
	at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490) ~[na:na]
	at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:61) ~[mysql-connector-j-8.0.31.jar:8.0.31]
	at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:105) ~[mysql-connector-j-8.0.31.jar:8.0.31]
	at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:151) ~[mysql-connector-j-8.0.31.jar:8.0.31]
	at com.mysql.cj.exceptions.ExceptionFactory.createCommunicationsException(ExceptionFactory.java:167) ~[mysql-connector-j-8.0.31.jar:8.0.31]
	at com.mysql.cj.protocol.a.NativeSocketConnection.connect(NativeSocketConnection.java:89) ~[mysql-connector-j-8.0.31.jar:8.0.31]
	at com.mysql.cj.NativeSession.connect(NativeSession.java:120) ~[mysql-connector-j-8.0.31.jar:8.0.31]
	at com.mysql.cj.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:948) ~[mysql-connector-j-8.0.31.jar:8.0.31]
	at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:818) ~[mysql-connector-j-8.0.31.jar:8.0.31]
	... 46 common frames omitted
Caused by: java.net.SocketTimeoutException: connect timed out
	at java.base/java.net.PlainSocketImpl.socketConnect(Native Method) ~[na:na]
	at java.base/java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:412) ~[na:na]
	at java.base/java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:255) ~[na:na]
	at java.base/java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:237) ~[na:na]
	at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) ~[na:na]
	at java.base/java.net.Socket.connect(Socket.java:615) ~[na:na]
	at com.mysql.cj.protocol.StandardSocketFactory.connect(StandardSocketFactory.java:153) ~[mysql-connector-j-8.0.31.jar:8.0.31]
	at com.mysql.cj.protocol.a.NativeSocketConnection.connect(NativeSocketConnection.java:63) ~[mysql-connector-j-8.0.31.jar:8.0.31]
	... 49 common frames omitted

2022-11-30 21:16:02.296  INFO 9710 --- [           main] o.hibernate.jpa.internal.util.LogHelper  : HHH000204: Processing PersistenceUnitInfo [name: default]
2022-11-30 21:16:02.318  INFO 9710 --- [           main] org.hibernate.Version                    : HHH000412: Hibernate ORM core version 5.6.14.Final
2022-11-30 21:16:02.377  INFO 9710 --- [           main] o.hibernate.annotations.common.Version   : HCANN000001: Hibernate Commons Annotations {5.1.2.Final}
2022-11-30 21:16:02.419  INFO 9710 --- [           main] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Starting...
2022-11-30 21:16:33.429 ERROR 9710 --- [           main] com.zaxxer.hikari.pool.HikariPool        : HikariPool-1 - Exception during pool initialization.

com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure

The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
	at com.mysql.cj.jdbc.exceptions.SQLError.createCommunicationsException(SQLError.java:174) ~[mysql-connector-j-8.0.31.jar:8.0.31]
	at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:64) ~[mysql-connector-j-8.0.31.jar:8.0.31]
	at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:828) ~[mysql-connector-j-8.0.31.jar:8.0.31]
	at com.mysql.cj.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:448) ~[mysql-connector-j-8.0.31.jar:8.0.31]
	at com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:241) ~[mysql-connector-j-8.0.31.jar:8.0.31]
	at com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:198) ~[mysql-connector-j-8.0.31.jar:8.0.31]
	at com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:138) ~[HikariCP-4.0.3.jar:na]
	at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:364) ~[HikariCP-4.0.3.jar:na]
	at com.zaxxer.hikari.pool.PoolBase.newPoolEntry(PoolBase.java:206) ~[HikariCP-4.0.3.jar:na]
	at com.zaxxer.hikari.pool.HikariPool.createPoolEntry(HikariPool.java:476) ~[HikariCP-4.0.3.jar:na]
	at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:561) ~[HikariCP-4.0.3.jar:na]
	at com.zaxxer.hikari.pool.HikariPool.<init>(HikariPool.java:115) ~[HikariCP-4.0.3.jar:na]
	at com.zaxxer.hikari.HikariDataSource.getConnection(HikariDataSource.java:112) ~[HikariCP-4.0.3.jar:na]
	at org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource.getConnection(AbstractRoutingDataSource.java:194) ~[spring-jdbc-5.3.24.jar:5.3.24]
	at org.springframework.jdbc.datasource.LazyConnectionDataSourceProxy$LazyConnectionInvocationHandler.getTargetConnection(LazyConnectionDataSourceProxy.java:405) ~[spring-jdbc-5.3.24.jar:5.3.24]
	at org.springframework.jdbc.datasource.LazyConnectionDataSourceProxy$LazyConnectionInvocationHandler.invoke(LazyConnectionDataSourceProxy.java:378) ~[spring-jdbc-5.3.24.jar:5.3.24]
	at com.sun.proxy.$Proxy92.getMetaData(Unknown Source) ~[na:na]
	at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:70) ~[hibernate-core-5.6.14.Final.jar:5.6.14.Final]
	at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:35) ~[hibernate-core-5.6.14.Final.jar:5.6.14.Final]
	at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.initiateService(StandardServiceRegistryImpl.java:101) ~[hibernate-core-5.6.14.Final.jar:5.6.14.Final]
	at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:263) ~[hibernate-core-5.6.14.Final.jar:5.6.14.Final]
	at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:237) ~[hibernate-core-5.6.14.Final.jar:5.6.14.Final]
	at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:214) ~[hibernate-core-5.6.14.Final.jar:5.6.14.Final]
	at org.hibernate.id.factory.internal.DefaultIdentifierGeneratorFactory.injectServices(DefaultIdentifierGeneratorFactory.java:175) ~[hibernate-core-5.6.14.Final.jar:5.6.14.Final]
	at org.hibernate.service.internal.AbstractServiceRegistryImpl.injectDependencies(AbstractServiceRegistryImpl.java:286) ~[hibernate-core-5.6.14.Final.jar:5.6.14.Final]
	at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:243) ~[hibernate-core-5.6.14.Final.jar:5.6.14.Final]
	at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:214) ~[hibernate-core-5.6.14.Final.jar:5.6.14.Final]
	at org.hibernate.boot.internal.InFlightMetadataCollectorImpl.<init>(InFlightMetadataCollectorImpl.java:173) ~[hibernate-core-5.6.14.Final.jar:5.6.14.Final]
	at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:127) ~[hibernate-core-5.6.14.Final.jar:5.6.14.Final]
	at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.metadata(EntityManagerFactoryBuilderImpl.java:1460) ~[hibernate-core-5.6.14.Final.jar:5.6.14.Final]
	at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:1494) ~[hibernate-core-5.6.14.Final.jar:5.6.14.Final]
	at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:58) ~[spring-orm-5.3.24.jar:5.3.24]
	at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:365) ~[spring-orm-5.3.24.jar:5.3.24]
	at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:409) ~[spring-orm-5.3.24.jar:5.3.24]
	at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:396) ~[spring-orm-5.3.24.jar:5.3.24]
	at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.afterPropertiesSet(LocalContainerEntityManagerFactoryBean.java:341) ~[spring-orm-5.3.24.jar:5.3.24]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1863) ~[spring-beans-5.3.24.jar:5.3.24]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1800) ~[spring-beans-5.3.24.jar:5.3.24]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:620) ~[spring-beans-5.3.24.jar:5.3.24]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542) ~[spring-beans-5.3.24.jar:5.3.24]
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.24.jar:5.3.24]
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.24.jar:5.3.24]
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.24.jar:5.3.24]
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.24.jar:5.3.24]
	at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1154) ~[spring-context-5.3.24.jar:5.3.24]
	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:908) ~[spring-context-5.3.24.jar:5.3.24]
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583) ~[spring-context-5.3.24.jar:5.3.24]
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:147) ~[spring-boot-2.7.6.jar:2.7.6]
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:731) ~[spring-boot-2.7.6.jar:2.7.6]
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:408) ~[spring-boot-2.7.6.jar:2.7.6]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:307) ~[spring-boot-2.7.6.jar:2.7.6]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1303) ~[spring-boot-2.7.6.jar:2.7.6]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1292) ~[spring-boot-2.7.6.jar:2.7.6]
	at com.junyharang.duplication_test.DuplicationTestApplication.main(DuplicationTestApplication.java:11) ~[main/:na]
Caused by: com.mysql.cj.exceptions.CJCommunicationsException: Communications link failure

The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:na]
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[na:na]
	at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:na]
	at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490) ~[na:na]
	at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:61) ~[mysql-connector-j-8.0.31.jar:8.0.31]
	at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:105) ~[mysql-connector-j-8.0.31.jar:8.0.31]
	at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:151) ~[mysql-connector-j-8.0.31.jar:8.0.31]
	at com.mysql.cj.exceptions.ExceptionFactory.createCommunicationsException(ExceptionFactory.java:167) ~[mysql-connector-j-8.0.31.jar:8.0.31]
	at com.mysql.cj.protocol.a.NativeSocketConnection.connect(NativeSocketConnection.java:89) ~[mysql-connector-j-8.0.31.jar:8.0.31]
	at com.mysql.cj.NativeSession.connect(NativeSession.java:120) ~[mysql-connector-j-8.0.31.jar:8.0.31]
	at com.mysql.cj.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:948) ~[mysql-connector-j-8.0.31.jar:8.0.31]
	at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:818) ~[mysql-connector-j-8.0.31.jar:8.0.31]
	... 51 common frames omitted
Caused by: java.net.SocketTimeoutException: connect timed out
	at java.base/java.net.PlainSocketImpl.socketConnect(Native Method) ~[na:na]
	at java.base/java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:412) ~[na:na]
	at java.base/java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:255) ~[na:na]
	at java.base/java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:237) ~[na:na]
	at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) ~[na:na]
	at java.base/java.net.Socket.connect(Socket.java:615) ~[na:na]
	at com.mysql.cj.protocol.StandardSocketFactory.connect(StandardSocketFactory.java:153) ~[mysql-connector-j-8.0.31.jar:8.0.31]
	at com.mysql.cj.protocol.a.NativeSocketConnection.connect(NativeSocketConnection.java:63) ~[mysql-connector-j-8.0.31.jar:8.0.31]
	... 54 common frames omitted

2022-11-30 21:16:33.431  WARN 9710 --- [           main] o.h.e.j.e.i.JdbcEnvironmentInitiator     : HHH000339: Could not obtain connection metadata: com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure

The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
2022-11-30 21:16:33.452  INFO 9710 --- [           main] org.hibernate.dialect.Dialect            : HHH000400: Using dialect: org.hibernate.dialect.MySQL5InnoDBDialect
Hibernate: 
    
    drop table if exists board
2022-11-30 21:16:33.713  INFO 9710 --- [           main] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Starting...
2022-11-30 21:17:04.717 ERROR 9710 --- [           main] com.zaxxer.hikari.pool.HikariPool        : HikariPool-1 - Exception during pool initialization.

com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure

The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
	at com.mysql.cj.jdbc.exceptions.SQLError.createCommunicationsException(SQLError.java:174) ~[mysql-connector-j-8.0.31.jar:8.0.31]
	at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:64) ~[mysql-connector-j-8.0.31.jar:8.0.31]
	at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:828) ~[mysql-connector-j-8.0.31.jar:8.0.31]
	at com.mysql.cj.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:448) ~[mysql-connector-j-8.0.31.jar:8.0.31]
	at com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:241) ~[mysql-connector-j-8.0.31.jar:8.0.31]
	at com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:198) ~[mysql-connector-j-8.0.31.jar:8.0.31]
	at com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:138) ~[HikariCP-4.0.3.jar:na]
	at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:364) ~[HikariCP-4.0.3.jar:na]
	at com.zaxxer.hikari.pool.PoolBase.newPoolEntry(PoolBase.java:206) ~[HikariCP-4.0.3.jar:na]
	at com.zaxxer.hikari.pool.HikariPool.createPoolEntry(HikariPool.java:476) ~[HikariCP-4.0.3.jar:na]
	at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:561) ~[HikariCP-4.0.3.jar:na]
	at com.zaxxer.hikari.pool.HikariPool.<init>(HikariPool.java:115) ~[HikariCP-4.0.3.jar:na]
	at com.zaxxer.hikari.HikariDataSource.getConnection(HikariDataSource.java:112) ~[HikariCP-4.0.3.jar:na]
	at org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource.getConnection(AbstractRoutingDataSource.java:194) ~[spring-jdbc-5.3.24.jar:5.3.24]
	at org.springframework.jdbc.datasource.LazyConnectionDataSourceProxy$LazyConnectionInvocationHandler.getTargetConnection(LazyConnectionDataSourceProxy.java:405) ~[spring-jdbc-5.3.24.jar:5.3.24]
	at org.springframework.jdbc.datasource.LazyConnectionDataSourceProxy$LazyConnectionInvocationHandler.invoke(LazyConnectionDataSourceProxy.java:378) ~[spring-jdbc-5.3.24.jar:5.3.24]
	at com.sun.proxy.$Proxy92.getAutoCommit(Unknown Source) ~[na:na]
	at org.hibernate.resource.transaction.backend.jdbc.internal.DdlTransactionIsolatorNonJtaImpl.getIsolatedConnection(DdlTransactionIsolatorNonJtaImpl.java:47) ~[hibernate-core-5.6.14.Final.jar:5.6.14.Final]
	at org.hibernate.tool.schema.internal.exec.GenerationTargetToDatabase.jdbcStatement(GenerationTargetToDatabase.java:77) ~[hibernate-core-5.6.14.Final.jar:5.6.14.Final]
	at org.hibernate.tool.schema.internal.exec.GenerationTargetToDatabase.accept(GenerationTargetToDatabase.java:53) ~[hibernate-core-5.6.14.Final.jar:5.6.14.Final]
	at org.hibernate.tool.schema.internal.SchemaDropperImpl.applySqlString(SchemaDropperImpl.java:387) ~[hibernate-core-5.6.14.Final.jar:5.6.14.Final]
	at org.hibernate.tool.schema.internal.SchemaDropperImpl.applySqlStrings(SchemaDropperImpl.java:371) ~[hibernate-core-5.6.14.Final.jar:5.6.14.Final]
	at org.hibernate.tool.schema.internal.SchemaDropperImpl.dropFromMetadata(SchemaDropperImpl.java:246) ~[hibernate-core-5.6.14.Final.jar:5.6.14.Final]
	at org.hibernate.tool.schema.internal.SchemaDropperImpl.performDrop(SchemaDropperImpl.java:156) ~[hibernate-core-5.6.14.Final.jar:5.6.14.Final]
	at org.hibernate.tool.schema.internal.SchemaDropperImpl.doDrop(SchemaDropperImpl.java:128) ~[hibernate-core-5.6.14.Final.jar:5.6.14.Final]
	at org.hibernate.tool.schema.internal.SchemaDropperImpl.doDrop(SchemaDropperImpl.java:114) ~[hibernate-core-5.6.14.Final.jar:5.6.14.Final]
	at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.performDatabaseAction(SchemaManagementToolCoordinator.java:157) ~[hibernate-core-5.6.14.Final.jar:5.6.14.Final]
	at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.process(SchemaManagementToolCoordinator.java:85) ~[hibernate-core-5.6.14.Final.jar:5.6.14.Final]
	at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:335) ~[hibernate-core-5.6.14.Final.jar:5.6.14.Final]
	at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:471) ~[hibernate-core-5.6.14.Final.jar:5.6.14.Final]
	at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:1498) ~[hibernate-core-5.6.14.Final.jar:5.6.14.Final]
	at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:58) ~[spring-orm-5.3.24.jar:5.3.24]
	at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:365) ~[spring-orm-5.3.24.jar:5.3.24]
	at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:409) ~[spring-orm-5.3.24.jar:5.3.24]
	at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:396) ~[spring-orm-5.3.24.jar:5.3.24]
	at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.afterPropertiesSet(LocalContainerEntityManagerFactoryBean.java:341) ~[spring-orm-5.3.24.jar:5.3.24]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1863) ~[spring-beans-5.3.24.jar:5.3.24]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1800) ~[spring-beans-5.3.24.jar:5.3.24]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:620) ~[spring-beans-5.3.24.jar:5.3.24]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542) ~[spring-beans-5.3.24.jar:5.3.24]
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.24.jar:5.3.24]
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.24.jar:5.3.24]
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.24.jar:5.3.24]
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.24.jar:5.3.24]
	at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1154) ~[spring-context-5.3.24.jar:5.3.24]
	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:908) ~[spring-context-5.3.24.jar:5.3.24]
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583) ~[spring-context-5.3.24.jar:5.3.24]
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:147) ~[spring-boot-2.7.6.jar:2.7.6]
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:731) ~[spring-boot-2.7.6.jar:2.7.6]
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:408) ~[spring-boot-2.7.6.jar:2.7.6]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:307) ~[spring-boot-2.7.6.jar:2.7.6]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1303) ~[spring-boot-2.7.6.jar:2.7.6]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1292) ~[spring-boot-2.7.6.jar:2.7.6]
	at com.junyharang.duplication_test.DuplicationTestApplication.main(DuplicationTestApplication.java:11) ~[main/:na]
Caused by: com.mysql.cj.exceptions.CJCommunicationsException: Communications link failure

The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:na]
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[na:na]
	at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:na]
	at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490) ~[na:na]
	at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:61) ~[mysql-connector-j-8.0.31.jar:8.0.31]
	at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:105) ~[mysql-connector-j-8.0.31.jar:8.0.31]
	at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:151) ~[mysql-connector-j-8.0.31.jar:8.0.31]
	at com.mysql.cj.exceptions.ExceptionFactory.createCommunicationsException(ExceptionFactory.java:167) ~[mysql-connector-j-8.0.31.jar:8.0.31]
	at com.mysql.cj.protocol.a.NativeSocketConnection.connect(NativeSocketConnection.java:89) ~[mysql-connector-j-8.0.31.jar:8.0.31]
	at com.mysql.cj.NativeSession.connect(NativeSession.java:120) ~[mysql-connector-j-8.0.31.jar:8.0.31]
	at com.mysql.cj.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:948) ~[mysql-connector-j-8.0.31.jar:8.0.31]
	at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:818) ~[mysql-connector-j-8.0.31.jar:8.0.31]
	... 51 common frames omitted
Caused by: java.net.SocketTimeoutException: connect timed out
	at java.base/java.net.PlainSocketImpl.socketConnect(Native Method) ~[na:na]
	at java.base/java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:412) ~[na:na]
	at java.base/java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:255) ~[na:na]
	at java.base/java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:237) ~[na:na]
	at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) ~[na:na]
	at java.base/java.net.Socket.connect(Socket.java:615) ~[na:na]
	at com.mysql.cj.protocol.StandardSocketFactory.connect(StandardSocketFactory.java:153) ~[mysql-connector-j-8.0.31.jar:8.0.31]
	at com.mysql.cj.protocol.a.NativeSocketConnection.connect(NativeSocketConnection.java:63) ~[mysql-connector-j-8.0.31.jar:8.0.31]
	... 54 common frames omitted

2022-11-30 21:17:04.719  WARN 9710 --- [           main] o.h.engine.jdbc.spi.SqlExceptionHelper   : SQL Error: 0, SQLState: 08S01
2022-11-30 21:17:04.719 ERROR 9710 --- [           main] o.h.engine.jdbc.spi.SqlExceptionHelper   : Communications link failure

The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
2022-11-30 21:17:04.727 ERROR 9710 --- [           main] j.LocalContainerEntityManagerFactoryBean : Failed to initialize JPA EntityManagerFactory: [PersistenceUnit: default] Unable to build Hibernate SessionFactory; nested exception is org.hibernate.exception.JDBCConnectionException: Unable to check JDBC Connection auto-commit in preparation for DDL execution
2022-11-30 21:17:04.730  WARN 9710 --- [           main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory; nested exception is org.hibernate.exception.JDBCConnectionException: Unable to check JDBC Connection auto-commit in preparation for DDL execution
2022-11-30 21:17:04.732  INFO 9710 --- [           main] o.apache.catalina.core.StandardService   : Stopping service [Tomcat]
2022-11-30 21:17:04.745  INFO 9710 --- [           main] ConditionEvaluationReportLoggingListener : 

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2022-11-30 21:17:04.764 ERROR 9710 --- [           main] o.s.boot.SpringApplication               : Application run failed

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory; nested exception is org.hibernate.exception.JDBCConnectionException: Unable to check JDBC Connection auto-commit in preparation for DDL execution
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1804) ~[spring-beans-5.3.24.jar:5.3.24]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:620) ~[spring-beans-5.3.24.jar:5.3.24]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542) ~[spring-beans-5.3.24.jar:5.3.24]
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.24.jar:5.3.24]
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.24.jar:5.3.24]
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.24.jar:5.3.24]
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.24.jar:5.3.24]
	at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1154) ~[spring-context-5.3.24.jar:5.3.24]
	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:908) ~[spring-context-5.3.24.jar:5.3.24]
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583) ~[spring-context-5.3.24.jar:5.3.24]
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:147) ~[spring-boot-2.7.6.jar:2.7.6]
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:731) ~[spring-boot-2.7.6.jar:2.7.6]
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:408) ~[spring-boot-2.7.6.jar:2.7.6]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:307) ~[spring-boot-2.7.6.jar:2.7.6]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1303) ~[spring-boot-2.7.6.jar:2.7.6]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1292) ~[spring-boot-2.7.6.jar:2.7.6]
	at com.junyharang.duplication_test.DuplicationTestApplication.main(DuplicationTestApplication.java:11) ~[main/:na]
Caused by: javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory; nested exception is org.hibernate.exception.JDBCConnectionException: Unable to check JDBC Connection auto-commit in preparation for DDL execution
	at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:421) ~[spring-orm-5.3.24.jar:5.3.24]
	at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:396) ~[spring-orm-5.3.24.jar:5.3.24]
	at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.afterPropertiesSet(LocalContainerEntityManagerFactoryBean.java:341) ~[spring-orm-5.3.24.jar:5.3.24]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1863) ~[spring-beans-5.3.24.jar:5.3.24]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1800) ~[spring-beans-5.3.24.jar:5.3.24]
	... 16 common frames omitted
Caused by: org.hibernate.exception.JDBCConnectionException: Unable to check JDBC Connection auto-commit in preparation for DDL execution
	at org.hibernate.exception.internal.SQLStateConversionDelegate.convert(SQLStateConversionDelegate.java:112) ~[hibernate-core-5.6.14.Final.jar:5.6.14.Final]
	at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:37) ~[hibernate-core-5.6.14.Final.jar:5.6.14.Final]
	at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:113) ~[hibernate-core-5.6.14.Final.jar:5.6.14.Final]
	at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:99) ~[hibernate-core-5.6.14.Final.jar:5.6.14.Final]
	at org.hibernate.resource.transaction.backend.jdbc.internal.DdlTransactionIsolatorNonJtaImpl.getIsolatedConnection(DdlTransactionIsolatorNonJtaImpl.java:64) ~[hibernate-core-5.6.14.Final.jar:5.6.14.Final]
	at org.hibernate.tool.schema.internal.exec.GenerationTargetToDatabase.jdbcStatement(GenerationTargetToDatabase.java:77) ~[hibernate-core-5.6.14.Final.jar:5.6.14.Final]
	at org.hibernate.tool.schema.internal.exec.GenerationTargetToDatabase.accept(GenerationTargetToDatabase.java:53) ~[hibernate-core-5.6.14.Final.jar:5.6.14.Final]
	at org.hibernate.tool.schema.internal.SchemaDropperImpl.applySqlString(SchemaDropperImpl.java:387) ~[hibernate-core-5.6.14.Final.jar:5.6.14.Final]
	at org.hibernate.tool.schema.internal.SchemaDropperImpl.applySqlStrings(SchemaDropperImpl.java:371) ~[hibernate-core-5.6.14.Final.jar:5.6.14.Final]
	at org.hibernate.tool.schema.internal.SchemaDropperImpl.dropFromMetadata(SchemaDropperImpl.java:246) ~[hibernate-core-5.6.14.Final.jar:5.6.14.Final]
	at org.hibernate.tool.schema.internal.SchemaDropperImpl.performDrop(SchemaDropperImpl.java:156) ~[hibernate-core-5.6.14.Final.jar:5.6.14.Final]
	at org.hibernate.tool.schema.internal.SchemaDropperImpl.doDrop(SchemaDropperImpl.java:128) ~[hibernate-core-5.6.14.Final.jar:5.6.14.Final]
	at org.hibernate.tool.schema.internal.SchemaDropperImpl.doDrop(SchemaDropperImpl.java:114) ~[hibernate-core-5.6.14.Final.jar:5.6.14.Final]
	at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.performDatabaseAction(SchemaManagementToolCoordinator.java:157) ~[hibernate-core-5.6.14.Final.jar:5.6.14.Final]
	at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.process(SchemaManagementToolCoordinator.java:85) ~[hibernate-core-5.6.14.Final.jar:5.6.14.Final]
	at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:335) ~[hibernate-core-5.6.14.Final.jar:5.6.14.Final]
	at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:471) ~[hibernate-core-5.6.14.Final.jar:5.6.14.Final]
	at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:1498) ~[hibernate-core-5.6.14.Final.jar:5.6.14.Final]
	at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:58) ~[spring-orm-5.3.24.jar:5.3.24]
	at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:365) ~[spring-orm-5.3.24.jar:5.3.24]
	at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:409) ~[spring-orm-5.3.24.jar:5.3.24]
	... 20 common frames omitted
Caused by: com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure

The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
	at com.mysql.cj.jdbc.exceptions.SQLError.createCommunicationsException(SQLError.java:174) ~[mysql-connector-j-8.0.31.jar:8.0.31]
	at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:64) ~[mysql-connector-j-8.0.31.jar:8.0.31]
	at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:828) ~[mysql-connector-j-8.0.31.jar:8.0.31]
	at com.mysql.cj.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:448) ~[mysql-connector-j-8.0.31.jar:8.0.31]
	at com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:241) ~[mysql-connector-j-8.0.31.jar:8.0.31]
	at com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:198) ~[mysql-connector-j-8.0.31.jar:8.0.31]
	at com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:138) ~[HikariCP-4.0.3.jar:na]
	at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:364) ~[HikariCP-4.0.3.jar:na]
	at com.zaxxer.hikari.pool.PoolBase.newPoolEntry(PoolBase.java:206) ~[HikariCP-4.0.3.jar:na]
	at com.zaxxer.hikari.pool.HikariPool.createPoolEntry(HikariPool.java:476) ~[HikariCP-4.0.3.jar:na]
	at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:561) ~[HikariCP-4.0.3.jar:na]
	at com.zaxxer.hikari.pool.HikariPool.<init>(HikariPool.java:115) ~[HikariCP-4.0.3.jar:na]
	at com.zaxxer.hikari.HikariDataSource.getConnection(HikariDataSource.java:112) ~[HikariCP-4.0.3.jar:na]
	at org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource.getConnection(AbstractRoutingDataSource.java:194) ~[spring-jdbc-5.3.24.jar:5.3.24]
	at org.springframework.jdbc.datasource.LazyConnectionDataSourceProxy$LazyConnectionInvocationHandler.getTargetConnection(LazyConnectionDataSourceProxy.java:405) ~[spring-jdbc-5.3.24.jar:5.3.24]
	at org.springframework.jdbc.datasource.LazyConnectionDataSourceProxy$LazyConnectionInvocationHandler.invoke(LazyConnectionDataSourceProxy.java:378) ~[spring-jdbc-5.3.24.jar:5.3.24]
	at com.sun.proxy.$Proxy92.getAutoCommit(Unknown Source) ~[na:na]
	at org.hibernate.resource.transaction.backend.jdbc.internal.DdlTransactionIsolatorNonJtaImpl.getIsolatedConnection(DdlTransactionIsolatorNonJtaImpl.java:47) ~[hibernate-core-5.6.14.Final.jar:5.6.14.Final]
	... 36 common frames omitted
Caused by: com.mysql.cj.exceptions.CJCommunicationsException: Communications link failure

The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:na]
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[na:na]
	at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:na]
	at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490) ~[na:na]
	at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:61) ~[mysql-connector-j-8.0.31.jar:8.0.31]
	at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:105) ~[mysql-connector-j-8.0.31.jar:8.0.31]
	at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:151) ~[mysql-connector-j-8.0.31.jar:8.0.31]
	at com.mysql.cj.exceptions.ExceptionFactory.createCommunicationsException(ExceptionFactory.java:167) ~[mysql-connector-j-8.0.31.jar:8.0.31]
	at com.mysql.cj.protocol.a.NativeSocketConnection.connect(NativeSocketConnection.java:89) ~[mysql-connector-j-8.0.31.jar:8.0.31]
	at com.mysql.cj.NativeSession.connect(NativeSession.java:120) ~[mysql-connector-j-8.0.31.jar:8.0.31]
	at com.mysql.cj.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:948) ~[mysql-connector-j-8.0.31.jar:8.0.31]
	at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:818) ~[mysql-connector-j-8.0.31.jar:8.0.31]
	... 51 common frames omitted
Caused by: java.net.SocketTimeoutException: connect timed out
	at java.base/java.net.PlainSocketImpl.socketConnect(Native Method) ~[na:na]
	at java.base/java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:412) ~[na:na]
	at java.base/java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:255) ~[na:na]
	at java.base/java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:237) ~[na:na]
	at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) ~[na:na]
	at java.base/java.net.Socket.connect(Socket.java:615) ~[na:na]
	at com.mysql.cj.protocol.StandardSocketFactory.connect(StandardSocketFactory.java:153) ~[mysql-connector-j-8.0.31.jar:8.0.31]
	at com.mysql.cj.protocol.a.NativeSocketConnection.connect(NativeSocketConnection.java:63) ~[mysql-connector-j-8.0.31.jar:8.0.31]
	... 54 common frames omitted

๋Œ€์ƒ VM์—์„œ ์—ฐ๊ฒฐ ํ•ด์ œ๋˜์—ˆ์Šต๋‹ˆ๋‹ค. ์ฃผ์†Œ: '127.0.0.1:56228', ์ „์†ก: '์†Œ์ผ“'

์ข…๋ฃŒ ์ฝ”๋“œ 1(์œผ)๋กœ ์™„๋ฃŒ๋œ ํ”„๋กœ์„ธ์Šค



ํ•ด๊ฒฐ ๋ฐฉ์•ˆ์€ ์ด ๊ณณ์— ์ •๋ฆฌํ•ด ๋‘์—ˆ์–ด์š” :)




Swagger Document


Swagger๋ฅผ ์ด์šฉํ•ด์„œ ๊ฐ’์„ ๋„ฃ์–ด๋ณด๊ณ , ์กฐํšŒ๋ฅผ ํ•ด ๋ณผ๊ฒŒ์š”.


๊ฐ’ ์ž…๋ ฅํ•˜๊ธฐ

 

๋“ฑ๋ก ์„ฑ๊ณต (201 Code)

 

JPA Query Message

 

Master DBMS



Slave DBMS

 

์œ„์™€ ๊ฐ™์ด ์ •์ƒ์ ์œผ๋กœ DB์— ๊ฐ’์ด ๋“ค์–ด๊ฐ„๊ฑธ ํ™•์ธํ•  ์ˆ˜ ์žˆ์–ด์š”.

์ด๋ฒˆ์—” ์กฐํšŒ๋ฅผ ํ•œ๋ฒˆ ํ•ด ๋ณผ๊ฒŒ์š”.


๋ชฉ๋ก ์กฐํšŒ

 

๋ชฉ๋ก ์กฐํšŒ ๊ฒฐ๊ณผ


๋ชฉ๋ก ์กฐํšŒ๋„ ์ •์ƒ์ ์œผ๋กœ ๋˜๋Š” ๊ฒƒ์„ ํ™•์ธํ•  ์ˆ˜ ์žˆ์–ด์š”.


์ƒ์„ธ ์กฐํšŒ



์ƒ์„ธ ์กฐํšŒ๋„ ์ •์ƒ์ ์œผ๋กœ ๋˜๋Š” ๊ฒƒ์„ ํ™•์ธํ•  ์ˆ˜ ์žˆ์–ด์š”.



์‚ญ์ œ ๊ธฐ๋Šฅ


10๋ฒˆ์งธ Data๋ฅผ ์ง€์›Œ ๋ณด์•˜์–ด์š”.


JunyHarangServiceImple


์ด์ค‘ํ™”์— ๋Œ€ํ•œ DataSource ์„ค์ •์ด ์ž˜ ์‹คํ–‰๋˜๋Š”์ง€ ํ™•์ธํ•˜๊ธฐ ์œ„ํ•ด์„œ
์œ„์™€ ๊ฐ™์ด Delete๋•Œ๋Š” @Transactional์„ ๋ถ™์ด์ง€ ์•Š๊ณ , ์‹œ๋„ ํ•˜์˜€์–ด์š”.


Master DBMS



Slave DBMS


๊ทธ๋žฌ๋”๋‹ˆ ์œ„์™€ ๊ฐ™์ด Master DBMS์— ๊ฐ’์€ ์ง€์›Œ์ง€์ง€ ์•Š์•˜๊ณ ,
Slave DBMS์— 10๋ฒˆ์งธ Data๊ฐ€ ์ง€์›Œ์ง„๊ฒƒ์„ ํ™•์ธํ•  ์ˆ˜ ์žˆ์—ˆ์–ด์š”.


์ด๋ ‡๊ฒŒ @Transactional์„ ํ†ตํ•ด์„œ ๊ฐ๊ฐ์˜ DBMS์— ์—ญํ• ์„ ๋ถ„๋ฐฐํ•˜๊ณ , ๋ถ€ํ•˜๋ฅผ ๋ถ„์‚ฐ ์‹œํ‚ฌ ์ˆ˜ ์žˆ๋‹ค๋Š” ๊ฒƒ์„ ํ™•์ธํ•˜์˜€์–ด์š”. 

 

 

 

 

๐Ÿง ์ฐธ๊ณ  ์ž๋ฃŒ

 

 

[Spring-boot] Master - Slave ๊ตฌ์กฐ์— ๋”ฐ๋ฅธ Read, Write ๋ถ„๊ธฐ

์„œ๋ก  ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค๋ฅผ ์ด์šฉํ•œ๋‹ค๋ฉด ๋Œ€๋ถ€๋ถ„ ์“ฐ๊ธฐ๋ณด๋‹ค ์ฝ๊ธฐ ์˜ ํ–‰์œ„๊ฐ€ ๋” ๋งŽ์Šต๋‹ˆ๋‹ค. DB์˜ ๋ถ€ํ•˜๋ฅผ ์ค„์ด๊ธฐ ์œ„ํ•ด ๋‹ค์Œ๊ณผ ๊ฐ™์ด Master - Slave ๊ตฌ์กฐ๋ฅผ ๋งŽ์ด ์‚ฌ์šฉํ•˜๋Š”๋ฐ์š”. ์ด๋Ÿฌํ•œ ๊ตฌ์กฐ๋ฅผ ๊ฐ€์ง€๊ณ  ์žˆ์„ ๋•Œ Transe

k3068.tistory.com

 

 

 

 

 

์ž๋ฐ” ORM ํ‘œ์ค€ JPA ํ”„๋กœ๊ทธ๋ž˜๋ฐ:์Šคํ”„๋ง ๋ฐ์ดํ„ฐ ์˜ˆ์ œ ํ”„๋กœ์ ํŠธ๋กœ ๋ฐฐ์šฐ๋Š” ์ „์ž์ •๋ถ€ ํ‘œ์ค€ ๋ฐ์ดํ„ฐ๋ฒ ์ด

COUPANG

www.coupang.com

 

 

 

์Šคํ”„๋ง ๋ถ€ํŠธ์™€ AWS๋กœ ํ˜ผ์ž ๊ตฌํ˜„ํ•˜๋Š” ์›น ์„œ๋น„์Šค:์ธํ…”๋ฆฌ์ œ์ด JPA JUnit ํ…Œ์ŠคํŠธ ๊ทธ๋ ˆ์ด๋“ค

COUPANG

www.coupang.com

 

 

 

์ฝ”๋“œ๋กœ ๋ฐฐ์šฐ๋Š” ์Šคํ”„๋ง ๋ถ€ํŠธ ์›น ํ”„๋กœ์ ํŠธ : ํ˜„์—… ๊ฐœ๋ฐœ์„ ์œ„ํ•œ ๋‹จ๊ณ„๋ณ„ ์‹ค์Šต์„œ

COUPANG

www.coupang.com

 

 

์ฝ”๋“œ๋กœ ๋ฐฐ์šฐ๋Š” ์Šคํ”„๋ง ์›น ํ”„๋กœ์ ํŠธ:ํ˜„์—… ๊ฐœ๋ฐœ์„ ์œ„ํ•œ ๋‹จ๊ณ„๋ณ„ ์‹ค์Šต์„œ

COUPANG

www.coupang.com

"์ด ํฌ์ŠคํŒ…์€ ์ฟ ํŒก ํŒŒํŠธ๋„ˆ์Šค ํ™œ๋™์˜ ์ผํ™˜์œผ๋กœ, ์ด์— ๋”ฐ๋ฅธ ์ผ์ •์•ก์˜ ์ˆ˜์ˆ˜๋ฃŒ๋ฅผ ์ œ๊ณต๋ฐ›์Šต๋‹ˆ๋‹ค."

 

 

 

 

 

 

 

728x90
๋ฐ˜์‘ํ˜•