Skip to main content

Arquitetura

┌─────────────────────────────────────┐
│           Ceph Cluster               │
├─────────────────────────────────────┤
│  MONs (Monitors)     MGRs          │
│  ┌───┐ ┌───┐ ┌───┐   ┌───┐        │
│  │   │ │   │ │   │   │   │        │
│  └───┘ └───┘ └───┘   └───┘        │
├─────────────────────────────────────┤
│  OSDs (Object Storage Daemons)      │
│  ┌───┐ ┌───┐ ┌───┐ ┌───┐ ┌───┐    │
│  │   │ │   │ │   │ │   │ │   │    │
│  └───┘ └───┘ └───┘ └───┘ └───┘    │
├─────────────────────────────────────┤
│  RGW (Rados Gateway)                │
│  ┌─────────────────────────────┐   │
│  │  S3 / Swift API             │   │
│  └─────────────────────────────┘   │
└─────────────────────────────────────┘

Instalação

# Adicionar repositório
wget -q -O- 'https://download.ceph.com/keys/apt.asc' | sudo apt-key add -
echo deb https://download.ceph.com/debian-quincy/ $(lsb_release -sc) main | sudo tee /etc/apt/sources.list.d/ceph.list
apt update

# Instalar pacotes
apt install ceph ceph-mgr ceph-mon ceph-osd ceph-radosgw

Cluster

# Criar cluster
cephadm bootstrap --mon-ip 192.168.1.10

# Adicionar hosts
ceph orch host add node2 192.168.1.11
ceph orch host add node3 192.168.1.12

# Ver status
ceph status
ceph -s
ceph orch ls

OSD

# Listar OSDs
ceph osd ls

# Ver tree
ceph osd tree

# Adicionar OSD
ceph orch daemon add osd node2:/dev/sdb

# Remover OSD
ceph orch osd rm osd.0

Pools

# Criar pool
ceph osd pool create mypool 128

# Ver pools
ceph osd lspools

# Configurar pg_num
ceph osd pool set mypool pg_num 128
ceph osd pool set mypool pgp_num 128

RBD (Block Device)

# Criar imagem
rbd create mypool/myimage --size 10G

# Mapear
rbd map mypool/myimage

# Listar
rbd ls mypool

# Snapshots
rbd snap create mypool/myimage@snap1
rbd snap protect mypool/myimage@snap1
rbd clone mypool/myimage@snap1 mypool/myimage-clone

RGW (Object Gateway)

# Deploy RGW
ceph orch apply rgw myrgw --realm=myrealm --zonegroup=myzonegroup --zone=myzone

# Criar usuário S3
radosgw-admin user create --uid="myuser" --display-name="My User"

# Swift
radosgw-admin subuser create --uid=myuser --subuser=myuser:swift --access=full

CephFS

# Criar filesystem
ceph fs volume create myfs

# Mount
mount -t ceph 192.168.1.10:6789:/ /mnt/cephfs -o name=admin,secret=$(ceph auth get-key client.admin)

Monitor

# Status
ceph mon stat
ceph quorum_status

# Ver members
ceph mon dump