sweli 发表于 2019-2-1 13:58:57

Ceph集群由Jewel版本升级到Luminous版本

参考文档
  https://www.virtualtothecore.com/en/upgrade-ceph-cluster-luminous/
http://www.chinastor.com/distristor/11033L502017.html

缘起

  首先看之前安装版本链接及测试
http://blog.运维网.com/jerrymin/2139045
http://blog.运维网.com/jerrymin/2139046
mon   ceph0、ceph2、cphe3
osd   ceph0、ceph1、ceph2、ceph3
rgw   ceph1
deployceph0
之前在Centos7.5上测试了Jewel版本的集群,随着对Ceph了解深入,计划线上运行比较新的LTS版本Ceph集群,最终选择了Luminous版本。
本来计划重新部署Luminous版本,看到这是测试环境数据丢失风险小就想尝试升级Jewel版本到Luminous版本,由于之前是Yum安装的根据之前经验原理是更新二进制文件,最后重启服务即可。看介绍文档升级步骤比较简单,但是测试中发现国内用户肯定会遇到一个坑,升级过程中会自动修改yum源到国外的站点,由于网络延迟大300s反应不及时会自动断开连接停止升级服务,故后续的操作我改成了国内源,并找出rpm包手工升级,由于本身有依赖关系故最终就收到yum install ceph ceph-radosgw即可全部升级所有的ceph包,最后重启相关服务即完成升级,最终数据没有丢失,各个功能也正常。


升级过程
  参照官方的升级指南一步一步的小心操作,要注意,升级时候要确保系统是健康运行的状态。
1、登录,确认sortbitwise是enabled状态:

  # ceph osd set sortbitwise
set sortbitwise

  2、设置noout标志,告诉Ceph不要重新去做集群的负载均衡,虽然这是可选项,但是建议设置一下,避免每次停止节点的时候,Ceph就尝试通过复制数据到其他可用节点来重新平衡集群。

  # ceph osd set noout
set noout

  3、升级时,可以选择手工升级每个节点,也可以使用使用Ceph-deploy实现自动升级。如果选择手动升级,在CentOS系统里,你需要先编辑Ceph yum repo获取新的Luminous版本来替换老版本Jewel,这就需要一个简单的文本替换操作:

  # sed -i 's/jewel/luminous/' /etc/yum.repos.d/ceph.repo

  4、使用Ceph-deploy可以实现一个命令完成集群的自动升级

  # yum install ceph-deploy python-pushy
Running transaction
Updating   : ceph-deploy-2.0.0-0.noarch                                                                                                                              1/2
Cleanup    : ceph-deploy-1.5.39-0.noarch                                                                                                                           2/2
Verifying: ceph-deploy-2.0.0-0.noarch                                                                                                                              1/2
Verifying: ceph-deploy-1.5.39-0.noarch                                                                                                                           2/2
Updated:
ceph-deploy.noarch 0:2.0.0-0                                                                                                                                       
Complete!
# rpm -qa |grep ceph-deploy
ceph-deploy-2.0.0-0.noarch

  5、一旦Ceph-deploy升级完成,首先要做的是在同一台机器上升级Ceph。
发现从这个时候开始按照官网的步骤在国内行不通了,主要原因是yum源改成了国外的网速达不到,后续就是手工升级结合官网步骤了。

# ceph -s
cluster 812d3acb-eaa8-4355-9a74-64f2cd5209b3
health HEALTH_WARN
noout flag(s) set
monmap e2: 3 mons at {idcv-ceph0=172.20.1.138:6789/0,idcv-ceph2=172.20.1.140:6789/0,idcv-ceph3=172.20.1.141:6789/0}
election epoch 8, quorum 0,1,2 idcv-ceph0,idcv-ceph2,idcv-ceph3
osdmap e49: 4 osds: 4 up, 4 in
flags noout,sortbitwise,require_jewel_osds
pgmap v53288: 272 pgs, 12 pools, 97496 MB data, 1785 kobjects
296 GB used, 84824 MB / 379 GB avail
272 active+clean
# ceph -v
ceph version 10.2.10 (5dc1e4c05cb68dbf62ae6fce3f0700e4654fdbbe)
# cd /root/cluster/
# ls
ceph.bootstrap-mds.keyringceph.bootstrap-osd.keyringceph.client.admin.keyringceph-deploy-ceph.log
ceph.bootstrap-mgr.keyringceph.bootstrap-rgw.keyringceph.conf               
# ceph-deploy install --release luminous idcv-ceph0
found configuration file at: /root/.cephdeploy.conf
Invoked (2.0.0): /usr/bin/ceph-deploy install --release luminous idcv-ceph0
ceph-deploy options:
verbose                     : False
testing                     : None
cd_conf                     :
cluster                     : ceph
dev_commit                  : None
install_mds                   : False
stable                        : None
default_release               : False
username                      : None
adjust_repos                  : True
func                        :
install_mgr                   : False
install_all                   : False
repo                        : False
host                        : ['idcv-ceph0']
install_rgw                   : False
install_tests               : False
repo_url                      : None
ceph_conf                     : None
install_osd                   : False
version_kind                  : stable
install_common                : False
overwrite_conf                : False
quiet                         : False
dev                           : master
nogpgcheck                  : False
local_mirror                  : None
release                     : luminous
install_mon                   : False
gpg_url                     : None
Installing stable version luminous on cluster ceph hosts idcv-ceph0
Detecting platform for host idcv-ceph0 ...
connected to host: idcv-ceph0
detect platform information from remote host
detect machine type
Distro info: CentOS Linux 7.5.1804 Core
installing Ceph on idcv-ceph0
Running command: yum clean all
Loaded plugins: fastestmirror, priorities
Cleaning repos: Ceph Ceph-noarch base ceph-source epel extras updates
Cleaning up everything
Maybe you want: rm -rf /var/cache/yum, to also free up space taken by orphaned data from disabled or removed repos
Cleaning up list of fastest mirrors
Running command: yum -y install epel-release
Loaded plugins: fastestmirror, priorities
Determining fastest mirrors
* base: mirrors.huaweicloud.com
* epel: mirrors.huaweicloud.com
* extras: mirrors.neusoft.edu.cn
* updates: mirrors.huaweicloud.com
8 packages excluded due to repository priority protections
Package epel-release-7-11.noarch already installed and latest version
Nothing to do
Running command: yum -y install yum-plugin-priorities
Loaded plugins: fastestmirror, priorities
Loading mirror speeds from cached hostfile
* base: mirrors.huaweicloud.com
* epel: mirrors.huaweicloud.com
* extras: mirrors.neusoft.edu.cn
* updates: mirrors.huaweicloud.com
8 packages excluded due to repository priority protections
Package yum-plugin-priorities-1.1.31-45.el7.noarch already installed and latest version
Nothing to do
Configure Yum priorities to include obsoletes
check_obsoletes has been enabled for Yum priorities plugin
Running command: rpm --import https://download.ceph.com/keys/release.asc
Running command: yum remove -y ceph-release
Loaded plugins: fastestmirror, priorities
Resolving Dependencies
--> Running transaction check
---> Package ceph-release.noarch 0:1-1.el7 will be erased
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
Package            Arch         Version            Repository         Size
================================================================================
Removing:
ceph-release         noarch         1-1.el7            installed         535

Transaction Summary
================================================================================
Remove1 Package

Installed size: 535
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
   Erasing    : ceph-release-1-1.el7.noarch                                  1/1
warning: /etc/yum.repos.d/ceph.repo saved as /etc/yum.repos.d/ceph.repo.rpmsave
   Verifying: ceph-release-1-1.el7.noarch                                  1/1

Removed:
   ceph-release.noarch 0:1-1.el7                                                

Complete!
Running command: yum install -y https://download.ceph.com/rpm-luminous/el7/noarch/ceph-release-1-0.el7.noarch.rpm
Loaded plugins: fastestmirror, priorities
Examining /var/tmp/yum-root-dPpRu6/ceph-release-1-0.el7.noarch.rpm: ceph-release-1-1.el7.noarch
Marking /var/tmp/yum-root-dPpRu6/ceph-release-1-0.el7.noarch.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package ceph-release.noarch 0:1-1.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
Package          Arch       Version   Repository                        Size
================================================================================
Installing:
ceph-release   noarch   1-1.el7   /ceph-release-1-0.el7.noarch   544

Transaction Summary
================================================================================
Install1 Package

Total size: 544
Installed size: 544
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
   Installing : ceph-release-1-1.el7.noarch                                  1/1
   Verifying: ceph-release-1-1.el7.noarch                                  1/1

Installed:
   ceph-release.noarch 0:1-1.el7                                                

Complete!
ensuring that /etc/yum.repos.d/ceph.repo contains a high priority
altered ceph.repo priorities to contain: priority=1
Running command: yum -y install ceph ceph-radosgw
Loaded plugins: fastestmirror, priorities
Loading mirror speeds from cached hostfile
* base: mirrors.huaweicloud.com
* epel: mirrors.huaweicloud.com
* extras: mirrors.neusoft.edu.cn
* updates: mirrors.huaweicloud.com
8 packages excluded due to repository priority protections
Resolving Dependencies
--> Running transaction check
---> Package ceph.x86_64 1:10.2.10-0.el7 will be updated
---> Package ceph.x86_64 2:12.2.5-0.el7 will be an update
--> Processing Dependency: ceph-osd = 2:12.2.5-0.el7 for package: 2:ceph-12.2.5-0.el7.x86_64
--> Processing Dependency: ceph-mon = 2:12.2.5-0.el7 for package: 2:ceph-12.2.5-0.el7.x86_64
--> Processing Dependency: ceph-mgr = 2:12.2.5-0.el7 for package: 2:ceph-12.2.5-0.el7.x86_64
--> Processing Dependency: ceph-mds = 2:12.2.5-0.el7 for package: 2:ceph-12.2.5-0.el7.x86_64
---> Package ceph-radosgw.x86_64 1:10.2.10-0.el7 will be updated
---> Package ceph-radosgw.x86_64 2:12.2.5-0.el7 will be an update
--> Processing Dependency: ceph-selinux = 2:12.2.5-0.el7 for package: 2:ceph-radosgw-12.2.5-0.el7.x86_64
--> Processing Dependency: librgw2 = 2:12.2.5-0.el7 for package: 2:ceph-radosgw-12.2.5-0.el7.x86_64
--> Processing Dependency: librados2 = 2:12.2.5-0.el7 for package: 2:ceph-radosgw-12.2.5-0.el7.x86_64
--> Processing Dependency: ceph-common = 2:12.2.5-0.el7 for package: 2:ceph-radosgw-12.2.5-0.el7.x86_64
--> Processing Dependency: libibverbs.so.1()(64bit) for package: 2:ceph-radosgw-12.2.5-0.el7.x86_64
--> Processing Dependency: libceph-common.so.0()(64bit) for package: 2:ceph-radosgw-12.2.5-0.el7.x86_64
--> Running transaction check
---> Package ceph-common.x86_64 1:10.2.10-0.el7 will be updated
--> Processing Dependency: ceph-common = 1:10.2.10-0.el7 for package: 1:ceph-base-10.2.10-0.el7.x86_64
---> Package ceph-common.x86_64 2:12.2.5-0.el7 will be an update
--> Processing Dependency: python-rbd = 2:12.2.5-0.el7 for package: 2:ceph-common-12.2.5-0.el7.x86_64
--> Processing Dependency: libcephfs2 = 2:12.2.5-0.el7 for package: 2:ceph-common-12.2.5-0.el7.x86_64
--> Processing Dependency: python-rgw = 2:12.2.5-0.el7 for package: 2:ceph-common-12.2.5-0.el7.x86_64
--> Processing Dependency: python-cephfs = 2:12.2.5-0.el7 for package: 2:ceph-common-12.2.5-0.el7.x86_64
--> Processing Dependency: python-rados = 2:12.2.5-0.el7 for package: 2:ceph-common-12.2.5-0.el7.x86_64
--> Processing Dependency: librbd1 = 2:12.2.5-0.el7 for package: 2:ceph-common-12.2.5-0.el7.x86_64
--> Processing Dependency: python-prettytable for package: 2:ceph-common-12.2.5-0.el7.x86_64
--> Processing Dependency: libcephfs.so.2()(64bit) for package: 2:ceph-common-12.2.5-0.el7.x86_64
---> Package ceph-mds.x86_64 1:10.2.10-0.el7 will be updated
---> Package ceph-mds.x86_64 2:12.2.5-0.el7 will be an update
---> Package ceph-mgr.x86_64 2:12.2.5-0.el7 will be installed
--> Processing Dependency: python-cherrypy for package: 2:ceph-mgr-12.2.5-0.el7.x86_64
--> Processing Dependency: pyOpenSSL for package: 2:ceph-mgr-12.2.5-0.el7.x86_64
--> Processing Dependency: python-pecan for package: 2:ceph-mgr-12.2.5-0.el7.x86_64
---> Package ceph-mon.x86_64 1:10.2.10-0.el7 will be updated
---> Package ceph-mon.x86_64 2:12.2.5-0.el7 will be an update
---> Package ceph-osd.x86_64 1:10.2.10-0.el7 will be updated
---> Package ceph-osd.x86_64 2:12.2.5-0.el7 will be an update
---> Package ceph-selinux.x86_64 1:10.2.10-0.el7 will be updated
---> Package ceph-selinux.x86_64 2:12.2.5-0.el7 will be an update
---> Package libibverbs.x86_64 0:15-7.el7_5 will be installed
--> Processing Dependency: rdma-core(x86-64) = 15-7.el7_5 for package: libibverbs-15-7.el7_5.x86_64
---> Package librados2.x86_64 1:10.2.10-0.el7 will be updated
--> Processing Dependency: librados2 = 1:10.2.10-0.el7 for package: 1:rbd-nbd-10.2.10-0.el7.x86_64
--> Processing Dependency: librados2 = 1:10.2.10-0.el7 for package: 1:libradosstriper1-10.2.10-0.el7.x86_64
---> Package librados2.x86_64 2:12.2.5-0.el7 will be an update
---> Package librgw2.x86_64 1:10.2.10-0.el7 will be updated
---> Package librgw2.x86_64 2:12.2.5-0.el7 will be an update
--> Running transaction check
---> Package ceph-base.x86_64 1:10.2.10-0.el7 will be updated
---> Package ceph-base.x86_64 2:12.2.5-0.el7 will be an update
---> Package libcephfs1.x86_64 1:10.2.10-0.el7 will be obsoleted
---> Package libcephfs2.x86_64 2:12.2.5-0.el7 will be obsoleting
---> Package libradosstriper1.x86_64 1:10.2.10-0.el7 will be updated
---> Package libradosstriper1.x86_64 2:12.2.5-0.el7 will be an update
---> Package librbd1.x86_64 1:10.2.10-0.el7 will be updated
---> Package librbd1.x86_64 2:12.2.5-0.el7 will be an update
---> Package pyOpenSSL.x86_64 0:0.13.1-3.el7 will be installed
---> Package python-cephfs.x86_64 1:10.2.10-0.el7 will be updated
---> Package python-cephfs.x86_64 2:12.2.5-0.el7 will be an update
---> Package python-cherrypy.noarch 0:3.2.2-4.el7 will be installed
---> Package python-pecan.noarch 0:0.4.5-2.el7 will be installed
--> Processing Dependency: python-webtest >= 1.3.1 for package: python-pecan-0.4.5-2.el7.noarch
--> Processing Dependency: python-webob >= 1.2 for package: python-pecan-0.4.5-2.el7.noarch
--> Processing Dependency: python-simplegeneric >= 0.8 for package: python-pecan-0.4.5-2.el7.noarch
--> Processing Dependency: python-mako >= 0.4.0 for package: python-pecan-0.4.5-2.el7.noarch
--> Processing Dependency: python-singledispatch for package: python-pecan-0.4.5-2.el7.noarch
---> Package python-prettytable.noarch 0:0.7.2-3.el7 will be installed
---> Package python-rados.x86_64 1:10.2.10-0.el7 will be updated
---> Package python-rados.x86_64 2:12.2.5-0.el7 will be an update
---> Package python-rbd.x86_64 1:10.2.10-0.el7 will be updated
---> Package python-rbd.x86_64 2:12.2.5-0.el7 will be an update
---> Package python-rgw.x86_64 2:12.2.5-0.el7 will be installed
---> Package rbd-nbd.x86_64 1:10.2.10-0.el7 will be updated
---> Package rbd-nbd.x86_64 2:12.2.5-0.el7 will be an update
---> Package rdma-core.x86_64 0:15-7.el7_5 will be installed
--> Processing Dependency: pciutils for package: rdma-core-15-7.el7_5.x86_64
--> Running transaction check
---> Package pciutils.x86_64 0:3.5.1-3.el7 will be installed
---> Package python-mako.noarch 0:0.8.1-2.el7 will be installed
--> Processing Dependency: python-beaker for package: python-mako-0.8.1-2.el7.noarch
---> Package python-simplegeneric.noarch 0:0.8-7.el7 will be installed
---> Package python-singledispatch.noarch 0:3.4.0.2-2.el7 will be installed
---> Package python-webob.noarch 0:1.2.3-7.el7 will be installed
---> Package python-webtest.noarch 0:1.3.4-6.el7 will be installed
--> Running transaction check
---> Package python-beaker.noarch 0:1.5.4-10.el7 will be installed
--> Processing Dependency: python-paste for package: python-beaker-1.5.4-10.el7.noarch
--> Running transaction check
---> Package python-paste.noarch 0:1.7.5.1-9.20111221hg1498.el7 will be installed
--> Processing Dependency: python-tempita for package: python-paste-1.7.5.1-9.20111221hg1498.el7.noarch
--> Running transaction check
---> Package python-tempita.noarch 0:0.5.1-6.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
Package                Arch    Version                        Repository
                                                                            Size
================================================================================
Installing:
libcephfs2             x86_642:12.2.5-0.el7                   Ceph   432 k
      replacinglibcephfs1.x86_64 1:10.2.10-0.el7
Updating:
ceph                   x86_642:12.2.5-0.el7                   Ceph   3.0 k
ceph-radosgw         x86_642:12.2.5-0.el7                   Ceph   3.8 M
Installing for dependencies:
ceph-mgr               x86_642:12.2.5-0.el7                   Ceph   3.6 M
libibverbs             x86_6415-7.el7_5                     updates224 k
pciutils               x86_643.5.1-3.el7                      base      93 k
pyOpenSSL            x86_640.13.1-3.el7                     base   133 k
python-beaker          noarch1.5.4-10.el7                     base      80 k
python-cherrypy      noarch3.2.2-4.el7                      base   422 k
python-mako            noarch0.8.1-2.el7                      base   307 k
python-paste         noarch1.7.5.1-9.20111221hg1498.el7   base   866 k
python-pecan         noarch0.4.5-2.el7                      epel   255 k
python-prettytable   noarch0.7.2-3.el7                      base      37 k
python-rgw             x86_642:12.2.5-0.el7                   Ceph      73 k
python-simplegeneric   noarch0.8-7.el7                        epel      12 k
python-singledispatchnoarch3.4.0.2-2.el7                  epel      18 k
python-tempita         noarch0.5.1-6.el7                      base      33 k
python-webob         noarch1.2.3-7.el7                      base   202 k
python-webtest         noarch1.3.4-6.el7                      base   102 k
rdma-core            x86_6415-7.el7_5                     updates   48 k
Updating for dependencies:
ceph-base            x86_642:12.2.5-0.el7                   Ceph   3.9 M
ceph-common            x86_642:12.2.5-0.el7                   Ceph      15 M
ceph-mds               x86_642:12.2.5-0.el7                   Ceph   3.6 M
ceph-mon               x86_642:12.2.5-0.el7                   Ceph   5.0 M
ceph-osd               x86_642:12.2.5-0.el7                   Ceph      13 M
ceph-selinux         x86_642:12.2.5-0.el7                   Ceph      20 k
librados2            x86_642:12.2.5-0.el7                   Ceph   2.9 M
libradosstriper1       x86_642:12.2.5-0.el7                   Ceph   330 k
librbd1                x86_642:12.2.5-0.el7                   Ceph   1.1 M
librgw2                x86_642:12.2.5-0.el7                   Ceph   1.7 M
python-cephfs          x86_642:12.2.5-0.el7                   Ceph      82 k
python-rados         x86_642:12.2.5-0.el7                   Ceph   172 k
python-rbd             x86_642:12.2.5-0.el7                   Ceph   105 k
rbd-nbd                x86_642:12.2.5-0.el7                   Ceph      81 k

Transaction Summary
================================================================================
Install1 Package(+17 Dependent packages)
Upgrade2 Packages (+14 Dependent packages)

Total download size: 57 M
Downloading packages:
Delta RPMs disabled because /usr/bin/applydeltarpm not installed.
No data was received after 300 seconds, disconnecting...
Running command: ceph --version
ceph version 10.2.10 (5dc1e4c05cb68dbf62ae6fce3f0700e4654fdbbe)
  报错一

  Delta RPMs disabled because /usr/bin/applydeltarpm not installed.

  解决方案

  # yum install deltarpm -y
Loaded plugins: fastestmirror, priorities
Existing lock /var/run/yum.pid: another copy is running as pid 90654.
Another app is currently holding the yum lock; waiting for it to exit...
The other application is: yum
Memory : 132 M RSS (523 MB VSZ)
Started: Tue Jul 10 16:15:59 2018 - 10:22 ago
State: Sleeping, pid: 90654
Another app is currently holding the yum lock; waiting for it to exit...
The other application is: yum
Memory : 132 M RSS (523 MB VSZ)
Started: Tue Jul 10 16:15:59 2018 - 10:24 ago
State: Sleeping, pid: 90654
^C
Exiting on user cancel.
# kill -9 90654
# yum install deltarpm -y

  报错二

  No data was received after 300 seconds, disconnecting...

  解决方案

另外需要修改ceph源为国内yum源,比如阿里yum,否则会报错No data was received after 300 seconds, disconnecting...
# sed -i 's#download.ceph.com#mirrors.aliyun.com/ceph#g' /etc/yum.repos.d/ceph.repo
但是命令会自动改成国外源,这里的解决方案是rpm -qa |grep cphe相关,修改成国内yum源后直接手动安装yum install或者使用ceph-deploy install服务
# cat /etc/yum.repos.d/ceph.repo

name=Ceph packages for $basearch
baseurl=http://mirrors.aliyun.com/ceph/rpm-luminous/el7/$basearch
enabled=1
gpgcheck=1
type=rpm-md
gpgkey=https://mirrors.aliyun.com/ceph/keys/release.asc
priority=1

name=Ceph noarch packages
baseurl=http://mirrors.aliyun.com/ceph/rpm-luminous/el7/noarch
enabled=1
gpgcheck=1
type=rpm-md
gpgkey=https://mirrors.aliyun.com/ceph/keys/release.asc
priority=1

name=Ceph source packages
baseurl=http://mirrors.aliyun.com/ceph/rpm-luminous/el7/SRPMS
enabled=1
gpgcheck=1
type=rpm-md
gpgkey=https://mirrors.aliyun.com/ceph/keys/release.asc
priority=1
#yum -y install ceph ceph-radosgw
# rpm -qa |grep ceph
ceph-deploy-2.0.0-0.noarch
libcephfs2-12.2.5-0.el7.x86_64
python-cephfs-12.2.5-0.el7.x86_64
ceph-selinux-12.2.5-0.el7.x86_64
ceph-radosgw-12.2.5-0.el7.x86_64
ceph-release-1-1.el7.noarch
ceph-base-12.2.5-0.el7.x86_64
ceph-mon-12.2.5-0.el7.x86_64
ceph-osd-12.2.5-0.el7.x86_64
ceph-12.2.5-0.el7.x86_64
ceph-common-12.2.5-0.el7.x86_64
ceph-mds-12.2.5-0.el7.x86_64
ceph-mgr-12.2.5-0.el7.x86_64
# ceph -s
cluster 812d3acb-eaa8-4355-9a74-64f2cd5209b3
health HEALTH_WARN
noout flag(s) set
monmap e2: 3 mons at {idcv-ceph0=172.20.1.138:6789/0,idcv-ceph2=172.20.1.140:6789/0,idcv-ceph3=172.20.1.141:6789/0}
election epoch 8, quorum 0,1,2 idcv-ceph0,idcv-ceph2,idcv-ceph3
osdmap e49: 4 osds: 4 up, 4 in
flags noout,sortbitwise,require_jewel_osds
pgmap v53473: 272 pgs, 12 pools, 97496 MB data, 1785 kobjects
296 GB used, 84819 MB / 379 GB avail
272 active+clean
  6、在每一个监控节点,需要重启mon服务,命令如下:

# systemctl restart ceph-mon.target
# systemctl status ceph-mon.target
● ceph-mon.target - ceph target allowing to start/stop all ceph-mon@.service instances at once
Loaded: loaded (/usr/lib/systemd/system/ceph-mon.target; enabled; vendor preset: enabled)
Active: active since Tue 2018-07-10 17:27:39 CST; 11s agoJul 10 17:27:39 idcv-ceph0 systemd: Reached target ceph target allowing to start/stop all ceph-mon@.service instances at once.
Jul 10 17:27:39 idcv-ceph0 systemd: Starting ceph target allowing to start/stop all ceph-mon@.service instances at once.
# ceph -v
ceph version 12.2.5 (cad919881333ac92274171586c827e01f554a70a) luminous (stable)
# ceph -s
cluster:
id:   812d3acb-eaa8-4355-9a74-64f2cd5209b3
health: HEALTH_WARN
too many PGs per OSD (204 > max 200)
noout flag(s) set
services:
mon: 3 daemons, quorum idcv-ceph0,idcv-ceph2,idcv-ceph3
mgr: no daemons active
osd: 4 osds: 4 up, 4 in
flags noout
data:
pools:   12 pools, 272 pgs
objects: 1785k objects, 97496 MB
usage:   296 GB used, 84817 MB / 379 GB avail
pgs:   272 active+clean
  7、在Kraken版本里,曾介绍过有一个Ceph管理器,在Luninous版本之后,这个ceph-mgr进程是日常操作必须的,而在Kraken版本时可选的。所以我的Jewel集群里没有这个管理区,在这里我们必须要安装它:

# ceph-deploy mgr create idcv-ceph0 idcv-ceph1 idcv-ceph2 idcv-ceph3
found configuration file at: /root/.cephdeploy.conf
Invoked (2.0.0): /usr/bin/ceph-deploy mgr create idcv-ceph0 idcv-ceph1 idcv-ceph2 idcv-ceph3
ceph-deploy options:
username                      : None
verbose                     : False
mgr                           : [('idcv-ceph0', 'idcv-ceph0'), ('idcv-ceph1', 'idcv-ceph1'), ('idcv-ceph2', 'idcv-ceph2'), ('idcv-ceph3', 'idcv-ceph3')]
overwrite_conf                : False
subcommand                  : create
quiet                         : False
cd_conf                     :
cluster                     : ceph
func                        :
ceph_conf                     : None
default_release               : False
Deploying mgr, cluster ceph hosts idcv-ceph0:idcv-ceph0 idcv-ceph1:idcv-ceph1 idcv-ceph2:idcv-ceph2 idcv-ceph3:idcv-ceph3
connected to host: idcv-ceph0
detect platform information from remote host
detect machine type
Distro info: CentOS Linux 7.5.1804 Core
remote host will use systemd
deploying mgr bootstrap to idcv-ceph0
write cluster configuration to /etc/ceph/{cluster}.conf
mgr keyring does not exist yet, creating one
create a keyring file
create path recursively if it doesn't exist
Running command: ceph --cluster ceph --name client.bootstrap-mgr --keyring /var/lib/ceph/bootstrap-mgr/ceph.keyring auth get-or-create mgr.idcv-ceph0 mon allow profile mgr osd allow * mds allow * -o /var/lib/ceph/mgr/ceph-idcv-ceph0/keyring
Running command: systemctl enable ceph-mgr@idcv-ceph0
Created symlink from /etc/systemd/system/ceph-mgr.target.wants/ceph-mgr@idcv-ceph0.service to /usr/lib/systemd/system/ceph-mgr@.service.
Running command: systemctl start ceph-mgr@idcv-ceph0
Running command: systemctl enable ceph.target
connection detected need for sudo
connected to host: idcv-ceph1
detect platform information from remote host
detect machine type
Distro info: CentOS Linux 7.5.1804 Core
remote host will use systemd
deploying mgr bootstrap to idcv-ceph1
write cluster configuration to /etc/ceph/{cluster}.conf
mgr keyring does not exist yet, creating one
create a keyring file
create path recursively if it doesn't exist
Running command: sudo ceph --cluster ceph --name client.bootstrap-mgr --keyring /var/lib/ceph/bootstrap-mgr/ceph.keyring auth get-or-create mgr.idcv-ceph1 mon allow profile mgr osd allow * mds allow * -o /var/lib/ceph/mgr/ceph-idcv-ceph1/keyring
Running command: sudo systemctl enable ceph-mgr@idcv-ceph1
Created symlink from /etc/systemd/system/ceph-mgr.target.wants/ceph-mgr@idcv-ceph1.service to /usr/lib/systemd/system/ceph-mgr@.service.
Running command: sudo systemctl start ceph-mgr@idcv-ceph1
Running command: sudo systemctl enable ceph.target
connection detected need for sudo
connected to host: idcv-ceph2
detect platform information from remote host
detect machine type
Distro info: CentOS Linux 7.5.1804 Core
remote host will use systemd
deploying mgr bootstrap to idcv-ceph2
write cluster configuration to /etc/ceph/{cluster}.conf
mgr keyring does not exist yet, creating one
create a keyring file
create path recursively if it doesn't exist
Running command: sudo ceph --cluster ceph --name client.bootstrap-mgr --keyring /var/lib/ceph/bootstrap-mgr/ceph.keyring auth get-or-create mgr.idcv-ceph2 mon allow profile mgr osd allow * mds allow * -o /var/lib/ceph/mgr/ceph-idcv-ceph2/keyring
Running command: sudo systemctl enable ceph-mgr@idcv-ceph2
Created symlink from /etc/systemd/system/ceph-mgr.target.wants/ceph-mgr@idcv-ceph2.service to /usr/lib/systemd/system/ceph-mgr@.service.
Running command: sudo systemctl start ceph-mgr@idcv-ceph2
Running command: sudo systemctl enable ceph.target
connection detected need for sudo
connected to host: idcv-ceph3
detect platform information from remote host
detect machine type
Distro info: CentOS Linux 7.5.1804 Core
remote host will use systemd
deploying mgr bootstrap to idcv-ceph3
write cluster configuration to /etc/ceph/{cluster}.conf
mgr keyring does not exist yet, creating one
create a keyring file
create path recursively if it doesn't exist
Running command: sudo ceph --cluster ceph --name client.bootstrap-mgr --keyring /var/lib/ceph/bootstrap-mgr/ceph.keyring auth get-or-create mgr.idcv-ceph3 mon allow profile mgr osd allow * mds allow * -o /var/lib/ceph/mgr/ceph-idcv-ceph3/keyring
Running command: sudo systemctl enable ceph-mgr@idcv-ceph3
Created symlink from /etc/systemd/system/ceph-mgr.target.wants/ceph-mgr@idcv-ceph3.service to /usr/lib/systemd/system/ceph-mgr@.service.
Running command: sudo systemctl start ceph-mgr@idcv-ceph3
Running command: sudo systemctl enable ceph.target
# ceph -s
cluster:
id:   812d3acb-eaa8-4355-9a74-64f2cd5209b3
health: HEALTH_WARN
too many PGs per OSD (204 > max 200)
noout flag(s) set
services:
mon: 3 daemons, quorum idcv-ceph0,idcv-ceph2,idcv-ceph3
mgr: idcv-ceph0(active), standbys: idcv-ceph1, idcv-ceph2, idcv-ceph3
osd: 4 osds: 4 up, 4 in
flags noout
data:
pools:   12 pools, 272 pgs
objects: 1785k objects, 97496 MB
usage:   296 GB used, 84816 MB / 379 GB avail
pgs:   272 active+clean
  8、重启osd
前题是所有节点都修改了国内L版本yum源第6步骤又介绍,执行了yum -y install ceph ceph-radosgw,他会升级二进制文件

  #systemctl restart ceph-osd.target
# ceph versions
{
"mon": {
"ceph version 12.2.5 (cad919881333ac92274171586c827e01f554a70a) luminous (stable)": 3
},
"mgr": {
"ceph version 12.2.5 (cad919881333ac92274171586c827e01f554a70a) luminous (stable)": 4
},
"osd": {
"ceph version 12.2.5 (cad919881333ac92274171586c827e01f554a70a) luminous (stable)": 4
},
"mds": {},
"overall": {
"ceph version 12.2.5 (cad919881333ac92274171586c827e01f554a70a) luminous (stable)": 11
}
}

  9、现在所有的组件都是最新的12.5版本了,我们可以禁止Luminous版本之前的OSD,运行Luminous的独有功能:

  # ceph osd require-osd-release luminous
recovery_deletes is set

  这也意味着现在只有Luminous节点才能加入这个集群了。
  10、rgw服务也需要重启在ceph1上

  # systemctl restart ceph-radosgw.target
# systemctl status ceph-radosgw.target
● ceph-radosgw.target - ceph target allowing to start/stop all ceph-radosgw@.service instances at once
Loaded: loaded (/usr/lib/systemd/system/ceph-radosgw.target; enabled; vendor preset: enabled)
Active: active since Tue 2018-07-10 18:02:25 CST; 6s ago
Jul 10 18:02:25 idcv-ceph1 systemd: Reached target ceph target allowing to start/stop all ceph-radosgw@.service instances at once.
Jul 10 18:02:25 idcv-ceph1 systemd: Starting ceph target allowing to start/stop all ceph-radosgw@.service instances at once.

  11、启动dashboard

# rpm -qa |grep mgr
ceph-mgr-12.2.5-0.el7.x86_64
#ceph mgr module enable dashboard      
# ceph mgr dump
{
"epoch": 53,
"active_gid": 34146,
"active_name": "idcv-ceph0",
"active_addr": "172.20.1.138:6804/95951",
"available": true,
"standbys": [
{
"gid": 44129,
"name": "idcv-ceph2",
"available_modules": [
"balancer",
"dashboard",
"influx",
"localpool",
"prometheus",
"restful",
"selftest",
"status",
"zabbix"
]
},
{
"gid": 44134,
"name": "idcv-ceph1",
"available_modules": [
"balancer",
"dashboard",
"influx",
"localpool",
"prometheus",
"restful",
"selftest",
"status",
"zabbix"
]
},
{
"gid": 44135,
"name": "idcv-ceph3",
"available_modules": [
"balancer",
"dashboard",
"influx",
"localpool",
"prometheus",
"restful",
"selftest",
"status",
"zabbix"
]
}
],
"modules": [
"balancer",
"dashboard",
"restful",
"status"
],
"available_modules": [
"balancer",
"dashboard",
"influx",
"localpool",
"prometheus",
"restful",
"selftest",
"status",
"zabbix"
],
"services": {
"dashboard": "http://idcv-ceph0:7000/"
}
}
  浏览器访问http://172.20.1.138:7000



  12、最后一步,禁止noot,以后集群就可以在需要的时候自己做负载均衡了:

# ceph osd unset noout
noout is unset
# ceph -s
cluster:
id:   812d3acb-eaa8-4355-9a74-64f2cd5209b3
health: HEALTH_WARN
application not enabled on 1 pool(s)
services:
mon: 3 daemons, quorum idcv-ceph0,idcv-ceph2,idcv-ceph3
mgr: idcv-ceph0(active), standbys: idcv-ceph2, idcv-ceph1, idcv-ceph3
osd: 4 osds: 4 up, 4 in
rgw: 1 daemon active
data:
pools:   12 pools, 272 pgs
objects: 1785k objects, 97496 MB
usage:   296 GB used, 84830 MB / 379 GB avail
pgs:   272 active+clean
io:
client:   0 B/s rd, 0 op/s rd, 0 op/s wr
报错
health: HEALTH_WARN
application not enabled on 1 pool(s)
解决方案
# ceph health detail
HEALTH_WARN application not enabled on 1 pool(s)
POOL_APP_NOT_ENABLED application not enabled on 1 pool(s)
application not enabled on pool 'test_pool'
use 'ceph osd pool application enable', whereis 'cephfs', 'rbd', 'rgw', or freeform for custom applications.
# ceph osd pool application enabletest_pool
Invalid command: missing required parameter app()
osd pool application enable   {--yes-i-really-mean-it} :enable use of an application on pool
Error EINVAL: invalid command
# ceph osd pool application enable test_pool rbd
enabled application 'rbd' on pool 'test_pool'
# ceph -s
cluster:
id:   812d3acb-eaa8-4355-9a74-64f2cd5209b3
health: HEALTH_OK
services:
mon: 3 daemons, quorum idcv-ceph0,idcv-ceph2,idcv-ceph3
mgr: idcv-ceph0(active), standbys: idcv-ceph2, idcv-ceph1, idcv-ceph3
osd: 4 osds: 4 up, 4 in
rgw: 1 daemon active
data:
pools:   12 pools, 272 pgs
objects: 1785k objects, 97496 MB
usage:   296 GB used, 84829 MB / 379 GB avail
pgs:   272 active+clean
io:
client:   0 B/s rd, 0 op/s rd, 0 op/s wr
总结
  整个升级过程大概1个多小时,主要是结合国内情况否则升级还是比较简单的,另外L版本新增了mgr和dashboard功能,升级完成后测试了对象存储功能和块存储功能都正常。



页: [1]
查看完整版本: Ceph集群由Jewel版本升级到Luminous版本