ceph集群搭建与问题解决合集
1. 搭建集群
ceph、ceph、ceph、ceph、ceph、ceph、ceph、ceph、ceph、ceph、
2. 安装管理后台
-
开启dashboard模块
在主节点上执行:
ceph mgr module enable dashboard
-
生成签名
ceph dashboard create-self-signed-cert
-
创建目录
在主节点的ceph-cluster目录下执行:
cd /usr/local/ceph-cluster mkdir mgr-dashboard
-
生成密钥对(重要:https交互!)
cd /usr/local/ceph-cluster/mgr-dashboard
创建密钥对:
openssl req -new -nodes -x509 -subj "/O=IT/CN=ceph-mgr-dashboard" -days 3650 -keyout dashboard.key -out dashboard.crt -extensions v3_ca
[root@CENTOS7-1 mgr-dashboard]# ll
生成一对兄弟
-
启动dashboard
ceph mgr module disable dashboard ceph mgr module enable dashboard
-
设置IP与PORT
ceph config set mgr mgr/dashboard/server_addr xxx.xxx.xxx.xxx ceph config set mgr mgr/dashboard/server_port xxxx
-
查看服务信息
ceph mgr services
-
设置管理用户与密码
ceph dashboard set-login-credentials admin admin
3. 创建文件系统
创建Cephfs,实现由外部访问的文件系统。
-
创建两个存储池, 执行两条命令
ceph osd pool create cephfs_data 128 ceph osd pool create cephfs_metadata 64
少于5个OSD可把pg_num设置为128
OSD数量在5到10,可以设置pg_num为512
OSD数量在10到50,可以设置pg_num为4096
OSD数量大于50,需要计算pg_num的值
通过下面命令可以列出当前创建的存储池
ceph osd lspools
-
创建fs, 名称为fs_one:
ceph fs new fs_one cephfs_metadata cephfs_data
-
状态查看, 以下信息代表正常
[root@CENTOS7-1 mgr-dashboard]# ceph fs ls name: fs_test, metadata pool: cephfs_metadata, data pools: [cephfs_data ]
[root@CENTOS7-1 mgr-dashboard]# ceph mds stat fs_test-1/1/1 up {0=centos7-1=up:active}
附: 如果创建错误, 需要删除, 执行
ceph fs rm fs_one --yes-i-really-mean-it ceph osd pool delete cephfs_data cephfs_data --yes-i-really-really-mean-it
确保在ceph.conf中开启以下配置
[mon] mon allow pool delete = true
此时的管理界面
-
采用fuse挂载
1)安装ceph-fuse
yum -y install ceph-fuse
2)创建挂载目录
mkdir -p /usr/local/cephfs_dir
3)检查key
4)挂载cephfs
报错
[root@node3 ~]# ceph-fuse -k /etc/ceph/ceph.client.admin.keyring -m 10.10.20.11:6789 /usr/local/cephfs_directory
ceph-fuse[6687]: starting ceph client
2019-07-14 21:39:09.644181 7fa5be56e040 -1 init, newargv = 0x7fa5c940b500 newargc=9
ceph-fuse[6687]: starting fuse
再次执行 ceph-deploy mds create C7-A C7-B C7-C
好吧 没安装成功
sudo find / -name bootstrap-mds
重新挂载 ceph-fuse -k /etc/ceph/ceph.client.admin.keyring -m 10.10.20.11:6789 /usr/local/cephfs_dir
-
查看磁盘挂载信息
[root@CENTOS7-1 mgr-dashboard]# df -h Filesystem Size Used Avail Use% Mounted on /dev/mapper/centos-root 38G 3.0G 35G 8% / devtmpfs 1.9G 0 1.9G 0% /dev tmpfs 1.9G 0 1.9G 0% /dev/shm tmpfs 1.9G 20M 1.9G 2% /run tmpfs 1.9G 0 1.9G 0% /sys/fs/cgroup /dev/sda1 197M 167M 31M 85% /boot tmpfs 378M 0 378M 0% /run/user/0 tmpfs 1.9G 24K 1.9G 1% /var/lib/ceph/osd/ceph-0 ceph-fuse 27G 0 27G 0% /usr/local/cephfs_directory tmpfs 378M 0 378M 0% /run/user/1000
/usr/local/cephfs_directory目录已成功挂载。
问题解决合集
1:RuntimeError: bootstrap-rgw keyring not found; run ‘gatherkeys’
在副结点执行装配osd时 执行 ceph-deploy osd create --data /dev/sdb C7-B 报错
解决:ceph-deploy gatherkeys C7-B
后再次执行完成