[Ubuntu] ubuntu 20.04 Springboot + AWS RDS[Mysql] ๋ฐฐํฌ ์ ๋ฐ์ํ๋ ์ค๋ฅ com.mysql.cj.jdbc.exceptions.communicationsexception: communications link failure the last packet sent successfully to the server was 0 milliseconds ago. the driv er has no..
com.mysql.cj.jdbc.exceptions.communicationsexception: communications link failure the last packet sent successfully to the server was 0 milliseconds ago. the driv er has not received any packets from the server.
์ฑ ๋ฐ์นญ์ ์ํด ์๋ฒ๋ฅผ ๋ฐฐํฌํ๋ ์์ค ๋ค์๊ณผ ๊ฐ์ ์๋ฌ๊ฐ ๋ฐ์ํ๋ค. Mysql์ ์ค์นํ์ง ์๊ณ ์๋, ์ ๋ฒ์ ๋ฐฐํฌ๋ฅผ ์ฑ๊ณตํ์๊ธฐ ๋๋ฌธ์ ์ด์ ๋ฅผ ์์ง ๋ชปํ์๋ค.
Mysql์ ๋ค์ด ๋ฐ์๋ณด๊ณ , mysql์ ๋ค์ด๋ฐ์ผ๋ localhost์ ์ ๊ทผ์ด ๋ถ๊ฐ๋ฅํ๋ค๋ ์๋ฌ๊ฐ ๋ฐ์ํ๋ค. ์ง๋ ๋ฐฐํฌ ๋์๋ ๋ฐ๋ก mysql์ ๋ค์ด ๋ฐ์ง ์๊ณ ๋, ์์ ๊ฐ์ ์๋ฌ๊ฐ ๋ฐ์ํ์ง ์์๊ธฐ ๋๋ฌธ์ ubuntu ๋ด์ mysql์ ๋ค์ด ๋ฐ์ง ์์ ๋ฐ์ํ ์๋ฌ๋ ์๋๋ผ๊ณ ์๊ฐํ๋ค
์๋ฌ ํด๊ฒฐ๋ถํฐ ๋งํ์๋ฉด, rds ๋ด๋ถ ์ธ๋ฐ์ด๋ ๊ท์น ๋ด์ ์ฌ์ฉ์ค์ธ ์ธ์คํด์ค private ip ์ฃผ์๋ฅผ ์ฐ๊ฒฐํ์ง ์์ ๋ฐ์ํ ์ค๋ฅ์๋ค.
rds -> VPN ๋ณด์๊ทธ๋ฃน -> ์ธ๋ฐ์ด๋ ๊ท์น -> ์ธ๋ฐ์ด๋ ๊ท์น ํธ์ง
IP์ ์ธ์คํด์ค private ip ์ฃผ์ ์ฐ๊ฒฐ!!
https://hello-gg.tistory.com/63
์ ๋ธ๋ก๊ทธ์์ ํด๊ฒฐ์ฑ ์ ์ป์๋ค.
ํ์ง๋ง, ์ง๋ ๋ฐฐํฌ์์๋ ์ ๊ท์น์ ์ถ๊ฐํ์ง ์๊ณ ์๋ ์ ์์ ์ผ๋ก spring boot์ ๋ฐฐํฌ๋ฅผ ์ฑ๊ณตํ์๊ธฐ ๋๋ฌธ์ ์๋ฒฝํ ๋ต์ ์ฐพ์ง ๋ชปํ ๊ฒ์ด ์์ฝ๋ค.
๋ํ, ๋ฐฐํฌ ์๋ํ๋ฅผ ํ์ง ๋ชปํด ๋ฌด์ค๋จ ๋ฐฐํฌ๋ฅผ ๊ป๋ค๊ฐ ๋ค์ ํค๋ฉด์ ๋ฐ์ํ๋ ์ค๋ฅ๋ค์ด ๋ง์ ์ผ๋ฅธ docker๋ gitlab, github action ๋ฑ์ ๋ฐฐ์์ cicd์ ๋ํด ๊ณต๋ถํด๋ณด๊ณ ์ ํ๋ค.