cephadm快速部署指定版本ceph集群

2023-10-29

官方文档:https://docs.ceph.com/en/pacific/

1、虚拟机规划:

主机名 IP 角色
ceph1 192.168.150.120 cephadm,mon,mgr,osd
ceph2 192.168.150.121 mon,mgr,osd
ceph3 192.168.150.121 mon,mgr,rosd

2、ceph版本:

        ceph16.2.4

3、虚拟机操作系统:

        centos8

4、初始化工作(三台机器同时操作):

4、1 关闭防火墙:

$ systemctl stop firewalld && systemctl disable firewalld

4、2 关闭SELinux:

$ setenforce 0 && sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config

4、3 设置时间同步:

$ cat /etc/chrony.conf
# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
# pool 2.centos.pool.ntp.org iburst
server ntp.aliyun.com iburst
# Record the rate at which the system clock gains/losses time.
driftfile /var/lib/chrony/drift

# Allow the system clock to be stepped in the first three updates
# if its offset is larger than 1 second.
makestep 1.0 3

# Enable kernel synchronization of the real-time clock (RTC).
rtcsync

# Enable hardware timestamping on all interfaces that support it.
#hwtimestamp *

# Increase the minimum number of selectable sources required to adjust
# the system clock.
#minsources 2

# Allow NTP client access from local network.
#allow 192.168.0.0/16

# Serve time even if not synchronized to a time source.
#local stratum 10

# Specify file containing keys for NTP authentication.
keyfile /etc/chrony.keys

# Get TAI-UTC offset and leap seconds from the system tz database.
leapsectz right/UTC

# Specify directory for log files.
logdir /var/log/chrony

# Select which information is logged.
#log measurements statistics tracking

重启服务:

$ systemctl restart chronyd
$ systemctl enable chronyd

4、4 配置epel源:

CentOS Linux 8 已经停止更新维护,因此需要修改YUM源:

$ cd /etc/yum.repos.d/
sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*
sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*

生成缓存:

$ yum makecache
$ yum update -y

 配置epel源:

$ dnf install epel-release -y

4、5 设置主机名:

$ hostnamectl set-hostname hostname

4、6 修改域名解析文件:

$ cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.150.120 ceph1
192.168.150.121 ceph2
192.168.150.122 ceph3

4、7 配置ceph镜像源:

$ vi /etc/yum.repos.d/ceph.repo

# 添加如下内容:
[Ceph]
name=Ceph packages for $basearch
baseurl=https://download.ceph.com/rpm-16.2.4/el8/$basearch
enabled=1
gpgcheck=0
type=rpm-md
gpgkey=https://download.ceph.com/keys/release.asc
priority=1

[Ceph-noarch]
name=Ceph noarch packages
baseurl=https://download.ceph.com/rpm-16.2.4/el8/noarch
enabled=1
gpgcheck=0
type=rpm-md
gpgkey=https://download.ceph.com/keys/release.asc
priority=1

[ceph-source]
name=Ceph source packages
baseurl=https://download.ceph.com/rpm-16.2.4/el8/SRPMS
enabled=1
gpgcheck=0
type=rpm-md
gpgkey=https://download.ceph.com/keys/release.asc
priority=1

 生成缓存:

$ yum makecache

 安装ceph:

$ yum install ceph -y

 验证ceph是否安装成功:

$ ceph -v
ceph version 16.2.4 (3cbe25cde3cfa028984618ad32de9edc4c1eaed0) pacific (stable)

5、安装docker(三台机器同时操作):

官方文档:https://docs.docker.com/engine/install/centos/

5、1 安装需要的软件包

$ yum install -y yum-utils

5、2 设置stable镜像仓库:

$ yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

5、3 生成缓存:

$ yum makecache

 5、4   安装DOCKER CE:

$ yum install docker-ce docker-ce-cli containerd.io docker-compose-plugin

 5、5 配置阿里云镜像加速:

$ mkdir -p /etc/docker
$ tee /etc/docker/daemon.json <<-'EOF'
{
	"registry-mirrors": ["https://fxt824bw.mirror.aliyuncs.com"]
}
EOF

5、6 验证docker是否安装:

$ docker -v
Docker version 20.10.18, build b40c2f6

5、7 启动docker:

$ systemctl start docker

6、安装cephadm(ceph2节点操作)部署集群:

6、1 安装cephadm:

$ yum install cephadm -y

6、2 引导新群集:

$ cephadm bootstrap --mon-ip ceph1的IP

# 执行结果:
Verifying podman|docker is present...
Verifying lvm2 is present...
Verifying time synchronization is in place...
Unit chronyd.service is enabled and running
Repeating the final host check...
podman|docker (/usr/bin/docker) is present
systemctl is present
lvcreate is present
Unit chronyd.service is enabled and running
Host looks OK
Cluster fsid: 09feacf4-4f13-11ed-a401-000c29d6f8f4
Verifying IP 192.168.150.120 port 3300 ...
Verifying IP 192.168.150.120 port 6789 ...
Mon IP 192.168.150.120 is in CIDR network 192.168.150.0/24
- internal network (--cluster-network) has not been provided, OSD replication will default to the public_network
Pulling container image docker.io/ceph/ceph:v16...
Ceph version: ceph version 16.2.5 (0883bdea7337b95e4b611c768c0279868462204a) pacific (stable)
Extracting ceph user uid/gid from container image...
Creating initial keys...
Creating initial monmap...
Creating mon...
Waiting for mon to start...
Waiting for mon...
mon is available
Assimilating anything we can from ceph.conf...
Generating new minimal ceph.conf...
Restarting the monitor...
Setting mon public_network to 192.168.150.0/24
Wrote config to /etc/ceph/ceph.conf
Wrote keyring to /etc/ceph/ceph.client.admin.keyring
Creating mgr...
Verifying port 9283 ...
Waiting for mgr to start...
Waiting for mgr...
mgr not available, waiting (1/15)...
mgr not available, waiting (2/15)...
mgr not available, waiting (3/15)...
mgr not available, waiting (4/15)...
mgr is available
Enabling cephadm module...
Waiting for the mgr to restart...
Waiting for mgr epoch 5...
mgr epoch 5 is available
Setting orchestrator backend to cephadm...
Generating ssh key...
Wrote public SSH key to /etc/ceph/ceph.pub
Adding key to root@localhost authorized_keys...
Adding host ceph1...
Deploying mon service with default placement...
Deploying mgr service with default placement...
Deploying crash service with default placement...
Enabling mgr prometheus module...
Deploying prometheus service with default placement...
Deploying grafana service with default placement...
Deploying node-exporter service with default placement...
Deploying alertmanager service with default placement...
Enabling the dashboard module...
Waiting for the mgr to restart...
Waiting for mgr epoch 13...
mgr epoch 13 is available
Generating a dashboard self-signed certificate...
Creating initial admin user...
Fetching dashboard port number...
Ceph Dashboard is now available at:

             URL: https://ceph1:8443/
            User: admin
        Password: mo5ahyp1wx

You can access the Ceph CLI with:

        sudo /usr/sbin/cephadm shell --fsid 09feacf4-4f13-11ed-a401-000c29d6f8f4 -c /etc/ceph/ceph.conf -k /etc/ceph/ceph.client.admin.keyring

Please consider enabling telemetry to help improve Ceph:

        ceph telemetry on

For more information see:

        https://docs.ceph.com/docs/pacific/mgr/telemetry/

Bootstrap complete.

 通过URL可以访问到可视化界面,输入用户名和密码即可进入界面:

 6、3 其他主机加入集群:

        启用 CEPH CLI:

$ cephadm shell

         安装集群公共SSH密钥:

$ ceph cephadm get-pub-key > ~/ceph.pub
$ ssh-copy-id -f -i /etc/ceph/ceph.pub root@ceph2
$ ssh-copy-id -f -i /etc/ceph/ceph.pub root@ceph3

        新主机加入集群:

$ ceph orch host add ceph2
$ ceph orch host add ceph3

         等待一段时间(可能需要等待的时间比较久,新加入的主机需要拉取需要的镜像和启动容器实例),查看集群状态:

$ ceph -s
  cluster:
    id:     09feacf4-4f13-11ed-a401-000c29d6f8f4
    health: HEALTH_WARN
            OSD count 0 < osd_pool_default_size 3

  services:
    mon: 3 daemons, quorum ceph1,ceph2,ceph3 (age 90s)
    mgr: ceph1.sqfwyo(active, since 22m), standbys: ceph2.mwhuqa
    osd: 0 osds: 0 up, 0 in

  data:
    pools:   0 pools, 0 pgs
    objects: 0 objects, 0 B
    usage:   0 B used, 0 B / 0 B avail
    pgs:

可以看到新主机加入到集群中的时候会自动扩展mon和mgr节点。

6、4 部署OSD:

        查看磁盘分区:

$ lsblk
NAME        MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sr0          11:0    1 10.1G  0 rom
nvme0n1     259:0    0   20G  0 disk
|-nvme0n1p1 259:1    0    1G  0 part
`-nvme0n1p2 259:2    0   19G  0 part
  |-cl-root 253:0    0   17G  0 lvm  /var/lib/ceph/crash
  `-cl-swap 253:1    0    2G  0 lvm  [SWAP]
nvme0n2     259:3    0   10G  0 disk
nvme0n3     259:4    0   10G  0 disk
nvme0n4     259:5    0   10G  0 disk

         将集群中所有的空闲磁盘分区全部部署到集群中:

$ ceph orch daemon add osd ceph1:/dev/nvme0n2
Created osd(s) 0 on host 'ceph1'
$ ceph orch daemon add osd ceph1:/dev/nvme0n3
Created osd(s) 1 on host 'ceph1'
$ ceph orch daemon add osd ceph1:/dev/nvme0n4
Created osd(s) 2 on host 'ceph1'
$ ceph orch daemon add osd ceph2:/dev/nvme0n2
Created osd(s) 3 on host 'ceph2'
$ ceph orch daemon add osd ceph2:/dev/nvme0n3
Created osd(s) 4 on host 'ceph2'
$ ceph orch daemon add osd ceph2:/dev/nvme0n4
Created osd(s) 5 on host 'ceph2'
$ ceph orch daemon add osd ceph3:/dev/nvme0n2
Created osd(s) 6 on host 'ceph3'
$ ceph orch daemon add osd ceph3:/dev/nvme0n3
Created osd(s) 7 on host 'ceph3'
$ ceph orch daemon add osd ceph3:/dev/nvme0n4
Created osd(s) 8 on host 'ceph3'

        查看集群状态:

$ ceph -s
  cluster:
    id:     09feacf4-4f13-11ed-a401-000c29d6f8f4
    health: HEALTH_OK

  services:
    mon: 3 daemons, quorum ceph1,ceph2,ceph3 (age 23m)
    mgr: ceph2.mwhuqa(active, since 13m), standbys: ceph1.sqfwyo
    osd: 9 osds: 9 up (since 7m), 9 in (since 8m)

  data:
    pools:   1 pools, 1 pgs
    objects: 0 objects, 0 B
    usage:   48 MiB used, 90 GiB / 90 GiB avail
    pgs:     1 active+clean

[ceph: root@ceph1 ~]# ceph -s
  cluster:
    id:     09feacf4-4f13-11ed-a401-000c29d6f8f4
    health: HEALTH_OK

  services:
    mon: 3 daemons, quorum ceph1,ceph2,ceph3 (age 30m)
    mgr: ceph2.mwhuqa(active, since 12h), standbys: ceph1.sqfwyo
    osd: 9 osds: 9 up (since 12h), 9 in (since 12h)

  data:
    pools:   1 pools, 1 pgs
    objects: 0 objects, 0 B
    usage:   48 MiB used, 90 GiB / 90 GiB avail
    pgs:     1 active+clean

7、可视化界面验证查看集群:

 至此,cephadm快速部署ceph集群已经完成。后续可以进行一些块存储和对象存储等。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

cephadm快速部署指定版本ceph集群 的相关文章

随机推荐

  • Windows 11 将使 AMD 芯片性能下降 15%!

    整理 孙胜 出品 CSDN ID CSDNnews 10月5日 微软终于发布了Windows 11正式版本 尽管Windows 11被微软称为 10年以来最重要的版本更新之一 说实话Windows 11还是有点令人失望 暂且不论Window
  • 基于CC2530的串口通信(可用与STM32通信)

    材料准备 CC2530芯片与底板一个 方便调试与下载 这是我淘宝买的一个小小的zigbee开发板 CC2530 配置串口的一般步骤 1 配置 IO 使用外部设备功能 此处配置 P0 2 和 P0 3 用作串口 UART0 2 配置相应串口的
  • 解决:error: ‘XXX’ is not a class template

    解决方法 首先去写 普通类模板 然后再实现 全特化 此问题在测试 模板全特化 的时候发现 如果首先去写 全特化 然后再实现 普通类模板 编译器就会提醒 error XXX is not a class template 全特化 templa
  • IDEA好用的插件推荐

    目录 1 Translation 2 GsonFormat 3 VisualVM Launcher 4 CodeGlance Pro 5 Key Promoter X 6 GenerateAllSetter 7 ignore 8 MyBat
  • 大白话Vue之publicPath

    1 下看一下publicPath字段出现的位置 vue config js webpack config js 2 官网中的解释 可以忽略 3 用人话解释publicPath 场景说明 每次打包build完后 都单独生成一个 dist文件夹
  • HTML基于mvc的项目实例,一个简单MVC5 + EF6示例分享

    本文所使用的软件及环境 Visual Studio Ultimate 2013 MVC5 EF6 NET Framework 4 5 LocalDB Windows 7 x64 Professional 说明 1 在EF Entity Fr
  • android的消息处理机制(图+源码分析)——Looper,Handler,Message

    http www cnblogs com codingmyworld archive 2011 09 14 2174255 html
  • 2019下半年上午题

    2019下半年上午题 b 选a c 最后统一单位 计算需要多少片芯片 流水线 也就是 对于这一道题 c ssl 安全套接层 https 安全通道 PGP 电子邮件加密 d b a b b 受委托方和委托方 c d 试题是考试系统中的一部分
  • 软件测试分享15个适合练手的项目【金融/银行/商城/电商/医药......】

    还愁没有练手的项目 我已经给你准备好了 需要评论区留下你的想法吧 1 引言 1 1 文档版本 版本 作者 审批 备注 V1 0 XXXX 创建测试方案文档 1 2 项目情况 项目名称 XXX 项目版本 V1 0 项目经理 XX 测试人员 X
  • 安川机器人io对照表_安川机器人信号

    逻辑编号针号 名称 信号 逻辑编号 针号 名称 信号 20010 B1 外部启动 in 20024 B1 in 20011 A1 in 20025 A1 in 20012 B2 调出主程序 in 20026 B2 抓手 搬运防碰撞 in 2
  • SVD实现数字水印

    SVD方法的基本原理是将水印嵌入到原始图像的奇异值中 具体流程如下 1 设输入图像为mxn矩阵A 对其进行SVD分解 2 设水印图像为mxn矩阵W 嵌入到到原图像奇异值中S aW a为加权系数 对其进行SVD分解的到含有水印的奇异值 3 用
  • Nginx SSL模块配置提供HTTPS支持(Ngx_http_ssl_module)

    Ngx http ssl module 此模块为Nginx提供HTTPS支持 官方文档 http nginx org en docs http ngx http ssl module html 相关指令 ssl on off SSL功能启用
  • 作为一个上班族,靠Python副业兼职,也能月入1W+

    不知道大家从事的是IT行业还是其他行业 想通过Python兼职首先就需要掌握这项专业技能 如果有Python技术基础 那能兼职的项目可就多了 我靠Python做兼职已经有三四年了 见过身边很多朋友同事陆续学Python 有学成的 也有中途放
  • python错误与异常、调试

    错误 语法错误 逻辑错误 系统错误 异常 程序执行过程中出现的未知错误 语法和逻辑都是正常的 程序业务逻辑不完善引起的程序漏洞 错误 与 异常的区别 异常可以被捕获和处理 错误一般是编码错误 逻辑错误 系统错误 常见的异常类型 除零类型 名
  • vue环境配置文件

    配置文件 在vue项目目录下 我们可以看到诸如package json gitignore package lock json等等能配置项目的结构 引用的库 运行的方式 版本控制等等的都称为配置文件 2 环境配置文件就是能根据项目运行的环境
  • MATLAB数字图像处理(三)——图像轮廓提取与边缘检测

    文章目录 二值图像轮廓提取 灰度图像边缘检测 含噪图像边缘检测 均值滤波函数 二值图像轮廓提取 根据掏空内部点算法 运用Matlab编程实现二值图像的轮廓提取 以二值图像circles为例 I imread circles png subp
  • 几何变换详解

    几何变换详解 在三维图形学中 几何变换大致分为三种 平移变换 Translation 缩放变换 Scaling 旋转变换 Rotation 以下讨论皆针对DirectX 所以使用左手坐标系 平移变换 将三维空间中的一个点 x y z 1 移
  • Centos7更新glibc2.18

    Centos7更新glibc2 18 查看glibc版本 下载解压glibc2 18 编译安装 结果验证 查看glibc版本 查看glibc版本 ldd version 下载解压glibc2 18 参考 https blog csdn ne
  • 记录使用ESP32做WiFi模块使用的学习

    这里使用ESP32作为WiFi模块 使用STA模式或者AP模式 目录 前言 二 配置WiFi模式 1 STA模式 2 AP模式 3 AP STA模式 三 实现ESP32与电脑端通信 ESP32的数据接收与传输 ESP32的完整代码 前言 因
  • cephadm快速部署指定版本ceph集群

    官方文档 https docs ceph com en pacific 1 虚拟机规划 主机名 IP 角色 ceph1 192 168 150 120 cephadm mon mgr osd ceph2 192 168 150 121 mo