Single node Ceph setup script

728 views
Skip to first unread message

Noah Watkins

unread,
Dec 12, 2014, 12:49:36 PM12/12/14
to cloudla...@googlegroups.com
Here is a script that I put together that will setup a single node Ceph cluster (1 mon, 1 osd). It’s meant as a reference for setting up Ceph on CloudLab.

There aren’t any official Ceph ARM builds. I created the arm64 build packages and stuck them up at ceph.com/noah/. Note that these are **NOT** QA’d at all (beyond my own sanity checks), so YMMV. I’ve tested this on the `arm64 ubuntu 14.04` image.

After running the script below, `ceph status` should show a live Ceph cluster with good health:

```
nwatkins@node:~$ ceph status
   cluster 9cf5b56e-fb67-48cb-a2c1-2b2eb36c3f61
    health HEALTH_OK
    monmap e1: 1 mons at {node=128.110.152.35:6789/0}
           election epoch 2, quorum 0 node
    osdmap e5: 1 osds: 1 up, 1 in
     pgmap v10: 64 pgs, 1 pools, 0 bytes data, 0 objects
           12705 MB used, 94100 MB / 109 GB avail
                 64 active+clean
```

ceph-setup-cloudlab.sh

```
#!/bin/bash

set -e
set -x

sudo apt-get update

# grab ceph packages
mkdir ceph-build
cd ceph-build
wget -r --no-parent http://ceph.com/noah/build-master/
cd ceph.com/noah/build-master/
set +e # will fail with unmet dependencies
sudo dpkg -i *.deb
set -e
sudo apt-get -f -y install
cd ~

# setup ssh keys
HOSTNAME=`hostname`
ssh-keygen -t rsa -N '' -f ~/.ssh/id_rsa -q
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys 
ssh-keyscan -H $HOSTNAME >> ~/.ssh/known_hosts
cd ~

# setup ceph
sudo apt-get install ceph-deploy
mkdir cluster
cd cluster/
ceph-deploy new $HOSTNAME
echo "osd crush chooseleaf type = 0" >> ceph.conf
echo "osd pool default size = 1" >> ceph.conf
ceph-deploy mon create-initial $HOSTNAME
sudo mkdir /mnt/ceph
sudo mkdir /mnt/ceph/osd
sudo dd if=/dev/zero of=/mnt/ceph/journal bs=1024K count=1024
ceph-deploy osd prepare $HOSTNAME:/mnt/ceph/osd:/mnt/ceph/journal
ceph-deploy osd activate $HOSTNAME:/mnt/ceph/osd:/mnt/ceph/journal

# test
sudo chmod a+r /etc/ceph/ceph.client.admin.keyring 
```

Leigh Stoller

unread,
Dec 12, 2014, 2:15:33 PM12/12/14
to Noah Watkins, cloudla...@googlegroups.com
> Here is a script that I put together that will setup a single node Ceph
> cluster (1 mon, 1 osd). It’s meant as a reference for setting up Ceph on
> CloudLab.

Hi. That looks really nice. One thing you could do, is create your own
profile to do this automatically. See the attached rspec. You would need to
take your script and stick into a tarfile and host it. See the services
section, I just made up the names.

From the Actions menu, click on Create Profile. You can also add the
description and instructions. Then anyone could use it!

Leigh

f.txt
Reply all
Reply to author
Forward
0 new messages