Skip to content

Instantly share code, notes, and snippets.

@hysios
Last active July 10, 2018 06:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hysios/016b3374e68b158006c55b07bbf54607 to your computer and use it in GitHub Desktop.
Save hysios/016b3374e68b158006c55b07bbf54607 to your computer and use it in GitHub Desktop.
MEMBERS=192.168.0.4,192.168.0.5
HOST=192.168.0.3
CEPH_USER_ID=`id -u ceph`
MASTER=k8smaster
ID=`uuidgen`
NODE=${1:-0}
CLUSTER=ceph
NETWORK=192.168.0.0/24
osd journal size = 1024
osd pool default size = 3
osd pool default min size = 2
osd pool default pg num = 333
osd pool default pgp num = 333
osd crush chooseleaf type = 1
rm -rf /etc/ceph
mkdir -p /etc/ceph
cat <<EOF > /etc/ceph/ceph.conf
[global]
fsid = {UUID}
mon initial members = ${MEMBERS}
mon host = ${HOST}
public network = ${NETWORK}
cluster network = ${NETWORK}
auth cluster required = cephx
auth service required = cephx
auth client required = cephx
EOF
ceph-authtool --create-keyring /tmp/ceph.mon.keyring --gen-key -n mon. --cap mon 'allow *'
ceph-authtool --create-keyring /etc/ceph/ceph.client.admin.keyring --gen-key -n client.admin --set-uid=${CEPH_USER_ID} --cap mon 'allow *' --cap osd 'allow *' --cap mds 'allow *' --cap mgr 'allow *'
ceph-authtool /tmp/ceph.mon.keyring --import-keyring /etc/ceph/ceph.client.admin.keyring
monmaptool --create --add $MASTER $HOST --fsid $ID /tmp/monmap
mkdir -p /var/lib/ceph/mon/ceph-$NODE
MON_NODE_PATH=/var/lib/ceph/mon/ceph-$NODE
chown -R ceph:ceph /var/lib/ceph/mon/ceph-$NODE
sudo -u ceph ceph-mon --cluster $CLUSTER --mkfs -i $HOSTNAME --monmap /tmp/monmap --keyring /tmp/ceph.mon.keyring
touch /var/lib/ceph/mon/ceph-$NODE/done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment