一.使用ceph-deploy部署ceph集群

一、准备环境

1.修改hosts文件

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

#Ceph
10.39.40.1  ceph-1
10.39.40.2  ceph-2
10.39.40.3  ceph-3

2.安装插件

#ntp时间同步,自行配置
yum install vim git ntpd
#安装ceph-deploy
yum install -yls https://download.ceph.com/rpm-kraken/el7/noarch/ceph-deploy-1.5.38-0.noarch.rpm

3.配置Ceph国内源

CentOS:
export CEPH_DEPLOY_REPO_URL=http://mirrors.163.com/ceph/rpm-jewel/el7
export CEPH_DEPLOY_GPG_URL=http://mirrors.163.com/ceph/keys/release.asc

二、部署集群

1.创建目录

#创建ceph目录
mkdir /etc/ceph
cd /etc/ceph
#部署一个默认名为ceph的新的ceph集群;他声称集群配置和keying文件
ceph-deploy new ceph-1

2.修改配置文件vim /etc/ceph/ceph.conf

[global]
fsid = xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
mon_initial_members = ceph-1,ceph-2,ceph-3
mon_host = 10.39.40.1,10.39.40.2,10.39.40.3
auth_cluster_required = cephx
auth_service_required = cephx
auth_client_required = cephx
pubulic_network = 10.39.40.0/24
#使用ceph-deploy工具将ceph软件的二进制包安装到所有的节点上
ceph-deploy install --release emperor ceph-1 ceph-2 ceph-3

#分发配置文件
ceph-deploy --overwrite-conf config push ceph-2 ceph-3

#在ceph-node上创建你的第一个monitor;
ceph-deploy mon create-initial

#disk zap 命令会销毁磁盘中已存在的分区表和数据
ceph-deploy disk zap ceph-1:vdc ceph-2:vdc ceph-3:vdc

#欧舒丹create命令准备好磁盘,也就是说,它会擦除磁盘原有数据并新建文件系统,默认为xfs
ceph-deploy osd create ceph-1:vdc ceph-2:vdc ceph-3:vdc


#在ceph-2,ceph-3上创建systemonitor;
ceph mon create ceph-2
ceph mon create ceph-3


#添加磁盘与第一次添加磁盘一样
ceph-deploy disk zap ceph-1:vdd ceph-2:vdd ceph-3:vdd
ceph-deploy osd create ceph-1:vdd ceph-2:vdd ceph-3:vdd

三、报错

报错1

[ceph-1][ERROR ] admin_socket: exception getting command descriptions: [Errno 2] No such file or directory
[ceph-1][WARNIN] monitor: mon.ceph-1, might not be running yet
[ceph-1][INFO  ] Running command: ceph --cluster=ceph --admin-daemon /var/run/ceph/ceph-mon.ceph-1.asok mon_status
[ceph-1][ERROR ] admin_socket: exception getting command descriptions: [Errno 2] No such file or directory
[ceph-1][WARNIN] monitor ceph-1 does not exist in monmap
[ceph-1][WARNIN] neither `public_addr` nor `public_network` keys are defined for monitors
[ceph-1][WARNIN] monitors may not be able to form quorum

在/etc/ceph/ceph.conf中配置public_network

pubulic_network = 10.39.40.0/24

报错2

[ceph-test-2][WARNIN] Error: Package: 2:ceph-common-10.2.11-0.el7.x86_64 (ceph)
[ceph-test-2][WARNIN]            Requires: libbabeltrace-ctf.so.1()(64bit)
[ceph-test-2][WARNIN] Error: Package: 2:ceph-osd-10.2.11-0.el7.x86_64 (ceph)
[ceph-test-2][WARNIN]            Requires: libleveldb.so.1()(64bit)
[ceph-test-2][DEBUG ]  You could try using --skip-broken to work around the problem
[ceph-test-2][WARNIN] Error: Package: 2:ceph-mon-10.2.11-0.el7.x86_64 (ceph)
[ceph-test-2][WARNIN]            Requires: libleveldb.so.1()(64bit)
[ceph-test-2][WARNIN] Error: Package: 2:librbd1-10.2.11-0.el7.x86_64 (ceph)
[ceph-test-2][WARNIN]            Requires: liblttng-ust.so.0()(64bit)
[ceph-test-2][WARNIN] Error: Package: 2:ceph-base-10.2.11-0.el7.x86_64 (ceph)
[ceph-test-2][WARNIN]            Requires: liblttng-ust.so.0()(64bit)
[ceph-test-2][WARNIN] Error: Package: 2:librgw2-10.2.11-0.el7.x86_64 (ceph)
[ceph-test-2][WARNIN]            Requires: libfcgi.so.0()(64bit)
[ceph-test-2][WARNIN] Error: Package: 2:ceph-common-10.2.11-0.el7.x86_64 (ceph)
[ceph-test-2][WARNIN]            Requires: libbabeltrace.so.1()(64bit)
[ceph-test-2][WARNIN] Error: Package: 2:librados2-10.2.11-0.el7.x86_64 (ceph)
[ceph-test-2][WARNIN]            Requires: liblttng-ust.so.0()(64bit)
[ceph-test-2][DEBUG ]  You could try running: rpm -Va --nofiles --nodigest
[ceph-test-2][ERROR ] RuntimeError: command returned non-zero exit status: 1
[ceph_deploy][ERROR ] RuntimeError: Failed to execute command: yum -y install ceph

安装依赖包

yum install epel-release python2-pip snappy leveldb  gdisk python-argparse gperftools-libs librados2 librbd1 boost-regex librgw2 ceph-common python-flask python-itsdangerous python-werkzeug -y

报错3

ImportError: No module named apipkg

pip install distribute

报错4

ImportError: No module named pkg_resources

pip install apipkg

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容