1 准备环境
一台虚拟机centos7 ip:192.168.1.144
[root@ceph-mon1 ~]# cat /etc/hosts 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 192.168.1.131 ceph-mon1 192.168.1.141 ceph-osd1 192.168.1.142 ceph-osd2 192.168.1.143 ceph-osd3 192.168.1.144 ceph-oracle
1.1 配置yum源
yum clean all rm -rf /etc/yum.repos.d/*.repo wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo sed -i '/aliyuncs/d' /etc/yum.repos.d/CentOS-Base.repo sed -i 's/$releasever/7.2.1511/g' /etc/yum.repos.d/CentOS-Base.repo
1.2 增加ceph的yum源
vi /etc/yum.repos.d/ceph.repo [ceph] name=ceph baseurl=http://mirrors.aliyun.com/ceph/rpm-jewel/el7/x86_64/ gpgcheck=0 [ceph-noarch] name=cephnoarch baseurl=http://mirrors.aliyun.com/ceph/rpm-jewel/el7/noarch/ gpgcheck=0
1.3 关闭seliinux和防火墙
sed -i 's/SELINUX=.*/SELINUX=disabled/' /etc/selinux/config setenforce 0 systemctl stop firewalld systemctl disable firewalld
2 安装ceph客户端
yum makecache yum install ceph ceph-radosgw rdate -y
2.1 把配置文件和密钥拷贝到client节点
2.1.1 可以手动scp过去
[root@ceph-mon1 ~]# cd /ceph-cluster/ [root@ceph-mon1 ceph-cluster]# ll total 220 -rw------- 1 root root 113 Oct 26 04:21 ceph.bootstrap-mds.keyring -rw------- 1 root root 113 Oct 26 04:21 ceph.bootstrap-osd.keyring -rw------- 1 root root 113 Oct 26 04:21 ceph.bootstrap-rgw.keyring -rw------- 1 root root 129 Oct 26 04:21 ceph.client.admin.keyring -rw-r--r-- 1 root root 258 Oct 26 04:20 ceph.conf -rw-r--r-- 1 root root 200577 Oct 27 07:21 ceph-deploy-ceph.log -rw------- 1 root root 73 Oct 26 04:16 ceph.mon.keyring
看到有很多密钥,mds,osd,rgw,client密钥,需要拷贝的就是ceph.client.admin.keyring和 ceph.conf
[root@ceph-mon1 ~]# Scp ceph.client.admin.keyring ceph-oracle:/etc/ceph/ [root@ceph-mon1 ~]# Scp ceph.conf ceph-oracle:/etc/ceph/
2.1.2 也可以用ceph-deploy工具拷贝
[root@ceph-mon1 ceph-cluster]# ceph-deploy admin ceph-oracle [ceph_deploy.conf][DEBUG ] found configuration file at: /root/.cephdeploy.conf [ceph_deploy.cli][INFO ] Invoked (1.5.36): /usr/bin/ceph-deploy admin ceph-oracle `````` [ceph_deploy.admin][DEBUG ] Pushing admin keys and conf to ceph-oracle root@ceph-oracle's password: root@ceph-oracle's password: [ceph-oracle][DEBUG ] connected to host: ceph-oracle [ceph-oracle][DEBUG ] detect platform information from remote host [ceph-oracle][DEBUG ] detect machine type [ceph-oracle][DEBUG ] write cluster configuration to /etc/ceph/{cluster}.conf
ceph-deploy 工具会把密钥环复制到 /etc/ceph 目录,要确保此密钥环文件有读权限
(如 chmod +r /etc/ceph/ceph.client.admin.keyring)。
3 配置块设备
3.1 在 ceph-client 节点上创建一个块设备 image 。
--创建一个4G大小的Image
[root@ceph-oracle ceph]# rbd create foo --size 4G --image-format 2
format 1 - 新建 rbd 映像时使用最初的格式。此格式兼容所有版本的 librbd 和内核模块,但是不支持较新的功能,像克隆。
format 2 - 使用第二版 rbd 格式, librbd 和 3.11 版以上内核模块才支持(除非是分拆的模块)。此格式增加了克隆支持,使得扩展更容易,还允许以后增加新功能。
3.1.1 查看rbd池中的块设备
[root@ceph-oracle ceph]# rbd ls foo
3.2 在 ceph-client 节点上,把 image 映射为块设备。
[root@ceph-oracle ceph]# rbd map rbd/foo rbd: sysfs write failed RBD image feature set mismatch. You can disable features unsupported by the kernel with "rbd feature disable". In some cases useful info is found in syslog - try "dmesg | tail" or so. rbd: map failed: (6) No such device or address
报错了,原因是由于jewel版本的一些新特性要求操作系统内核是3.14
3.2.1 查看操作系统内核版本
[root@ceph-oracle ceph]# uname -r 3.10.0-327.el7.x86_64
可以通过禁用掉一些新特性来解决这个问题。需要重新创建image
3.2.2 删掉foo
[root@ceph-oracle ceph]# rbd remove foo Removing image: 100% complete...done.
3.2.3 重新创建image
只启用layering特性
[root@ceph-oracle ceph]# rbd create foo --size 5G --image-format 2 --image-feature layering
3.2.4 重新映射块设备
[root@ceph-oracle ceph]# rbd map rbd/foo /dev/rbd0
3.3 格式化
在 ceph-client 节点上,创建文件系统后就可以使用块设备了。
mkfs.ext4 -m0 /dev/rbd/rbd/foo
此命令可能耗时较长。
3.4 在 ceph-client 节点上挂载此文件系统。
[root@ceph-oracle ceph]# mkdir /u01 [root@ceph-oracle ceph]# mount /dev/rbd/rbd/foo /u01 [root@ceph-oracle ceph]# cd /u01 [root@ceph-oracle u01]#
3.4.1 查看空间大小
[root@ceph-oracle u01]# df -h Filesystem Size Used Avail Use% Mounted on /dev/mapper/centos-root 48G 4.4G 44G 10% / devtmpfs 906M 0 906M 0% /dev tmpfs 921M 92K 920M 1% /dev/shm tmpfs 921M 9.3M 911M 2% /run tmpfs 921M 0 921M 0% /sys/fs/cgroup /dev/sda1 497M 157M 341M 32% /boot tmpfs 185M 24K 184M 1% /run/user/1000 tmpfs 185M 0 185M 0% /run/user/0 /dev/rbd0 4.8G 20M 4.8G 1% /u01
发现空间小了,增大一下空间
[root@ceph-oracle u01]# rbd resize --size 20G foo Resizing image: 100% complete...done.
重新格式化,然后重新挂载到文件系统
[root@ceph-oracle /]# df -h Filesystem Size Used Avail Use% Mounted on /dev/mapper/centos-root 48G 4.4G 44G 10% / devtmpfs 906M 0 906M 0% /dev ```````` /dev/rbd0 20G 45M 20G 1% /u01
3.4.2 加入开机自动挂载
Vi /etc/fstab /dev/rbd/rbd/foo /u01 ext4 defaults 0 0
这里有点问题,由于ceph没有加入开机自启动,导致挂载文件夹出问题了,开不了机了。
需要重新映射块设备,然后挂载。
4 安装数据库
过程略······
验证结果,数据库创建时没有问题的。
[oracle@ceph-oracle ~]$ echo $ORACLE_HOME /u01/oracle/product/11.2.0.1 [oracle@ceph-oracle ~]$ which sqlplus /u01/oracle/product/11.2.0.1/bin/sqlplus [oracle@ceph-oracle ~]$ sqlplus /nolog SQL*Plus: Release 11.2.0.4.0 Production on Thu Oct 27 22:23:04 2016 Copyright (c) 1982, 2013, Oracle. All rights reserved. SQL>
简单的装一下,试试效果。性能方面以后测试~~~
版权声明:本文为博主原创文章,未经博主允许不得转载。
ceph oracle
- 上一篇:ceph的卸载
- 下一篇:CENTOS7 执行rootcrs.pl重新配置GI报错