ceph使用教程与测试

1. Fresh install your two linux . One for server , One for client.

安装完系统后, 请升级内核。 下面只提到了, rhel5,6, centos5,6的内核升级步骤, 。  其他os请访问ceph网站获取详细信息。   为什么升级内核呢, 主要是需要rbd kernel object。 在新的内核里,已经加入了该模块, 那么我们不需要自己手动编译了。ceph的具体安装的方法请见另一篇文章.http://blog.whoistester.com/ceph%e4%bd%93%e9%aa%8c/

如下步骤升级内核():
Import the public key:

#rpm –import http://elrepo.org/RPM-GPG-KEY-elrepo.org

To install ELRepo for RHEL-5, SL-5 or CentOS-5:
#rpm -Uvh http://elrepo.org/elrepo-release-5-4.el5.elrepo.noarch.rpm

To make use of our mirror system, please also install yum-fastestmirror.
To install ELRepo for RHEL-6, SL-6 or CentOS-6:

#rpm -Uvh http://elrepo.org/elrepo-release-6-5.el6.elrepo.noarch.rpm

To make use of our mirror system, please also install yum-plugin-fastestmirror.
Yum search kernel-lt and install
#yum –enablerepo=elrepo-kernel search kernel-lt

Notice: You ‘d better to update your kernel

Ceph supports both kernel objects (KO) and a QEMU hypervisor that uses librbd directly–avoiding the kernel object overhead for virtualized systems.

安装ceph, 不建议使用tarball 自行安装, 非常耗时. 笔者曾经尝试过,花了2个小时, tar 包安装,最后也没有成功. 因为依赖了太多的3方库.

2。安装好系统和ceph软件后, 至少你需要一个ceph server和ceph clients.

那么,我们就来练习一下. 创建rbd 块设备.
rbd create foo –size 4096 (default unit is MB)
modprobe rbd
rbd map foo –name client.admin (if disable authentication, please remove –name parameter)
mkfs.ext4 -m0 /dev/rbd0 (here –m0 with no reserved blocks, because ceph is object store)
mkdir /mnt/myrbd
mount /dev/rbd0 /mnt/myrbd
umount /dev/rbd0
Rbd unmap /dev/rbd0

使用ceph fs 文件系统  .mount Ceph FS as a kernel driver.  使用驱动的方式挂载文件分区.
#sudo mkdir /mnt/mycephfs
#sudo mount -t ceph {ip-address-of-monitor}:6789:/ /mnt/mycephfs

Note:
Mount the CephFS filesystem on the client machine, not the cluster machine. See FAQfor details.

FILESYSTEM IN USER SPACE (FUSE) 使用fuse文件系统, 这样非root用户也可以挂在文件系统分区.
#Mount Ceph FS as with FUSE. Replace {username} with your username.
#sudo mkdir /home/{username}/cephfs sudo ceph-fuse -m {ip-address-of-monitor}:6789 /home/{username}/ce

此篇文章已被阅读3198 次

Add a Comment

邮箱地址不会被公开。 必填项已用*标注