Contents [hide] |
---|
|
参考
- MOUNT.CEPH – MOUNT A CEPH FILE SYSTEM
- MMOUNT CEPH FS WITH THE KERNEL DRIVER
- MOUNT CEPH FS AS A FUSE
- MOUNT CEPH FS IN YOUR FILE SYSTEMS TABLE
ceph端口访问控制
成都ceph环境做为数据备份空间,因未启用授权机制,为确保数据安全,现已添加端口访问控制。
若需增加访问点请在172.17.35.241:/usr/local/bin/default.iptables中进行设置:
1
2
3
4
5
6
7
8
9
|
# 若增加ceph节点,请将节点ip添加到LAN_IPs中
LAN_IPs=172.17.35.240,172.17.35.241,172.17.35.242,172.17.35.243
# 若增加访问客户端,请将客户端IP添加到CEPH_IPs中
CEPH_IPs=
"$NMC_IPs,172.17.46.0/24"
CEPH_IPs=
"$CEPH_IPs,192.168.0.131,192.168.0.133,192.168.0.233,192.168.0.23,192.168.0.247"
# 修改完成default.iptables后,执行下面的命令加载策略:
setiptables.sh load default.iptables
|
用Kernel方式挂载
该方式需要更换系统内核、并重启系统以支持ceph文件系统挂载。
经试用以方式挂载后,存在某些目录丢失,重新mount后丢失目录又出现的现象,而使用fuse方式挂载未发生这一现象。
安装ELRepo及kernel-lt
1
2
3
4
5
6
7
8
9
10
11
12
|
# 首先你要做的就是导入public key
#rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
rpm --
import
http:
//www
.elrepo.org
/RPM-GPG-KEY-elrepo
.org
# 然后安装ELRepo到CentOS-6.5中
rpm -ivh http:
//www
.elrepo.org
/elrepo-release-6-5
.el6.elrepo.noarch.rpm
# 安装kernel-lt(lt=long-term)
yum --enablerepo=elrepo-kernel
install
kernel-lt -y
# 你也可以装kernel-ml(ml=mainline)kernel-lt、kernel-mt二者选一个就可以了!
#yum --enablerepo=elrepo-kernel install kernel-ml -y
|
修改Grub引导顺序并重启动
vim/etc/grub.conf
设置default值(从0开始),一般新安装的内核在第一个位置,所以设置default=0。
目前内核为:title CentOS (3.10.59-1.el6.elrepo.x86_64)
重启,这时候你的内核就成功升级了,你可以删除你的旧内核了!
- 重启后内核为:
uname -a Linux yunwei2.timait 3.10.59-1.el6.elrepo.x86_64 #1 SMP Thu Oct 30 23:46:31 EDT 2014 x86_64 x86_64 x86_64 GNU/Linux
- 重启失败参考(经在192.168.0.82上测试此方法无效)
CentOS 6 will not boot on KVM with elrepo kernel 3.13 / 3.14
You can work around it by booting into your working stock kernel and running these two commands:
1
2
|
yum
install
-y device-mapper-libs libudev
for
X
in
$(
cd
/boot
;
ls
-1 config-*elrepo* |
sed
's/config-//'
) ;
do
dracut --add-drivers virtio_blk -f
/boot/initramfs-
$X.img $X ;
done
|
添加ceph源
公司内部源、第三方源选择添加一个即可。
- 公司内部源
内部源ceph版本为:0.67.5-16.g69a99e6.el6
1
2
3
4
5
6
|
cat
>
/etc/yum
.repos.d
/nailgun
.repo < [nailgun]
name=Nailgun
baseurl=http:
//172
.17.45.15:8080
/centos/fuelweb/x86_64/
gpgcheck=0
EOF
|
- 第三方源
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
# ceph_release
# v0.67.9 dumpling
# v0.87 giant
ceph_release=giant
# distro:CentOS 6.4是el6
distro=el6
# 版本参考:http://ceph.com/docs/master/release-notes/
cat
>
/etc/yum
.repos.d
/ceph
.repo < [ceph]
name=Ceph packages
for
\$basearch
baseurl=http:
//ceph
.com
/rpm-
${ceph_release}/${distro}/\$basearch
enabled=1
gpgcheck=1
type
=rpm-md
gpgkey=https:
//ceph
.com
/git/
?p=ceph.git;a=blob_plain;f=keys
/release
.asc
[ceph-noarch]
name=Ceph noarch packages
baseurl=http:
//ceph
.com
/rpm-
${ceph_release}/${distro}
/noarch
enabled=1
gpgcheck=1
type
=rpm-md
gpgkey=https:
//ceph
.com
/git/
?p=ceph.git;a=blob_plain;f=keys
/release
.asc
[ceph-
source
]
name=Ceph
source
packages
baseurl=http:
//ceph
.com
/rpm-
${ceph_release}/${distro}
/SRPMS
enabled=0
gpgcheck=1
type
=rpm-md
gpgkey=https:
//ceph
.com
/git/
?p=ceph.git;a=blob_plain;f=keys
/release
.asc
EOF
cat
>
/etc/yum
.repos.d
/ceph-extras
.repo < [ceph-extras]
name=Ceph Extras Packages
baseurl=http:
//ceph
.com
/packages/ceph-extras/rpm/centos6/
\$basearch
enabled=1
priority=2
gpgcheck=1
type
=rpm-md
gpgkey=https:
//ceph
.com
/git/
?p=ceph.git;a=blob_plain;f=keys
/release
.asc
[ceph-extras-noarch]
name=Ceph Extras noarch
baseurl=http:
//ceph
.com
/packages/ceph-extras/rpm/centos6/noarch
enabled=1
priority=2
gpgcheck=1
type
=rpm-md
gpgkey=https:
//ceph
.com
/git/
?p=ceph.git;a=blob_plain;f=keys
/release
.asc
[ceph-extras-
source
]
name=Ceph Extras Sources
baseurl=http:
//ceph
.com
/packages/ceph-extras/rpm/centos6/SRPMS
enabled=1
priority=2
gpgcheck=1
type
=rpm-md
gpgkey=https:
//ceph
.com
/git/
?p=ceph.git;a=blob_plain;f=keys
/release
.asc
EOF
# 加载一个第三方依赖的repo、下载ceph
rpm -Uvh http:
//dl
.fedoraproject.org
/pub/epel/6/x86_64/epel-release-6-8
.noarch.rpm
#rpm -Uvh http://ceph.com/rpm-dumpling/el6/noarch/ceph-release-1-0.el6.noarch.rpm
|
安装ceph客户端
1
|
yum -y
install
ceph
|
[root@FTP-Maven ~]# rpm -qa|grep ceph libcephfs1-0.67.5-16.g69a99e6.el6.x86_64 python-ceph-0.67.5-16.g69a99e6.el6.x86_64 ceph-0.67.5-16.g69a99e6.el6.x86_64
挂载ceph卷
- 命令行挂载
1
2
|
mkdir
-p
/cephdata
mount
-t ceph 172.17.35.241:6789:/
/cephdata
|
- 添加/etc/fstab自动挂载
1
2
|
#172.17.35.241:6789:/ /cephdata
172.17.35.241:6789:/
/cephdata
ceph defaults 0 0
|
- 注意:开启SELinux可能引起挂载ceph卷后进入子目录报没有权限错误。
fuse方式挂载ceph卷
因ceph-fuse使用64位的inode,在32位系统中会出现问题,因此仅限在64位系统中使用。
安装epel源
1
2
3
|
yum -y
install
epel-release
# epel-release-6-8.noarch
|
若安装后yum工作异常,修改/etc/yum.repos.d/epel.repo,取消mirrorlist、启用baseurl即可。
安装ceph-fuse
1
2
3
4
5
6
7
|
yum -y
install
ceph-fuse
# ceph-0.80.5-9.el6.x86_64
# ceph-common-0.80.5-9.el6.x86_64
# libcephfs1-0.80.5-9.el6.x86_64
# python-ceph-0.80.5-9.el6.x86_64
# ceph-fuse-0.80.5-9.el6.x86_64
|
测试挂载ceph卷
1
2
3
4
|
mkdir
/mnt/cephdata_backups
ceph-fuse -m 172.17.35.241:6789 -r
/backups
/mnt/cephdata_backups
umount
/mnt/cephdata_backups
|
通过fstab自动挂载
- ceph-fuse挂载脚本bug修复:/sbin/mount.fuse.ceph
1
2
3
|
# convert device string to options
#cephargs='--'`echo $1 | sed 's/,/ --/g'`
cephargs=
'-'
`
echo
$1 |
sed
-e
's/,/ -/g'
-e
's/=/ /g'
`
|
- 建立挂载点目录
1
|
mkdir
-p
/mnt/cephdata_backups
|
- 设置/etc/fstab
1
2
|
# 设置挂载ceph中的backups目录
m=172.17.35.241:6789,r=
/backups
/mnt/cephdata_backups
fuse.ceph defaults 0 0
|
- 测试挂载、卸载
1
2
3
|
mount
/mnt/cephdata_backups
umount
/mnt/cephdata_backups
|
- 基于ceph集群未正常的情况下,openstack集群开机自mount时该机器会无法启动,当前先去掉该自动mount,改为手动方式