Project

General

Profile

Ceph Vagrant Setup » History » Version 2

Jessica Mack, 06/05/2015 04:27 PM

1 1 Jessica Mack
h1. Ceph Vagrant Setup
2
3 2 Jessica Mack
[Reposted from: "Sebastien Han":http://www.sebastien-han.fr/blog/2013/04/22/play-with-ceph-vagrant-box/]
4 1 Jessica Mack
5
{{toc}}
6
 
7
Materials to start playing with Ceph. This Vagrant box contains a all-in-one Ceph installation.
8
9
h3. I. SETUP
10
11 2 Jessica Mack
First "Download":https://www.vagrantup.com/downloads-archive.html and "Install":http://docs.vagrantup.com/v2/installation/index.html Vagrant.
12
Download the Ceph box: "here":https://www.dropbox.com/s/hn28qgjn59nud6h/ceph-all-in-one.box. This box contains one virtual machine:
13 1 Jessica Mack
* Ceph VM contains 2 OSDs (1 disk each), 1 MDS, 1 MON, 1 RGW. A modified CRUSH Map, it simply represents a full datacenter and applies a replica per OSD
14
* VagrantFile for both VM client and ceph
15
* Other include files
16
17 2 Jessica Mack
Download an extra VM for the client "here":https://dl.dropboxusercontent.com/u/1537815/precise64.box, note that Debian and Red Hat based system work perfectly, thus it’s up to you:
18 1 Jessica Mack
* Client: just an Ubuntu installation
19
20
Initialize the Ceph box:
21
<pre>
22
$ wget https://www.dropbox.com/s/hn28qgjn59nud6h/ceph-all-in-one.box
23
...
24
...
25
$ vagrant box add big-ceph ceph-all-in-one.box
26
[vagrant] Downloading with Vagrant::Downloaders::File...
27
[vagrant] Copying box to temporary location...
28
[vagrant] Extracting box...
29
[vagrant] Verifying box...
30
[vagrant] Cleaning up downloaded box...
31
</pre>
32
 
33
Initialize the Client box:
34
<pre>
35
$ wget http://dl.dropbox.com/u/1537815/precise64.box
36
$ vagrant box add ubuntu-12.04.1 precise64.box
37
[vagrant] Downloading with Vagrant::Downloaders::File...
38
[vagrant] Copying box to temporary location...
39
[vagrant] Extracting box...
40
[vagrant] Verifying box...
41
[vagrant] Cleaning up downloaded box...
42
</pre>
43
44
Check your boxes:
45
46
<pre>
47
$ vagrant box list
48
ceph-all-in-one
49
ubuntu-12.04.1
50
</pre>
51
52
Import all the files from the box:
53
54
<pre> 
55
$ mkdir setup
56
$ cp /Users/leseb/.vagrant.d/boxes/ceph-all-in-one/include/* setup/
57
$ mv setup/_Vagrantfile Vagrantfile
58
</pre>
59
 
60
In order to make the setup easy, I assume that your working directory is $HOME/ceph. At the end, your tree directory looks like this:
61
<pre>
62
.
63 2 Jessica Mack
??? Vagrantfile
64
??? ceph-all-in-one.box
65
??? precise64.box
66
??? setup
67
    ??? ceph.conf
68
    ??? ceph.sh
69
    ??? keyring
70 1 Jessica Mack
</pre>
71
72
h3. II. START IT!
73
74
Check the state of your virtual machines:
75
 
76
<pre>
77
$ vagrant status
78
Current VM states:
79
client                   poweroff
80
ceph                     poweroff
81
This environment represents multiple VMs. The VMs are all listed
82
above with their current state. For more information about a specific
83
VM, run `vagrant status NAME`.
84
</pre>
85
86
Eventually run them:
87
88
<pre>
89
$ vagrant up ceph && vagrant up client
90
...
91
...
92
</pre>
93
94
The next time, you’ll run the client, run it this way to don’t re-provision the machine:
95
96
<pre>
97
$ vagrant up --no-provision client
98
</pre>
99
100
Eventually SSH on your client:
101
 
102
<pre>
103
$ vagrant ssh client
104
...
105
vagrant@ceph:~$ sudo ceph -s   
106
   health HEALTH_OK
107
   monmap e3: 1 mons at {1=192.168.251.100:6790/0}, election epoch 1, quorum 0 1
108
   osdmap e179: 2 osds: 2 up, 2 in
109
   pgmap v724: 96 pgs: 96 active+clean; 9199 bytes data, 2071 MB used, 17906 MB / 19978 MB avail; 232B/s wr, 0op/s
110
   mdsmap e54: 1/1/1 up {0=0=up:active}
111
vagrant@ceph:~$ sudo ceph osd tree
112
# id  weight  type name up/down reweight
113
-1  2 root default
114
-4  2   datacenter dc
115
-5  2     room laroom
116
-6  2       row larow
117
-3  2         rack lerack
118
-2  2           host ceph
119
0 1             osd.0 up  1
120
1 1             osd.1 up  1
121
</pre>
122
 
123
h3. III. BONUS UPGRADE TO CUTTLEFISH
124
125
It’s fairly easy to upgrade the box to last stable version Cuttlefish. For this simply edit <pre>/etc/apt/sources.list.d/ceph.list/ceph.list</pre> with the following:
126
<pre>deb http://ceph.com/debian-cuttlefish/ precise main</pre>
127
128
Then run:
129
130
<pre>
131
$ sudo apt-get update && apt-get install ceph
132
$ sudo service ceph restart
133
$ sudo ceph -v
134
ceph version 0.61 (237f3f1e8d8c3b85666529860285dcdffdeda4c5)
135
</pre>
136
 
137
*Note*: if for some reasons you get a status were only 1/2 OSDs are up, just restart the mon. This should do the trick :-).