본문 바로가기

클라우드/도커(Docker)

Wordpress 인프라 구성

wp-lb
* ha-proxy
* /etc/haproxy/haproxy-cfg

wp-web1 /wp-web2
* wp-storage(/mnt/nfs) --> /var/www/html
* apache2
* wordpress

wp-db
* --iscsi--> /var/lib/mysql
* mysql

wp-storage
* sdc -> /mnt/nfs
* sdd ---iscsi--> wp-db

더보기

# sdc 파티션
root@storage:~# sudo fdisk /dev/sdc

# 파일시스템 생성
root@storage:~# mkfs -t ext4 /dev/sdc

# storage 마운트
root@storage:~# sudo su - root
root@storage:~# mkdir /mnt/nfs
root@storage:~# mount /dev/sdc /mnt/nfs
root@storage:~# vi /etc/fstab
/dev/sdc /mnt/nfs ext4 defaults 0 2
root@storage:~# mount -a
root@storage:~# df -h
Filesystem Size Used Avail Use% Mounted on
udev 977M 0 977M 0% /dev
tmpfs 199M 948K 198M 1% /run
/dev/sda1 39G 1.5G 38G 4% /
tmpfs 994M 0 994M 0% /sys/fs/cgroup
/dev/loop1 33M 33M 0 100% /snap/snapd/12159
tmpfs 199M 0 199M 0% /run/user/1000
vagrant 117G 46G 72G 39% /vagrant
/dev/sdc 9.8G 37M 9.3G 1% /mnt/nfs


우분투 NFS 설정 -서버

더보기

# 서버(storage) 설정
# NFS 패키지 프로그램 설치
vagrant@storage:~$ sudo -i
root@storage:~# apt-get install nfs-kernel-server

# NFS 설정 수정 (내보내기)
# 설정 파일 /etc/exports
root@storage:~# vi /etc/exports
/mnt/nfs 192.168.200.0/24(rw,sync,no_root_squash)

# 반영
root@storage:~# exportfs -arv
root@storage:~# systemctl restart nfs-kernel-server


우분투 NFS설정 - 클라이언트

더보기

# 클라이언트 (web1,web2) 설정
# NFS 패키지 프로그램 설치
root@web1:~# apt-get install nfs-common (클라이언트 패키지)

# 마운트
root@web1:~# mount -t 192.168.200.18:/mnt/nfs /var/www/html

# 영구 마운트
root@web1:~# vi /etc/fstab
192.168.200.18:/mnt/nfs /var/www/html nfs rw 0 0

 


DB 설정

더보기

# db 설정
# iscsi 연결
root@db:~# cd /etc/iscsi
root@db:/etc/iscsi# iscsiadm -m discovery -t st -p 192.168.200.18
root@db:/etc/iscsi# iscsiadm -m node -T iqn.2021-06.com.cccr:storage -l

# mysql 설치
root@db:~# apt install -y mysql-server

# db 생성
root@db:~# mysql -u root -p
mysql> CREATE DATABASE wordpress;
mysql> CREATE USER 'wordpress'@'%' IDENTIFIED BY 'qwer1234';
mysql> GRANT ALL PRIVILEGES ON wordpress.* TO 'wordpress'@'%';
mysql> FLUSH PRIVILEGES;
mysql> quit

# DB bind 설정
root@db:~# vi /etc/mysql/mysql.conf.d/mysqld.cnf
# localhost which is more compatible and is not less secure.
bind-address = 0.0.0.0
mysqlx-bind-address = 0.0.0.0

# mysql 재시작
root@db:~# systemctl restart mysql

설정 2 -> 오류남

 


WEB 설정
wordpress 설치

더보기

#web1 워드프레스 설치
root@web1:~# apt install php php-mysql php-gd php-mbstring wet unzip
root@web1:~# wget https://ko.wordpress.org/wordpress-4.8.2-ko_KR.zip
root@web1:~# cd /var/www/html
root@web1:/var/www/html# unzip /root/worsystemctl restart apache2
root@web1:/var/www/html# systemctl restart apache2

# 워드프레스 설치 방법 2
vagrant@wp-web1:~$ sudo apt install php libapache2-mod-php php-mysql
vagrant@wp-web1:~$ wget https://wordpress.org/latest.tar.gz
vagrant@wp-web1:~$ tar xf latest.tar.gz
vagrant@wp-web1:~$ sudo cp -r wordpress /var/www/html



더보기

# wp-config.php 파일 설정
root@web1:/var/www/html/wordpress# cp wp-config-sample.php wp-config.php
root@web1:/var/www/html/wordpress# vi wp-config.php

// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', 'wordpress');

/** MySQL database username */
define('DB_USER', 'wordpress');

/** MySQL database password */
define('DB_PASSWORD', 'qwer1234');

/** MySQL hostname */
define('DB_HOST', '192.168.200.15');

'클라우드 > 도커(Docker)' 카테고리의 다른 글

가상화 Virtualization 개념  (0) 2021.06.30
haproxy session stickiness( 로드밸런서 세션 고정)  (0) 2021.06.29
iSCSI(아이스카시)  (0) 2021.06.28
Vagrant 장치 추가  (0) 2021.06.28
HA-Proxy 로드밸런서  (0) 2021.06.28