โ
500 Error on frontend
Although everything was running just fine on postman, when connecting with frontend, there was a 500 error.
๐ต Check Max connections, wait_timeout
Go into Ubuntu then,
1
| mysql -h drugstoredb.cn000owqib3s.ap-northeast-2.rds.amazonaws.com -u root -p
|
1
| show variables like "%max_connections%";
|
1
| show status like "%connect%";
|
1
| show status like '%thread%';
|
1
| show variables like '%timeout%';
|
๋์ ๊ฒฝ์ฐ ๋ค์๊ณผ ๊ฐ์ ์์น๊ฐ ๋์๋ค.
- Cache Miss Rate= 2.40%
- Connection Miss Rate= 17%
- Connection Usage= 53%
๋ฐ๋ผ์
- wait_timeout = 180
- max_connections = 300 ์ผ๋ก ์ค์ ํ๊ธฐ๋ก ํ์๋ค.
๐ต Change connections, timeout
โ๏ธ AWS parameter
RDS์ parameter ๋ฐ๊ฟ์ฃผ๊ธฐ https://cha-vi.tistory.com/56
์ค์ ์ดํ show variables like "%max_connections%";
ํด๋ณด๋ฉด ๋ด๊ฐ ๋ฐ๊พผ ์ซ์๋ก ์ ๋์ค๋ ๊ฒ ํ์ธ ๊ฐ๋ฅ
โ๏ธ ubuntu mariaDB
- Install mariaDB service
1
2
3
4
5
| sudo apt update
sudo apt install mariadb-server
sudo systemctl start mariadb.service
|
- Change config file
1
2
| cd /etc/mysql/mariadb.conf.d/
sudo nano 50-server.cnf
|
1
2
3
| [mysqld]
max_connections = 300
wait_timeout = 180
|
- Restart mariaDB server
1
| sudo systemctl restart mariadb.service
|
๐ก ์ฐธ๊ณ ์๋ฃ
๐ต Check server.log
์ง๊ธ์ง๊ธํ๋ too many connections๊ฐ ์ฌ๋ผ์ก๋ค! ๊ทธ๋ฆฌ๊ณ ์ฌ๋ฌ๋ช
์ด ๋์์ ์ ์ํด๋ ์ ์๋ํ๋ค.