일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 | 31 |
- 리다이렉션
- 엑셀파일명변경
- vgcreate
- M365필터
- chatGPT
- journalctl
- 같은폴더
- firewalld
- 프로세스
- newbingai
- 랜카드인식불량
- nmcli
- permission
- MSBing
- swapon
- tar
- yum
- mount
- chmod
- docker image
- docker
- docker network
- 날짜변경
- ssh
- Kubernetes
- lvcreate
- HTTPD
- pvcreate
- vagrant kubernetes
- ansible
- Today
- Total
becool
20210625 (금) glusterfs, 가상인터페이스 생성 본문
9:40
스토리지
데이터를 저장
DAS / NAS / SAN
direct : 물리적 제약
network : 공간적 제약 ↓ 네트워크 장애, 보안 고려 필요
NFS SAMBA : NAS 작업공간을 공유하기 위한 주목적
iSCSI : SAN storage 통째로 공유, 공유보다는 서버의 스토리지를 통째로 주는 개념
클러스터 : 여러 시스템들을 연결해서 구성하는 방식 or 단위
노드 : 클러스터 구성 시 각각의 시스템 단위
스토리지 풀 : 물리적인 스토리지들을 묶어서 만드는 논리적 단위
---------------------------------------------------------------------------------------------
Gluster 스토리지
Red Hat® Gluster Storage는 소프트웨어 정의 스토리지(Software Defined Storage, SDS) 플랫폼으로, 백업, 아카이브 및 분석과 같은 일반적인 워크로드를 처리하기 위해 설계되었습니다. 하이퍼컨버전스에 이상적이고 비용 효율적이며 전통적인 스토리지 시스템과는 달리 베어메탈(bare metal), 가상, 컨테이너 및 클라우드 환경에 배포될 수 있습니다.
GlusterFS 는 확장이 가능한 NAS
다수의 스토리지에 대한 병렬 처리 기능 제공 (분산저장, LVM RAID)
오픈소스 (상용제품 : 레드햇)
클라우드 및 스트리밍 서비스 등에 사용
규모나 성능을 저하시키지 않고도 서비스를 제공할 수 있는 가성비 좋은 스토리지
베어메탈 (bare metal), 가상, 컨테이너 및 클라우드 환경에 배포
1) 확장 가능한 스토리지 : 스케일업(수직 - 하드웨어장비 upgrade), 스케일아웃(수평 - 시스템을 늘려서 분산처리)
2) 벤더 종속성이 없음 : 제품브랜드에 구애받지 않음
3) 컨테이너에 최적화 : (Open Shift 사용 시) → k8s 의 레드햇버전
4) 하이브리드 클라우드에 배포 ( RHV와 결합 ) -
5) 데이터를 분산처리 : 단일 실패 지점 및 병목 현상 발생 방지/감소
6) 고가용성 기능 제공
1. 시스템 준비 : vm 3대 (최소2대), 디스크 2개 (root 제외하고 1개 이상)
2. 디스크 준비 : 파티셔닝 및 마운트 (fs : xfs)
3. 패키지 설치 : gluster-server (centos경우 centos-release-gluster 먼저 설치)
4. 서비스 활성화 : glusterd
5. 방화벽 설정 : glusterfs
6.
실습
- node1, node2, node3 세팅 (web, dns, host2, localhost)
[root@dns ~]# ssh-kegen^C
[root@dns ~]# ls ~/.ssh^C
[root@dns ~]# ssh-copy-id root1@node1^C
[root@dns ~]# ssh-copy-id root1@node2^C
[root@dns ~]# ssh-copy-id root1@node3^C
[root@dns ~]# parted /dev/sdb mklabel msdos mkpart primary xfs 0 100% i^C
[root@dns ~]# for N in {node2,node3}; do ssh root@N "parted /dev/sdb mklabel msdos mkpart primary xfs 0 100% i; mkfs.xfs -i size=512 /dev/sdb1" ; done^C → 윗줄의 내용을 쉘스크립트로 2개의 노드에 적용 가능
msdos : mbr 또는 gpt
mkpart : primary
fs : xfs
0번섹터부터 100%(공간 전부)
i : 설정 끝나고 대화형 메시지에 대해 ignore 처리
# mkfs.xfs -i size=512 /dev/sdb1
# mkdir -p /data/brick1
# echo '/dev/sdb1 /data/brick1 xfs defaults 1 2' >> /etc/fstab
# mount -a && mount
[root@dns ~]# tail -n 1 /etc/fstab
/dev/sdb1 /data/brick1 xfs defaults 1 2
[root@dns ~]# yum install -y centos-release-gluster
[root@dns ~]# yum install -y glusterfs-server
※ centos 에서는 glusterfs-server 설치를 위해 사전에 centos-release-gluster 패키지를 먼저 설치
[root@dns ~]# systemctl enable glusterd
[root@dns ~]# systemctl start glusterd
[root@dns ~]# firewall-cmd --add-service=glusterfs ※ port = 24007/tcp
success
[root@dns ~]# cat /usr/lib/firewalld/services/glusterfs.xml 포트번호 참고.
※ 각각 노드별로 모두 systemctl, firewall-cmd 설정 후 아래 명령어 실행
[root@dns ~]# gluster peer probe 10.0.2.30
peer probe: success
[root@dns ~]# gluster peer probe 10.0.2.14
peer probe: success
[root@dns ~]# gluster peer probe 10.0.2.60
peer probe: success
[root@dns ~]# gluster peer status
Number of Peers: 3
Hostname: 10.0.2.30
Uuid: 56cf4bbc-40fb-4528-8ff9-61942207a8f2
State: Peer in Cluster (Connected) → 연결상태 확인
Hostname: 10.0.2.14
Uuid: 5bdcbf7b-5cc3-4086-bb59-947812eee4ab
State: Peer in Cluster (Connected)
Hostname: 10.0.2.60
Uuid: 95e57a78-ac99-4a80-bdc4-b58efb1e7b63
State: Peer in Cluster (Connected)
[root@dns ~]# gluster pool list
UUID Hostname State
56cf4bbc-40fb-4528-8ff9-61942207a8f2 10.0.2.30 Connected
5bdcbf7b-5cc3-4086-bb59-947812eee4ab 10.0.2.14 Connected
95e57a78-ac99-4a80-bdc4-b58efb1e7b63 10.0.2.60 Connected
f9e15f2b-9555-43f9-8a13-d36351e5e953 localhost Connected → 자기자신
[root@dns ~]# mkdir -p /data/brick1/gv0
[root@dns ~]# gluster volume create gv0 replica 4 10.0.2.10:/data/brick1/gv0 10.0.2.30:/data/brick1/gv0 10.0.2.14:/data/brick1/gv0 10.0.2.60:/data/brick1/gv0
volume create: gv0: success: please start the volume to access data
replica 4 : 복제본 4개
각 노드별 마운트 하위 디렉터리 지정 (gv0)
만약 ip가 아닌 hostname(node)로 지정할려면
모든 노드에서 DNS연결 + /etc/hosts 파일에 서로서로 인식할 수 있게 설정 필요함.
[root@dns ~]# gluster volume start gv0
volume start: gv0: success
[root@dns ~]# gluster volume info
Volume Name: gv0
Type: Replicate
Volume ID: eb617bf1-d0ab-49c1-994f-831a0046dde6
Status: Started
Snapshot Count: 0
Number of Bricks: 1 x 4 = 4
Transport-type: tcp
Bricks:
Brick1: 10.0.2.10:/data/brick1/gv0 :localhost
Brick2: 10.0.2.30:/data/brick1/gv0 node2
Brick3: 10.0.2.14:/data/brick1/gv0 node3
Brick4: 10.0.2.60:/data/brick1/gv0 node4
Options Reconfigured:
cluster.granular-entry-heal: on
storage.fips-mode-rchecksum: on
transport.address-family: inet
nfs.disable: on
performance.client-io-threads: off
※ 다시 설정할려면? 서버에서 detach, volume stop, volume delete 각 노드별로 setfattr + 생성된 폴더 삭제 [root@dns ~]# gluster peer detach 10.0.2.10 [root@dns ~]# gluster peer detach 10.0.2.30 [root@dns ~]# gluster peer detach 10.0.2.14 [root@dns ~]# gluster peer detach 10.0.2.60 [root@dns ~]# gluster volume stop gv0 [root@dns ~]# gluster volume delete gv0 [root@dns ~]# setfattr -x trusted.glusterfs.volume-id /data/brick1/gv0 → 각각의 노드에서 전부실행 [root@dns ~]# setfattr -x trusted.gfid /data/brick1/gv0 [root@dns ~]# rm -rf /data/brick1/gv0/.glusterfs → 하위생성폴더도 삭제 이후 볼륨생성 명령어 입력. |
[root@dns ~]# mount -t glusterfs 10.0.2.10:/gv0 /mnt/gv0
[root@dns ~]# mount |grep gv0
10.0.2.10:/gv0 on /mnt/gv0 type fuse.glusterfs (rw,realtime,user_id=0,group_id=0,default_permissions,allow_other,max_read=131072)
[root@dns ~]# echo "test gluster" > /mnt/gv0/fileA → 마운트한 노드에서 파일 작성
[root@web ~]# ls /data/brick1/gv0/ → 다른 노드에서 파일 확인 및 읽기 가능확인
fileA
[root@web ~]# cat /data/brick1/gv0/fileA
test gluster
[root@host2 ~]# echo "hello world" > /mnt/gv0/hello
[root@host2 ~]# cat /data/brick1/gv0/hello
hello world
[root@host2 ~]# cat /mnt/gv0/hello → gv폴더와 마운트된 폴더와 똑같은 파일이 있음을 확인
hello world
[root@dns ~]# ssh-keygen
[root@dns ~]# ssh-copy-id -i /root/.ssh/id_rsa.pub root@10.0.2.30
[root@dns ~]# ssh-copy-id -i /root/.ssh/id_rsa.pub root@10.0.2.14
[root@dns ~]# ssh-copy-id -i /root/.ssh/id_rsa.pub root@10.0.2.60
[root@dns ~]# cp /data/brick1/gv0/test_tar /root/
[root@dns ~]# ls -l /root/test*
-rw-r--r--. 1 root root 11581440 Jun 25 17:48 /root/test_tar
→ 마운트를 하지 않은 노드에서 공유된 파일을 가져다가 쓸수가 있음. (권한 문제 확인 필요)
------------클라이언트 : gluster-fuse 패키지로 접속
nfs-ganesha
gluster로 마운트된 스토리지를 다시 NFS-ganesha형태로 서비스.
[root@dns ~]# yum install -y centos-release-nfs-ganesha30^C
[root@dns ~]# yum install -y nfs-ganesha-gluster^C
[root@dns ~]# vim /etc/ganesha/ganesha.conf
필요한것 주석 풀기
[root@dns ~]# systemctl enable --now nfs-ganesha
[root@dns ~]# gluster volume set gv0 nfs.disable off
Gluster NFS is being deprecated in favor of NFS-Ganesha Enter "yes" to continue using Gluster NFS (y/n) yes
volume set: success
[root@dns ~]# firewall-cmd --add-service=nfs
success
=======================================================
네트워크 구성
인터페이스마다 대역폭 한계가 있음 (부하)
인터페이스를 여러 개 묶어서 사용 가능
bonding (linux) teaming(windows), LACP(link aggregation control protocol)
: 대역폭 확장/장애조치/로드밸런싱 기능 제공
teaming 구성
runner : 동작방식
broadcast | 각각의 인터페이스에서 모두 패킷을 전송 |
roundrobin | 인터페이스가 서로 한번씩 번갈아가면서 패킷을 전송 |
loadbalance | 인터페이스의 대역폭 상황을 고려하여 번갈아가면서 패킷전송 |
activebackup | 하나만 사용 |
lacp | 스위치 설정에 따르는 방식 |
[root@dns ~]# nmcli con add type team con-name team0 ifname ifteam0 config '{"runner": {"name": "activebackup"}}'
→ 가상의 인터페이스생성 : 가상의 인터페이스이므로 아무것도 할 수 없는 상태
Connection 'team0' (74253b78-cc42-4606-97e1-abecfd90828d) successfully added.
[root@dns ~]# nmcli con add type team-slave con-name team-port1 ifname enp0s3 master team0
Connection 'team-port1' (046503d0-ca96-48ae-8490-4f6144bdd3ba) successfully added.
[root@dns ~]# nmcli con add type team-slave con-name team-port2 ifname enp0s8 master team0
Connection 'team-port2' (61761934-8bfa-463b-b45d-0a3b5f39c4e1) successfully added.
→ 가상의 인터페이스 team0에 enp0s3, enp0s8 슬레이브로 연결
[root@dns ~]# ip addr show
6: ifteam0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether 08:00:27:95:d1:1e brd ff:ff:ff:ff:ff:ff
inet 10.0.2.44/24 brd 10.0.2.255 scope global noprefixroute dynamic ifteam0
valid_lft 410sec preferred_lft 410sec
inet6 fe80::e706:c6e0:baad:2516/64 scope link noprefixroute
valid_lft forever preferred_lft forever
[root@dns ~]# nmcli con show team0
team.config: {"runner": {"name": "activebackup"}} → ehternet과 달리 team.config값이 보여짐
team.notify-peers-count: 1
team.notify-peers-interval: 0 (default)
team.mcast-rejoin-count: 1
team.mcast-rejoin-interval: 0 (default)
team.runner: activebackup
team.runner-hwaddr-policy: same_all
team.runner-tx-hash: --
team.runner-tx-balancer: --
team.runner-tx-balancer-interval: -1
team.runner-active: no
team.runner-fast-rate: no
team.runner-sys-prio: -1
team.runner-min-ports: -1
team.runner-agg-select-policy: --
team.link-watchers: --
'linux' 카테고리의 다른 글
20210702 (금) dns - apache - tomcat - db (0) | 2021.07.02 |
---|---|
20210629 (화) IP alias (0) | 2021.06.29 |
20210624 (목) FTP, DHCP, PXE server, kickstart (0) | 2021.06.24 |
20210624 (목) DHCP (0) | 2021.06.24 |
20210622 (화) Nginx (0) | 2021.06.22 |