1、关闭selinux 和firewalld 设置hostname
2、为虚拟机添加2块硬盘
我这里使用的viturlbox ,关闭虚拟机,虚拟机设置,存储,添加硬盘
开启虚拟机 fdisk -l 查看设备
找到刚才加的硬盘 ,我这儿是/dev/sdb, /dev/sdc
3、安装ceph-deploy

#添加阿里源
#cat /etc/yum.repos.d/ceph.repo
[Ceph-SRPMS]
name=Ceph SRPMS packages
baseurl=https://mirrors.aliyun.com/ceph/rpm-jewel/el7/SRPMS/
enabled=1
gpgcheck=0
type=rpm-md
[Ceph-aarch64]
name=Ceph aarch64 packages
baseurl=https://mirrors.aliyun.com/ceph/rpm-jewel/el7/aarch64/
enabled=1
gpgcheck=0
type=rpm-md
[Ceph-noarch]
name=Ceph noarch packages
baseurl=https://mirrors.aliyun.com/ceph/rpm-jewel/el7/noarch/
enabled=1
gpgcheck=0
type=rpm-md
[Ceph-x86_64]
name=Ceph x86_64 packages
baseurl=https://mirrors.aliyun.com/ceph/rpm-jewel/el7/x86_64/
enabled=1
gpgcheck=0
type=rpm-md


#yum install epel-release
#rm -rf /root/ceph-cluster && mkdir -p /root/ceph-cluster && cd /root/ceph-cluster
# yum install ceph ceph-radosgw ceph-deploy -y
#ceph-deploy new $HOSTNAME
#### ceph集群的话 ceph-deploy new $host1 $host2 ...###
// 更新默认配置文件
#cat ceph.conf
[global]
fsid = cb214e08-1bca-4dbb-b5cd-4e839419a16a
mon_initial_members = node03
mon_host = 172.16.16.28
auth_cluster_required = cephx
auth_service_required = cephx
auth_client_required = cephx

osd pool default size = 1
osd crush chooseleaf type = 0
osd max object name len = 256
osd journal size = 128
mon_pg_warn_max_per_osd = 1000
 // 初始化监控节点
# ceph-deploy mon create-initial
# ceph-deploy  --overwrite-conf osd prepare ${HOSTNAME}:/dev/sdb ${HOSTNAME}:/dev/sdc --zap-disk
#ceph-deploy osd activate ${HOSTNAME}:/dev/sdb ${HOSTNAME}:/dev/sdc 
///这时候ceph -s  查看状态是 HEALTH_WARN
#ceph osd pool set rbd pg_num 128
#ceph osd pool create cephfs_data 128
#ceph osd pool set rbd pgp_num 128
# ceph -s
### 如果出现错误too many PGs per OSD (320> max 300) 
### 在/etc/ceph/ceph.conf 配置中添加mon_pg_warn_max_per_osd = 1000
### 最后重启  systemctl restart  ceph-mon@`hostname`
ceph monitor仲裁状态:ceph quorum_status  --format json-pretty 
ceph mon stat 
ceph osd stat 
ceph osd tree(显示crush图) 
ceph pg stat 
ceph auth list(集群的认证密码)

参考:https://my.oschina.net/u/2307042/blog/1931761

Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐