Centos7部署ceph-14.2.22(nautilus)版集群(带dashboard)

一、安装前准备
1、系统准备

#关闭防火墙
systemctl stop firewalld
systemctl disable firewalld

#关闭selinux
sed -i 's/enforcing/disabled/' /etc/selinux/config  # 永久
setenforce 0  # 临时

#根据规划设置主机名
hostnamectl set-hostname 

#在master添加hosts
cat >> /etc/hosts << EOF
192.168.112.130 ceph1
192.168.112.131 ceph2
192.168.112.132 ceph3
EOF

2、安装chrony服务

yum -y install chrony

设置hdp01.bbdops.com为主服务器,开启nptd服务(主服务器)
#主服务器上该配置文件修改项如下:
vim /etc/chrony.conf
server ntp6.aliyun.com iburst
allow 192.168.112.0/24 
local stratum 10

#从服务器配置
vim /etc/chrony.conf
server 192.168.112.130 iburs
修改保存后执行:
systemctl restart chronyd.service #启动服务
systemctl enable chronyd.service #开机自启动

查看时间同步状态:
chronyc -a makestep
chronyc sourcestats
chronyc sources -v

3、每个节点添加阿里云镜像cepo.repo文件

vi /etc/yum.repos.d/ceph.repo
[ceph]
name=ceph
baseurl=http://mirrors.aliyun.com/ceph/rpm-nautilus/el7/x86_64/
gpgcheck=0
priority=1

[ceph-noarch]
name=cephnoarch
baseurl=http://mirrors.aliyun.com/ceph/rpm-nautilus/el7/noarch/
gpgcheck=0
priority=1

[ceph-source]
name=Ceph source packages
baseurl=http://mirrors.aliyun.com/ceph/rpm-nautilus/el7/SRPMS
gpgcheck=0
priority=1

4、安装epel源

curl -o /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo

二、ceph相关的包安装(手动部署)

节点规划:
192.168.112.130   ceph-mon、ceph-mgr、ceph-osd           /dev/sdb   osd盘  /dev/sdc  日志盘
192.168.112.131   ceph-mon、ceph-mgr、ceph-osd           /dev/sdb   osd盘  /dev/sdc  日志盘                
192.168.112.132   ceph-osd                               /dev/sdb   osd盘  /dev/sdc   日志盘

1、在部署节点(192.168.112.130)安装ceph的部署工具

yum install -y python-setuptools -y
yum install -y ceph-deploy
确保ceph-deploy的版本是2.0.1,不要安装1.x的版本
ceph-deploy --version

2、部署monitor,在部署(192.168.112.130)创建一个工作目录,后续的命令都在该目录下执行,产生的配置文件保存在该目录中

mkdir ~/my-cluster
cd ~/my-cluster

#安装节点执行
ceph-deploy new --public-network 192.168.112.0/24 --cluster-network 192.168.13.0/24 ceph1   #有单独规划存储网络
ceph-deploy new --public-network 192.168.112.0/24 ceph1    #无单独存储网络
#三台分别执行
yum install -y ceph ceph-radosgw
或者
ceph-deploy install ceph1 ceph2 ceph3

初始化monitor
ceph-deploy mon create-initial
将配置文件拷贝到对应的节点
ceph-deploy admin ceph2 ceph3
如果想部署高可用的monitor ,可以将ceph2、ceph3也加入mon集群
ceph-deploy mon add ceph2
ceph-deploy mon add ceph3

ceph-mon
如果在某些地方碰到麻烦,想从头再来,可以用下列命令清除配置:

ceph-deploy purgedata {ceph-node} [{ceph-node}]
ceph-deploy forgetkeys

用下列命令可以连Ceph 安装包一起清除:

ceph-deploy purge {ceph-node} [{ceph-node}]

注意:如果执行了purge ,你必须重新安装Ceph 。
3、部署mgr服务,在部署节点(192.168.112.130)执行

cd my-cluster
ceph-deploy mgr create ceph1
如果想部署高可用mgr,可以将ceph2、ceph3也添加进来
ceph-deploy mgr create ceph2 ceph3

ceph-mgr
4、部署osd

osd规划,选用filestore作为存储引擎,每个节点上选用/dev/sdb作为数据盘,每个节点上选用/dev/sdc作为日志盘,先确定每个节点的硬盘情况,然后在部署节点(client)执行:

确认每个节点的硬盘情况:
ceph-deploy disk list ceph1 ceph2 ceph3 

清理ceph1、ceph2、ceph3节点上硬盘上现有数据和文件系统
ceph-deploy disk zap ceph1 /dev/sdb
ceph-deploy disk zap ceph2 /dev/sdb
ceph-deploy disk zap ceph3 /dev/sdb
ceph-deploy disk zap ceph1 /dev/sdc
ceph-deploy disk zap ceph2 /dev/sdc
ceph-deploy disk zap ceph3 /dev/sdc

添加osd
ceph-deploy osd create --data /dev/sdb --journal /dev/sdc --filestore ceph1
ceph-deploy osd create --data /dev/sdb --journal /dev/sdc --filestore ceph2
ceph-deploy osd create --data /dev/sdb --journal /dev/sdc --filestore ceph3

ceph-osd
5、ceph基本命令

#检查集群状态命令
ceph -s
ceph osd status
#列出所有ceph服务
systemctl status ceph\*.service ceph\*.target
#启动所有服务的守护进程
systemctl start ceph.target
#停止所有服务的守护进程
systemctl stop ceph.target
#按照服务类型启动服务守护进程
systemctl start ceph-osd.target
systemctl start ceph-mon.target
systemctl start ceph-mds.target

ceph

#查看osd运行状态
ceph osd stat
#查看osd映射信息
ceph osd dump
#查看数据延迟
ceph osd perf
#详细列出集群每块磁盘的使用情况
ceph osd df
#查看osd目录树
ceph osd tree
#查看最大osd的个数
ceph osd getmaxosd
在ceph.conf上配置删除pool的参数
vim /etc/ceph/ceph.conf
添加
mon_allow_pool_delete = true
mon_max_pg_per_osd = 2000
同步至其他节点
ceph-deploy  --overwrite-conf admin ceph1 ceph2 ceph3
重启监控服务
systemctl restart ceph-mon.target
systemctl status ceph-mon.target
删除时,pool名输入两次,后再接--yes-i-really-really-mean-it参数就可以删除
ceph osd pool delete test_pool test_pool --yes-i-really-really-mean-it
或者
rados rmpool test_pool test_pool --yes-i-really-really-mean-it

三、安装部署ceph Dashboard
1、在每个mgr节点安装

yum install -y ceph-mgr-dashboard
ceph mgr versions
ps -ef|grep ceph-mgr
ceph -s

2、查看mgr module帮助及模块信息

ceph mgr module --help
ceph mgr module ls |head -20

3、开启mgr功能、开启Dashboard模块

ceph mgr module enable dashboard
ceph mgr module ls |head -20

4、创建自签证书

默认情况下,仪表板的所有http连接使用SSL/TLS进行保护,要快速启动并运行仪表盘,可以使用以下内置命令生成并安装自签名证书
ceph dashboard create-self-signed-cert

5、设置用户和密码

echo admin123 > /root/ceph-password.txt
#创建用户admin,密码指定/root/ceph-password.txt文件,用administrator角色
ceph dashboard ac-user-create admin -i /root/ceph-password.txt administrator
#显示用户信息
ceph dashboard ac-user-show
#显示角色信息
ceph dashboard ac-role-show
#删除用户
ceph dashboard ac-user-delete admin

6、在ceph active mgr节点上配置mgr services

主要配置dashboard使用的IP及PORT
#查看到ceph active mgr节点是ceph1
ceph -s |grep mgr
#查看默认的ceph active mgr服务
ceph mgr services
此时可以直接使用默认的service访问ceph dashboard的web页面
输入账号:admin 密码:admin123登录,如果使用的是内网的hosts,需要做hosts映射解析。

ceph截图
7、自定义监听IP及端口

#修改监听IP
ceph config set mgr mgr/dashboard/server_addr 192.168.112.131
#修改监听的端口号
ceph config set mgr mgr/dashboard/server_port 8080
重启生效
ceph mgr module disable  dashboard
ceph mgr module enable  dashboard

8、ceph禁用ssl

直接用http,如果想用https的话,不需要操纵这一步
ceph config ls|grep mgr/dashboard/ssl
ceph config set mgr mgr/dashboard/ssl false
重启服务
ceph mgr module disable dashboard
ceph mgr module enable dashboard
systemctl restart ceph-mgr.target

四、问题解决
1、问题:遇到集群状态不健康

health: HEALTH_WARN
            mon is allowing insecure global_id reclaim
解决:禁用不安全模式
ceph config set mon auth_allow_insecure_global_id_reclaim false
© 版权声明
THE END
喜欢就支持一下吧
点赞0 分享
评论 抢沙发
头像
欢迎您留下宝贵的见解!
提交
头像

昵称

取消
昵称表情代码图片

    暂无评论内容