Notice
Recent Posts
Recent Comments
Link
«   2024/11   »
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
Tags
more
Archives
Today
Total
관리 메뉴

클라우드 엔지니어 꿈나무

Docker Container Loadbalancer + php + wordpress + mysql - Centos7 본문

container

Docker Container Loadbalancer + php + wordpress + mysql - Centos7

새싹싹이 2023. 9. 10. 15:13

구성

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 입력시, 하기 창이 표시됨