手动安装 Ceph

下面的过程说明了手动安装 Ceph 存储集群时需要使用的命令。

  1. 为要运行的 Ceph 服务生成密钥机密。可以使用下面的命令生成密钥机密:

    python -c "import os ; import struct ; import time; import base64 ; \
     key = os.urandom(16) ; header = struct.pack('<hiih',1,int(time.time()),0,len(key)) ; \
     print base64.b64encode(header + key)"
  2. 将密钥添加到相关的密钥环。添加顺序依次为 client.admin、监视器、其他相关服务(例如 OSD、对象网关或 MDS):

    ceph-authtool -n client.admin \
     --create-keyring /etc/ceph/ceph.client.admin.keyring \
     --cap mds 'allow *' --cap mon 'allow *' --cap osd 'allow *'
    ceph-authtool -n mon. \
     --create-keyring /var/lib/ceph/bootstrap-mon/ceph-osceph-03.keyring \
     --set-uid=0 --cap mon 'allow *'
    ceph-authtool -n client.bootstrap-osd \
     --create-keyring /var/lib/ceph/bootstrap-osd/ceph.keyring \
     --cap mon 'allow profile bootstrap-osd'
    ceph-authtool -n client.bootstrap-rgw \
     --create-keyring /var/lib/ceph/bootstrap-rgw/ceph.keyring \
     --cap mon 'allow profile bootstrap-rgw'
    ceph-authtool -n client.bootstrap-mds \
     --create-keyring /var/lib/ceph/bootstrap-mds/ceph.keyring \
     --cap mon 'allow profile bootstrap-mds'
  3. 创建 monmap,这是集群中所有监视器的数据库:

    monmaptool --create --fsid eaac9695-4265-4ca8-ac2a-f3a479c559b1 \
     /tmp/tmpuuhxm3/monmap
    monmaptool --add osceph-02 192.168.43.60 /tmp/tmpuuhxm3/monmap
    monmaptool --add osceph-03 192.168.43.96 /tmp/tmpuuhxm3/monmap
    monmaptool --add osceph-04 192.168.43.80 /tmp/tmpuuhxm3/monmap
  4. 在该数据库中创建新的密钥环,并从管理员和监视器的密钥环导入密钥。然后使用密钥环来启动监视器:

    ceph-authtool --create-keyring /tmp/tmpuuhxm3/keyring \
     --import-keyring /var/lib/ceph/bootstrap-mon/ceph-osceph-03.keyring
    ceph-authtool /tmp/tmpuuhxm3/keyring \
     --import-keyring /etc/ceph/ceph.client.admin.keyring
    sudo -u ceph ceph-mon --mkfs -i osceph-03 \
     --monmap /tmp/tmpuuhxm3/monmap --keyring /tmp/tmpuuhxm3/keyring
    systemctl restart ceph-mon@osceph-03
  5. 在 systemd 中检查监视器状态:

    systemctl show --property ActiveState ceph-mon@osceph-03
  6. 检查 Ceph 是否正在运行并报告监视器状态:

    ceph --cluster=ceph \
     --admin-daemon /var/run/ceph/ceph-mon.osceph-03.asok mon_status
  7. 使用现有密钥检查特定服务的状态:

    ceph --connect-timeout 5 --keyring /etc/ceph/ceph.client.admin.keyring \
     --name client.admin -f json-pretty status
    [...]
    ceph --connect-timeout 5 \
     --keyring /var/lib/ceph/bootstrap-mon/ceph-osceph-03.keyring \
     --name mon. -f json-pretty status
  8. 从现有 Ceph 服务中导入密钥环并检查状态:

    ceph auth import -i /var/lib/ceph/bootstrap-osd/ceph.keyring
    ceph auth import -i /var/lib/ceph/bootstrap-rgw/ceph.keyring
    ceph auth import -i /var/lib/ceph/bootstrap-mds/ceph.keyring
    ceph --cluster=ceph \
     --admin-daemon /var/run/ceph/ceph-mon.osceph-03.asok mon_status
    ceph --connect-timeout 5 --keyring /etc/ceph/ceph.client.admin.keyring \
     --name client.admin -f json-pretty status
  9. 使用 XFS 文件系统为 OSD 准备磁盘/分区:

    ceph-disk -v prepare --fs-type xfs --data-dev --cluster ceph \
     --cluster-uuid eaac9695-4265-4ca8-ac2a-f3a479c559b1 /dev/vdb
    ceph-disk -v prepare --fs-type xfs --data-dev --cluster ceph \
     --cluster-uuid eaac9695-4265-4ca8-ac2a-f3a479c559b1 /dev/vdc
    [...]
  10. 激活分区:

    ceph-disk -v activate --mark-init systemd --mount /dev/vdb1
    ceph-disk -v activate --mark-init systemd --mount /dev/vdc1
  11. 如果 SUSE Enterprise Storage 为 2.1 或更低版本,请创建默认存储池:

    ceph --connect-timeout 5 --keyring /etc/ceph/ceph.client.admin.keyring \
     --name client.admin osd pool create .users.swift 16 16
    ceph --connect-timeout 5 --keyring /etc/ceph/ceph.client.admin.keyring \
     --name client.admin osd pool create .intent-log 16 16
    ceph --connect-timeout 5 --keyring /etc/ceph/ceph.client.admin.keyring \
     --name client.admin osd pool create .rgw.gc 16 16
    ceph --connect-timeout 5 --keyring /etc/ceph/ceph.client.admin.keyring \
     --name client.admin osd pool create .users.uid 16 16
    ceph --connect-timeout 5 --keyring /etc/ceph/ceph.client.admin.keyring \
     --name client.admin osd pool create .rgw.control 16 16
    ceph --connect-timeout 5 --keyring /etc/ceph/ceph.client.admin.keyring \
     --name client.admin osd pool create .users 16 16
    ceph --connect-timeout 5 --keyring /etc/ceph/ceph.client.admin.keyring \
     --name client.admin osd pool create .usage 16 16
    ceph --connect-timeout 5 --keyring /etc/ceph/ceph.client.admin.keyring \
     --name client.admin osd pool create .log 16 16
    ceph --connect-timeout 5 --keyring /etc/ceph/ceph.client.admin.keyring \
     --name client.admin osd pool create .rgw 16 16
  12. 根据引导密钥创建对象网关实例密钥:

    ceph --connect-timeout 5 --cluster ceph --name client.bootstrap-rgw \
     --keyring /var/lib/ceph/bootstrap-rgw/ceph.keyring auth get-or-create \
     client.rgw.0dc1e13033d2467eace46270f0048b39 osd 'allow rwx' mon 'allow rw' \
     -o /var/lib/ceph/radosgw/ceph-rgw.rgw_name/keyring
  13. 启用并启动对象网关:

    systemctl enable ceph-radosgw@rgw.rgw_name
    systemctl start ceph-radosgw@rgw.rgw_name
  14. (可选)根据引导密钥创建 MDS 实例密钥,然后启用并启动它:

    ceph --connect-timeout 5 --cluster ceph --name client.bootstrap-mds \
     --keyring /var/lib/ceph/bootstrap-mds/ceph.keyring auth get-or-create \
     mds.mds.rgw_name osd 'allow rwx' mds allow mon \
     'allow profile mds' \
     -o /var/lib/ceph/mds/ceph-mds.rgw_name/keyring
    systemctl enable ceph-mds@mds.rgw_name
    systemctl start ceph-mds@mds.rgw_name
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值