VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "ubuntu/focal64"
config.vm.provider "virtualbox" do |vb|
vb.memory = 2048
end
if Vagrant.has_plugin?("vagrant-vbguest")
config.vbguest.auto_update = false
end
config.vm.synced_folder ".", "/vagrant", type: "rsync", rsync__exclude: [".git/"]
config.vm.provision "shell", inline: <<-SHELL
export DEBIAN_FRONTEND=noninteractive
sudo apt -y update
sudo apt install -y ca-certificates curl gnupg libnss-mdns
sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
sudo chmod a+r /etc/apt/keyrings/docker.gpg
echo "deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu "$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt -y update
sudo apt install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin
sudo usermod -aG docker vagrant
SHELL
config.vm.define "ceph", primary: true do |ceph|
ceph.vm.hostname = "ceph.local"
ceph.vm.network "private_network", ip: "192.168.34.101"
end
config.vm.define "registry", primary: true do |registry|
registry.vm.hostname = "registry.local"
registry.vm.network "private_network", ip: "192.168.34.102"
end
config.vm.define "node", primary: true do |node|
node.vm.hostname = "node.local"
node.vm.network "private_network", ip: "192.168.34.103"
end
end
출처 : Grepp
Docker Ceph/daemon image : 다중 호스트일 때 key value 형태의 데이터를 저장하려면 ETCD 서비스를 별도로 띄워야 합니다.
(without KV STORE(암호화 FS))
# Docker-compose.yml
services:
ceph-mon:
# latest-mimic 이미지로 실행하지 않을 경우 에러가 발생할 수 있습니다.
image: ceph/daemon:latest-mimic
network_mode: host
container_name: ceph-mon
volumes:
- /etc/ceph:/etc/ceph
- /var/lib/ceph:/var/lib/ceph
environment:
- MON_IP=192.168.34.101
- CEPH_PUBLIC_NETWORK=192.168.34.0/24
command:
mon
keyring issue : https://github.com/ceph/ceph-container/issues/1683
# Docker-compose.yml
ceph-mgr:
image: ceph/daemon:latest-mimic
network_mode: host
container_name: ceph-mgr
volumes:
- /etc/ceph:/etc/ceph
- /var/lib/ceph:/var/lib/ceph
command:
mgr
ceph-osd:
image: ceph/daemon:latest-mimic
network_mode: host
privileged: true
container_name: ceph-osd
volumes:
- /etc/ceph:/etc/ceph
- /var/lib/ceph:/var/lib/ceph
- /dev:/dev
- /run/udev:/run/udev
environment:
# sdc 디스크를 추가로 virtualbox에 생성
- OSD_DEVICE=/dev/sdc
- OSD_TYPE=disk
command:
osd
FS형태로 제공하는 노드(NFS, CephFS 등)
DATA_POOL : mds 는 블럭 중 일부를 할당받아 CephFS로 만듭니다. 이때 사용할 data 파일 내용에 대한 정보를 DATA_POOL이라 합니다.
ceph-mds:
image: ceph/daemon:latest-mimic
network_mode: host
volumes:
- /var/lib/ceph:/var/lib/ceph
- /etc/ceph:/etc/ceph
environment:
- CEPHFS_CREATE=1
command:
mds
docker exec -it ceph-mgr ceph mgr module enable dashboard
docker exec -it ceph-mgr ceph dashboard create-self-signed-cert
docker exec -it ceph-mgr ceph mgr services
실행 결과
docker exec -it ceph-mgr ceph dashboard set-login-credentials <id> <pw>