Ceph 파일 시스템 (CephFS) 실무

Ceph 파일 시스템 (CephFS) 실무

1️⃣ CephFS 개념 및 동작 방식

1. CephFS란?

CephFS(Ceph File System)는 Ceph의 분산 파일 시스템으로, Ceph 클러스터 내에서 파일 시스템을 제공합니다. CephFS는 여러 서버 간에 데이터를 분산 저장하면서도, 일반적인 파일 시스템처럼 동작할 수 있습니다.

🔹 주요 특징

  • 확장성: 데이터가 여러 OSD에 분산되어 있어 스토리지 용량 확장이 용이함
  • 고가용성: 클러스터 내에서 자동 복구 및 복제 기능을 제공
  • 성능: CephFS는 대규모 데이터 처리에 최적화되어 있으며, 병렬 처리 및 데이터 캐싱을 지원

2. CephFS 동작 원리

CephFS는 **Metadata Server (MDS)**와 **OSD (Object Storage Daemon)**로 구성되어 있습니다. MDS는 파일 시스템의 메타데이터를 관리하고, OSD는 실제 데이터를 저장합니다.

📌 💡 CephFS는 Ceph의 분산 아키텍처를 활용하여 높은 성능과 확장성을 제공합니다.


2️⃣ CephFS 구축 및 마운트 (ceph-fuse, mount.ceph)

1. CephFS 설치

CephFS를 사용하기 위해서는 먼저 Ceph 클러스터에서 CephFS를 활성화해야 합니다. CephFS를 활성화하려면, ceph CLI에서 다음 명령을 실행합니다.

# CephFS 활성화
ceph fs new cephfs ceph-balance ceph-metadata

2. CephFS 마운트 (ceph-fuse 사용)

CephFS를 클라이언트 시스템에 마운트하려면 ceph-fuse 또는 mount.ceph 명령을 사용할 수 있습니다. ceph-fuse는 Ceph 클러스터에서 CephFS를 사용하기 위한 FUSE 기반 마운트 유틸리티입니다.

# CephFS 마운트 (ceph-fuse 사용)
ceph-fuse /mnt/cephfs

3. mount.ceph 사용하여 CephFS 마운트

# CephFS 마운트 (mount.ceph 사용)
mount -t ceph :/ /mnt/cephfs -o name=admin,secret=<secret-key>

📌 💡 CephFS는 클라이언트 시스템에서 표준 파일 시스템처럼 마운트되어 사용할 수 있습니다.


3️⃣ CephFS Metadata Server (MDS) 설정 및 관리

1. MDS 구성

CephFS의 메타데이터는 MDS가 관리합니다. MDS는 Ceph 클러스터에서 파일과 디렉터리의 정보를 저장하고 처리합니다.

# MDS 모니터링 상태 확인
ceph mds stat

2. MDS 설치 및 시작

# MDS 데몬 시작
ceph-deploy mds create <mds-node>

3. MDS 서비스 관리

MDS 데몬의 상태 및 로그를 확인하고, 필요시 재시작을 할 수 있습니다.

# MDS 서비스 상태 확인
systemctl status ceph-mds@<mds-node>

📌 💡 MDS는 CephFS에서 파일 시스템의 메타데이터를 효율적으로 관리하여 성능을 최적화합니다.


4️⃣ CephFS Snapshot 및 데이터 보호

1. CephFS 스냅샷 생성

CephFS는 ceph CLI를 사용하여 스냅샷을 생성할 수 있습니다. 스냅샷은 특정 시점의 데이터를 저장하여 복구할 수 있도록 합니다.

# CephFS 스냅샷 생성
rados snap create cephfs_data@snapshot1

2. 스냅샷 목록 확인 및 삭제

# CephFS 스냅샷 목록 확인
rados snap ls cephfs_data

# CephFS 스냅샷 삭제
rados snap rm cephfs_data@snapshot1

📌 💡 스냅샷을 통해 CephFS 데이터를 보호하고, 손실된 데이터를 복구할 수 있습니다.


5️⃣ CephFS 성능 튜닝 (mds cache, journaling, client performance tuning)

1. MDS 캐시 성능 튜닝

MDS의 성능을 최적화하기 위해 캐시 크기를 조정할 수 있습니다.

# MDS 캐시 크기 설정
ceph config set mds.<mds-node> mds_cache_size 1024

2. Journaling 활성화

Journaling은 CephFS의 데이터 무결성을 보장하는 중요한 기능입니다.

# Journaling 활성화
ceph config set mds.<mds-node> mds_journal_size 100MB

3. 클라이언트 성능 튜닝

클라이언트 성능을 향상시키기 위해 여러 매개변수를 조정할 수 있습니다.

# 클라이언트 캐시 크기 설정
ceph config set client ceph_client_cache_size 128M

📌 💡 성능 튜닝을 통해 CephFS를 최적화하고, 높은 처리 성능을 유지할 수 있습니다.


6️⃣ NFS-Ganesha를 통한 NFS 지원

1. NFS-Ganesha 설치

NFS-Ganesha는 CephFS를 NFS 서버로 활용할 수 있도록 해주는 솔루션입니다. 이를 통해 CephFS를 NFS 클라이언트에서 마운트할 수 있습니다.

# NFS-Ganesha 설치
apt-get install nfs-ganesha-ceph

2. NFS-Ganesha 설정

# /etc/ganesha/ganesha.conf 파일 수정
EXPORT {
    Export_Id = 1;
    Path = /mnt/cephfs;
    Pseudo = /cephfs;
    Access_Type = RW;
    Squash = No_Root_Squash;
}

3. NFS 서버 시작

# NFS-Ganesha 서비스 시작
systemctl start nfs-ganesha

📌 💡 NFS-Ganesha를 활용하면 CephFS를 NFS 서버로 제공하여 다양한 시스템과의 호환성을 확보할 수 있습니다.


7️⃣ Kubernetes 환경에서 CephFS 활용

1. Kubernetes에서 CephFS 사용을 위한 설정

Kubernetes에서 CephFS를 사용하려면 먼저 PersistentVolume(PV)과 PersistentVolumeClaim(PVC)을 정의해야 합니다.

apiVersion: v1
kind: PersistentVolume
metadata:
  name: cephfs-pv
spec:
  capacity:
    storage: 10Gi
  accessModes:
    - ReadWriteMany
  persistentVolumeReclaimPolicy: Retain
  cephfs:
    monitors:
      - <mon-ip>:6789
    user: admin
    secretRef:
      name: ceph-secret
    path: /mnt/cephfs
    readOnly: false

2. CephFS를 PVC로 연결

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: cephfs-pvc
spec:
  accessModes:
    - ReadWriteMany
  resources:
    requests:
      storage: 10Gi
  storageClassName: cephfs

3. Pod에서 CephFS 사용

apiVersion: v1
kind: Pod
metadata:
  name: cephfs-pod
spec:
  containers:
    - name: cephfs-container
      image: ubuntu
      volumeMounts:
        - mountPath: "/mnt/data"
          name: cephfs-volume
  volumes:
    - name: cephfs-volume
      persistentVolumeClaim:
        claimName: cephfs-pvc

📌 💡 Kubernetes 환경에서 CephFS를 활용하면, 여러 Pod 간에 동일한 파일 시스템을 공유할 수 있습니다.


RSS Feed
마지막 수정일자