; Sample ceph ceph.conf file.
; that Ceph stores data, and any other runtime options.
; verify that it matches the hostname (or else ignore it). If it is
; node).
; setting up the 'osd data' dir. if it is not btrfs, things
; usually fine for basic testing).
; hosts. clients are fully trusted.
[root@f181 ceph]# mkcephfs -c /usr/local/etc/ceph/ceph.conf --allhosts --mkbtrfs
/usr/local/bin/monmaptool --create --clobber --add 10.0.0.181:6789 --print /tmp/monmap.2319
/usr/local/bin/monmaptool: monmap file /tmp/monmap.2319
/usr/local/bin/monmaptool: generated fsid ef8475d4-52ea-d6f6-f75b-b331c34b9a43
epoch 1
fsid ef8475d4-52ea-d6f6-f75b-b331c34b9a43
last_changed 10.04.24 20:10:01.089929
created 10.04.24 20:10:01.089929
mon0 10.0.0.181:6789/0
/usr/local/bin/monmaptool: writing epoch 1 to /tmp/monmap.2319 (1 monitors)
max osd in /usr/local/etc/ceph/ceph.conf is 3, num osd is 4
/usr/local/bin/osdmaptool: osdmap file '/tmp/osdmap.2319'
/usr/local/bin/osdmaptool: writing epoch 1 to /tmp/osdmap.2319
Building admin keyring at /tmp/admin.keyring.2319
creating /tmp/admin.keyring.2319
Building monitor keyring with all service keys
creating /tmp/monkeyring.2319
importing contents of /tmp/admin.keyring.2319 into /tmp/monkeyring.2319
creating /tmp/keyring.mds.node181
importing contents of /tmp/keyring.mds.node181 into /tmp/monkeyring.2319
creating /tmp/keyring.osd.0
importing contents of /tmp/keyring.osd.0 into /tmp/monkeyring.2319
creating /tmp/keyring.osd.1
importing contents of /tmp/keyring.osd.1 into /tmp/monkeyring.2319
creating /tmp/keyring.osd.2
importing contents of /tmp/keyring.osd.2 into /tmp/monkeyring.2319
creating /tmp/keyring.osd.3
importing contents of /tmp/keyring.osd.3 into /tmp/monkeyring.2319
=== mon0 ===
10.04.24 20:10:02.245494 store(/mnt/btrfs/mon0) mkfs
10.04.24 20:10:02.245722 store(/mnt/btrfs/mon0) test -d /mnt/btrfs/mon0 && /bin/rm -rf /mnt/btrfs/mon0 ; mkdir -p /mnt/btrfs/mon0
10.04.24 20:10:02.581627 mon0(starting).class v0 create_initial -- creating initial map
10.04.24 20:10:02.692877 mon0(starting).auth v0 create_initial -- creating initial map
10.04.24 20:10:02.692940 mon0(starting).auth v0 reading initial keyring
/usr/local/bin/mkmonfs: created monfs at /mnt/btrfs/mon0 for mon0
admin.keyring.2319 100% 119 0.1KB/s 00:00
=== mds.node181 ===
WARNING: no keyring specified for mds.node181
=== osd0 ===
umount: /mnt/btrfs/osd0: not mounted
umount: /dev/cciss/c0d2p1: not mounted
FATAL: Module btrfs not found.
WARNING! - Btrfs Btrfs v0.19 IS EXPERIMENTAL
WARNING! - see http://btrfs.wiki.kernel.org before using
fs created label (null) on /dev/cciss/c0d2p1
nodesize 4096 leafsize 4096 sectorsize 4096 size 33.91GB
Btrfs Btrfs v0.19
FATAL: Module btrfs not found.
Scanning for Btrfs filesystems
failed to read /dev/loop7
failed to read /dev/loop6
failed to read /dev/loop5
failed to read /dev/loop4
failed to read /dev/loop3
failed to read /dev/loop2
failed to read /dev/loop1
failed to read /dev/loop0
monmap.2319 100% 187 0.2KB/s 00:00
** WARNING: Ceph is still under heavy development, and is only suitable for **
** testing and review. Do not trust it with important data. **
created object store for osd0 fsid ef8475d4-52ea-d6f6-f75b-b331c34b9a43 on /mnt/btrfs/osd0
WARNING: no keyring specified for osd0
=== osd1 ===
umount: /mnt/btrfs/osd1: not mounted
umount: /dev/cciss/c0d3p1: not mounted
FATAL: Module btrfs not found.
WARNING! - Btrfs Btrfs v0.19 IS EXPERIMENTAL
WARNING! - see http://btrfs.wiki.kernel.org before using
fs created label (null) on /dev/cciss/c0d3p1
nodesize 4096 leafsize 4096 sectorsize 4096 size 33.91GB
Btrfs Btrfs v0.19
FATAL: Module btrfs not found.
Scanning for Btrfs filesystems
failed to read /dev/loop7
failed to read /dev/loop6
failed to read /dev/loop5
failed to read /dev/loop4
failed to read /dev/loop3
failed to read /dev/loop2
failed to read /dev/loop1
failed to read /dev/loop0
monmap.2319 100% 187 0.2KB/s 00:00
** WARNING: Ceph is still under heavy development, and is only suitable for **
** testing and review. Do not trust it with important data. **
created object store for osd1 fsid ef8475d4-52ea-d6f6-f75b-b331c34b9a43 on /mnt/btrfs/osd1
WARNING: no keyring specified for osd1
=== osd2 ===
umount: /mnt/btrfs/osd2: not mounted
umount: /dev/cciss/c0d2p1: not mounted
FATAL: Module btrfs not found.
WARNING! - Btrfs Btrfs v0.19 IS EXPERIMENTAL
WARNING! - see http://btrfs.wiki.kernel.org before using
fs created label (null) on /dev/cciss/c0d2p1
nodesize 4096 leafsize 4096 sectorsize 4096 size 33.91GB
Btrfs Btrfs v0.19
FATAL: Module btrfs not found.
Scanning for Btrfs filesystems
failed to read /dev/loop7
failed to read /dev/loop6
failed to read /dev/loop5
failed to read /dev/loop4
failed to read /dev/loop3
failed to read /dev/loop2
failed to read /dev/loop1
failed to read /dev/loop0
monmap.2319 100% 187 0.2KB/s 00:00
** WARNING: Ceph is still under heavy development, and is only suitable for **
** testing and review. Do not trust it with important data. **
created object store for osd2 fsid ef8475d4-52ea-d6f6-f75b-b331c34b9a43 on /mnt/btrfs/osd2
WARNING: no keyring specified for osd2
=== osd3 ===
umount: /mnt/btrfs/osd3: not mounted
umount: /dev/cciss/c0d3p1: not mounted
FATAL: Module btrfs not found.
WARNING! - Btrfs Btrfs v0.19 IS EXPERIMENTAL
WARNING! - see http://btrfs.wiki.kernel.org before using
fs created label (null) on /dev/cciss/c0d3p1
nodesize 4096 leafsize 4096 sectorsize 4096 size 33.91GB
Btrfs Btrfs v0.19
FATAL: Module btrfs not found.
Scanning for Btrfs filesystems
failed to read /dev/loop7
failed to read /dev/loop6
failed to read /dev/loop5
failed to read /dev/loop4
failed to read /dev/loop3
failed to read /dev/loop2
failed to read /dev/loop1
failed to read /dev/loop0
monmap.2319 100% 187 0.2KB/s 00:00
** WARNING: Ceph is still under heavy development, and is only suitable for **
** testing and review. Do not trust it with important data. **
created object store for osd3 fsid ef8475d4-52ea-d6f6-f75b-b331c34b9a43 on /mnt/btrfs/osd3
WARNING: no keyring specified for osd3
Step6. 啟動 Ceph Server
[root@f181 ceph]# cd /usr/src/ceph/src/
[root@f181 src]# ./init-ceph -a -c /usr/local/etc/ceph/ceph.conf start
=== mon0 ===
Starting Ceph mon0 on node181...
** WARNING: Ceph is still under heavy development, and is only suitable for **
** testing and review. Do not trust it with important data. **
starting mon0 at 10.0.0.181:6789/0 mon_data /mnt/btrfs/mon0 fsid ef8475d4-52ea-d6f6-f75b-b331c34b9a43
=== mds.node181 ===
Starting Ceph mds.node181 on node181...
** WARNING: Ceph is still under heavy development, and is only suitable for **
** testing and review. Do not trust it with important data. **
starting mds.node181 at 0.0.0.0:6800/3219
=== osd0 ===
Mounting Btrfs on node172:/mnt/btrfs/osd0
FATAL: Module btrfs not found.
Scanning for Btrfs filesystems
failed to read /dev/loop7
failed to read /dev/loop6
failed to read /dev/loop5
failed to read /dev/loop4
failed to read /dev/loop3
failed to read /dev/loop2
failed to read /dev/loop1
failed to read /dev/loop0
Starting Ceph osd0 on node172...
** WARNING: Ceph is still under heavy development, and is only suitable for **
** testing and review. Do not trust it with important data. **
starting osd0 at 0.0.0.0:6800/3484 osd_data /mnt/btrfs/osd0 (no journal)
=== osd1 ===
Mounting Btrfs on node172:/mnt/btrfs/osd1
FATAL: Module btrfs not found.
Scanning for Btrfs filesystems
failed to read /dev/loop7
failed to read /dev/loop6
failed to read /dev/loop5
failed to read /dev/loop4
failed to read /dev/loop3
failed to read /dev/loop2
failed to read /dev/loop1
failed to read /dev/loop0
Starting Ceph osd1 on node172...
** WARNING: Ceph is still under heavy development, and is only suitable for **
** testing and review. Do not trust it with important data. **
starting osd1 at 0.0.0.0:6802/3717 osd_data /mnt/btrfs/osd1 (no journal)
=== osd2 ===
Mounting Btrfs on node173:/mnt/btrfs/osd2
FATAL: Module btrfs not found.
Scanning for Btrfs filesystems
failed to read /dev/loop7
failed to read /dev/loop6
failed to read /dev/loop5
failed to read /dev/loop4
failed to read /dev/loop3
failed to read /dev/loop2
failed to read /dev/loop1
failed to read /dev/loop0
Starting Ceph osd2 on node173...
** WARNING: Ceph is still under heavy development, and is only suitable for **
** testing and review. Do not trust it with important data. **
starting osd2 at 0.0.0.0:6800/3310 osd_data /mnt/btrfs/osd2 (no journal)
=== osd3 ===
Mounting Btrfs on node173:/mnt/btrfs/osd3
FATAL: Module btrfs not found.
Scanning for Btrfs filesystems
failed to read /dev/loop7
failed to read /dev/loop6
failed to read /dev/loop5
failed to read /dev/loop4
failed to read /dev/loop3
failed to read /dev/loop2
failed to read /dev/loop1
failed to read /dev/loop0
Starting Ceph osd3 on node173...
** WARNING: Ceph is still under heavy development, and is only suitable for **
** testing and review. Do not trust it with important data. **
starting osd3 at 0.0.0.0:6802/3548 osd_data /mnt/btrfs/osd3 (no journal)
Step7. 掛載!
[root@f181 src]# mount -t ceph 10.0.0.181:/ /mnt/ceph/
[root@f181 src]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_f181-lv_root
32G 6.2G 24G 21% /
tmpfs 503M 0 503M 0% /dev/shm
/dev/cciss/c0d0p1 194M 33M 152M 18% /boot
10.0.0.181:/ 136G 7.0M 128G 1% /mnt/ceph
Step8. 測試
[root@f181 src]# dd if=/dev/zero of=/mnt/ceph/bigfile bs=4k count=10000k
10240000+0 records in
10240000+0 records out
41943040000 bytes (42 GB) copied, 1093.68 s, 38.4 MB/s
資料會寫入各硬碟中。
Final. 結果觀察
1. 空間的寫入,會隨時增減 (猜測應該是在做 balance 的動作)
2. df 空間無法反應實際檔案大小,各 osd 也沒法反應實際空間使用狀況。
ref. http://ceph.newdream.net/wiki/Main_Page