You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

53 lines
2.6 KiB
Bash

#!/bin/bash
#mon
#on existing node:
docker exec ceph_mon ceph config generate-minimal-conf
cat /ceph/mon/etc/ceph/ceph.mon.keyring
cat /ceph/mon/etc/ceph/ceph.client.admin.keyring
#copy ceph.conf, ceph.client.admin.keyring, ceph.mon.keyring manually to /ceph/mon/etc/ceph on new node
mkdir -p /ceph/mon/etc/ceph
chmod 600 /ceph/mon/etc/ceph/ceph.mon.keyring /ceph/mon/etc/ceph/ceph.client.admin.keyring
ip='10.13.37.4'
docker run -d --rm --net=ceph --hostname $(hostname) -v /ceph/mon/etc/ceph:/etc/ceph -v /ceph/mon/var/lib/ceph:/var/lib/ceph --ip "$ip" -e MON_IP="$ip" -e CEPH_PUBLIC_NETWORK=10.13.37.0/23 -e CEPH_CLUSTER_NETWORK=10.13.37.0/23 --name ceph_mon quay.io/ceph/daemon:latest-octopus mon
#mgr
mkdir -p /ceph/mgr/etc/ceph/
(docker exec ceph_mon ceph config generate-minimal-conf) > /ceph/mgr/etc/ceph/ceph.conf
cp -a /ceph/mon/etc/ceph/ceph.client.admin.keyring /ceph/mgr/etc/ceph/
docker run --rm --net=ceph --hostname $(hostname) -v /ceph/mgr/etc/ceph:/etc/ceph -v /ceph/mgr/var/lib/ceph:/var/lib/ceph --name ceph_mgr quay.io/ceph/daemon:latest-octopus mgr
rm /ceph/mgr/etc/ceph/ceph.client.admin.keyring
#osd
device='nvme0n1'
mkdir -p /ceph/osd_$device/etc/ceph/ /ceph/osd_$device/var/lib/ceph/bootstrap-osd /ceph/osd_$device/var/lib/ceph/osd
(docker exec ceph_mon ceph auth get client.bootstrap-osd) > /ceph/osd_$device/var/lib/ceph/bootstrap-osd/ceph.keyring
(docker exec ceph_mon ceph config generate-minimal-conf) > /ceph/osd_$device/etc/ceph/ceph.conf
echo -e '\tbdev_enable_discard = true' >> /ceph/osd_$device/etc/ceph/ceph.conf
echo -e '\tbdev_async_discard = true' >> /ceph/osd_$device/etc/ceph/ceph.conf
docker run --rm --net=ceph --hostname $(hostname) --privileged -v /ceph/osd_$device/etc/ceph:/etc/ceph -v /ceph/osd_$device/var/lib/ceph:/var/lib/ceph -v /dev:/dev --entrypoint ceph-volume quay.io/ceph/daemon:latest-octopus lvm prepare --bluestore --dmcrypt --data /dev/$device
rm /ceph/osd_$device/var/lib/ceph/bootstrap-osd/ceph.keyring
mv /ceph/osd_$device /ceph/osd_<id>
#mds
mkdir -p /ceph/mds/etc/ceph/ /ceph/mds/var/lib/ceph/bootstrap-mds
(docker exec ceph_mon ceph config generate-minimal-conf) > /ceph/mds/etc/ceph/ceph.conf
cp -a /ceph/mon/etc/ceph/ceph.client.admin.keyring /ceph/mds/etc/ceph/
#client
mkdir -p /ceph/client/etc/ceph
docker exec ceph_mon ceph config generate-minimal-conf > /ceph/client/etc/ceph/ceph.conf
echo -e '\tfuse_set_user_groups = false' >> /ceph/client/etc/ceph/ceph.conf
(docker exec ceph_mon ceph fs authorize cephfs client.$(hostname) / rws) > /ceph/client/etc/ceph/keyring
chmod 600 /ceph/client/etc/ceph/keyring
#status
docker exec ceph_mon ceph status