LB 1대와 web 서버 7대 db 서버 4대로 구성 예정
LB에는 web서버를 묶게 하고 db서버는 haproxy 구성을 통하여 master-slave 구성 예정
각 서버 별 ulimit 오픈파일 설정 필요하고, haproxy 세션 수 증가 필요, db max connection 증가 필요 web서버는 apache 를 사용하면 들어오는 MaxRequestWorkers 수 증가 필요
웹서버에서 설정 진행 한 부분
/etc/httpd/conf.modules.d 경로 내 00-mpm.conf 파일
<Ifmodule mpm_prefork_module>
ServerLimit 50000
StartServers 5
MinSpareServers 5
MaxSpareServers 200
MaxRequestWorkers 50000
MaxConnectionsPerChild 0
</IfModule>
/etc/php.ini 경로
memory_limit = 2048M 값 변경
haproxy 서버에서 설정 진행 한 부분
global 라인 쪽
log /dev/log local2
maxconn 20000
frontend maria_frontend
bind *:3306
mode tcp
default_backend maria_backend
backend maria_backend
mode tcp
balance roundrobin
server maria2 172.27.0.215:3306 check
server maria3 172.27.0.91:3306 check
db 서버 설정 진행 한 부분
/etc/my.cnf.d/server.conf 파일
# master 서버
[mysqld]
log_bin=mysql-bin
server_id=1
log_error=/var/log/mysql_error.log
max_connections = 10000
wait_timeout = 60
table_open_cache = 8000
# slave 1번 서버
[server]
server_id=2
relay-log=mysql-relay-bin
# this is only for the mysqld standalone daemon
[mysqld]
max_connections = 5000
wait_timeout = 60
log_error=/var/log/mysql_error.log
table_open_cache = 8000
# slave 2번 서버
[server]
server_id=3
relay-log=mysql-relay-bin
# this is only for the mysqld standalone daemon
[mysqld]
max_connections = 5000
wait_timeout = 60
log_error=/var/log/mysql_error.log
table_open_cache = 8000
서버 사양 문제로 max_connection은 5000으로 잡음.
db master user 계정 id : replication_user1 pwd : qwer1234