클라우드 엔지니어 꿈나무
Docker Container Loadbalancer + php + wordpress + mysql - Centos7 본문
구성
Centos7-1
-role 1
yum install -y haproxy
vi /etc/haproxy/haproxy.cfg
systemctl start haproxy
- role 2
vi /etc/haproxy/haproxy.cfg
vi /etc/haproxy/haproxy.cfg
Centos7-2
- role 1
docker run -itd -v /root/h1:/var/www/html -p 60080:80 --name h1 fbsanchez/httpdphp
docker run -itd -v /root/h2:/var/www/html -p 60180:80 --name h2 fbsanchez/httpdphp
docker run -itd -v /root/h3:/var/www/html -p 60280:80 --name h3 fbsanchez/httpdphp
docker run -itd -v /root/h4:/var/www/html -p 60380:80 --name h4 fbsanchez/httpdphp
docker exec -it h1 /bin/bash 도커 컨테이너로 이동
vi /etc/httpd/conf/httpd.conf
index.html 을 index.php 로 수정
exit
cp /php/table1.php /root/h2
cp /php/table1.php /root/h3
cp /php/table1.php /root/h4
cp /php/person1.phhp /root/h1
cp /php/person1.php /root/h1
cp /php/person1.php /root/h2
cp /php/person1.php /root/h3
cp /php/person1.php /root/h4
cp /php/inser1.php /root/h1
cp /php/insert1.php /root/h1
cp /php/insert1.php /root/h2
cp /php/insert1.php /root/h3
cp /php/insert1.php /root/h4
cp /php/index.php /root/h4
cp /php/index.php /root/h3
cp /php/index.php /root/h2
cp /php/index.php /root/h1
vi h1/index.php
vi h2/index.php
vi h1/index.php
vi h2/index.php
vi h3/index.php
vi h4/index.php
vi h1/person1.php
vi h2/person1.php
vi h3/person1.php
vi h4/person1.php
vi h1/person1.php
vi h1/table1.php
vi h2/table1.php
vi h3/table1.php
vi h1/table1.php
vi h2/table1.php
vi h3/table1.php
vi h4/table1.php
vi h4/insert1.php
vi h1/insert1.php
vi h2/insert1.php
vi h3/insert1.php
vi h4/insert1.php
firewall-cmd --add-port=80/tcp
-role 2
docker pull wordpress
docker run -itd -e WORDPRESS_DB_HOST=10.0.0.3
docker run -itd -e WORDPRESS_DB_HOST=10.0.0.3
docker run -itd -e WORDPRESS_DB_HOST=10.0.0.3
docker run -itd -e WORDPRESS_DB_HOST=10.0.0.3
Centos7-3
- role 1 & 2
yum install -y http://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm
vi /etc/yum.repos.d/mysql-community.repo
gpgket 미사용으로 변경
yum install -y mysql-community.repo
yum install -y mysql-community-client
mysql -uroot -pIt1 -h 10.0.0.3
firewall-cmd --add-port=3306/tcp
인터넷창
- role 1
10.0.0.1 입력시, 하기 창이 돌아가며 표시됨
- role 2
10.0.0.1 입력시, 하기 창이 표시됨
'container' 카테고리의 다른 글
Docker Haproxy를 활용한 LoadBalancer (1) | 2023.10.03 |
---|---|
Docker network - CentOS7 (0) | 2023.10.03 |
Docker hub에 이미지 올리기 - CentOS7 (0) | 2023.10.03 |
Docker 기본 명령어 및 컨테이너 볼륨 생성 후 haproxy 연결 (0) | 2023.09.07 |
Docker 설치 및 기본 명령어 - CentOS (0) | 2023.09.06 |