zoukankan      html  css  js  c++  java
  • CentOS8.2同步阿里云Ceph镜像到本地,本地搭建ceph仓库

    测试环境介绍

    Yum源服务 Ceph客户端
    主机名 yumserver ceph
    IP信息 192.168.6.178 192.168.6.159

    1、安装依赖服务

    dnf -y install  yum-utils createrepo
    

    2、下载阿里云镜像cepo.repo文件

    [root@ceph ceph]# cat /etc/yum.repos.d/ceph.repo
    [ceph]
    name=ceph
    baseurl=http://mirrors.aliyun.com/ceph/rpm-nautilus/el8/x86_64/
    gpgcheck=0
    priority=1
    
    [ceph-noarch]
    name=ceph-noarch
    baseurl=http://mirrors.aliyun.com/ceph/rpm-nautilus/el8/noarch/
    gpgcheck=0
    priority=1
    
    [ceph-source]
    name=ceph-source
    baseurl=http://mirrors.aliyun.com/ceph/rpm-nautilus/el8/SRPMS
    gpgcheck=0
    priority=1
    

    3、刷新缓存,元数据缓存建立

    dnf clean all
    dnf makecache
    dnf repolist
    

    4、同步镜像到本地

    
    
    
    [root@yumserver /]# mkdir -p /data/ceph/ceph
    [root@yumserver /]# reposync -p /data/ceph/ceph -n --repoid=ceph
    ceph                                                                              9.7 kB/s | 1.5 kB     00:00    
    (1/55): ceph-14.2.15-0.el8.x86_64.rpm                                              87 kB/s | 6.3 kB     00:00    
    (2/55): ceph-base-14.2.15-0.el8.x86_64.rpm                                        9.5 MB/s | 5.4 MB     00:00    
    (3/55): ceph-common-14.2.15-0.el8.x86_64.rpm                                      6.5 MB/s |  20 MB     00:02    
    (4/55): ceph-debugsource-14.2.15-0.el8.x86_64.rpm                                 5.8 MB/s | 9.1 MB     00:01    
    (5/55): ceph-fuse-14.2.15-0.el8.x86_64.rpm                                        192 kB/s | 593 kB     00:03    
    (6/55): ceph-base-debuginfo-14.2.15-0.el8.x86_64.rpm                              8.2 MB/s | 103 MB     00:12    
    (7/55): ceph-mds-14.2.15-0.el8.x86_64.rpm                                         6.3 MB/s | 2.0 MB     00:00    
    (8/55): ceph-fuse-debuginfo-14.2.15-0.el8.x86_64.rpm                              996 kB/s |  12 MB     00:12    
    (9/55): ceph-mds-debuginfo-14.2.15-0.el8.x86_64.rpm                               9.2 MB/s |  69 MB     00:07    
    (10/55): ceph-mgr-14.2.15-0.el8.x86_64.rpm                                        2.8 MB/s | 1.6 MB     00:00    
    (11/55): ceph-mon-14.2.15-0.el8.x86_64.rpm                                        4.7 MB/s | 4.5 MB     00:00    
    (12/55): ceph-mgr-debuginfo-14.2.15-0.el8.x86_64.rpm                              6.4 MB/s |  36 MB     00:05    
    
    
    [root@yumserver /]# mkdir -p /data/ceph/cephnoarch
    [root@yumserver /]# reposync -p /data/ceph/cephnoarch -n --repoid=ceph-noarch
    ceph-noarch                                                                        10 kB/s | 1.5 kB     00
    (1/8): ceph-grafana-dashboards-14.2.15-0.el8.noarch.rpm                           145 kB/s |  24 kB     00
    (2/8): ceph-mgr-diskprediction-cloud-14.2.15-0.el8.noarch.rpm                     235 kB/s |  41 kB     00
    (3/8): ceph-mgr-k8sevents-14.2.15-0.el8.noarch.rpm                                198 kB/s |  23 kB     00
    (4/8): ceph-mgr-diskprediction-local-14.2.15-0.el8.noarch.rpm                     4.4 MB/s | 1.1 MB     00
    (5/8): ceph-mgr-rook-14.2.15-0.el8.noarch.rpm                                     120 kB/s |  15 kB     00
    (6/8): ceph-release-1-1.el8.noarch.rpm                                             67 kB/s | 7.2 kB     00
    (7/8): ceph-mgr-ssh-14.2.15-0.el8.noarch.rpm                                       95 kB/s |  16 kB     00
    (8/8): ceph-mgr-dashboard-14.2.15-0.el8.noarch.rpm                                2.5 MB/s | 3.7 MB     00
    
    [root@yumserver /]# mkdir -p /data/ceph/cephsource
    [root@yumserver /]# reposync -p /data/ceph/cephsource -n --repoid=ceph-source
    ceph-source                                                               16 kB/s | 1.5 kB     00:00    
    (1/2): ceph-release-1-1.el8.src.rpm                                       42 kB/s | 7.2 kB     00:00    
    (2/2): ceph-14.2.15-0.el8.src.rpm                                         17 MB/s | 101 MB     00:05    
    [root@yumserver /]# 
    
    
    
    

    5、创建YUM仓库

    [root@yumserver ceph]# createrepo -pdo /data/ceph/ceph/ceph /data/ceph/ceph/ceph
    Directory walk started
    Directory walk done - 55 packages
    Temporary output repo path: /data/ceph/ceph/ceph/.repodata/
    Preparing sqlite DBs
    Pool started (with 5 workers)
    Pool finished
    [root@yumserver ceph]# 
    
    
    
    [root@yumserver ceph-noarch]# createrepo -pdo  /data/ceph/cephnoarch/ceph-noarch /data/ceph/cephnoarch/ceph-noarch
    Directory walk started
    Directory walk done - 8 packages
    Temporary output repo path: /data/ceph/cephnoarch/ceph-noarch/.repodata/
    Preparing sqlite DBs
    Pool started (with 5 workers)
    Pool finished
    
    [root@yumserver ceph-source]# createrepo -pdo /data/ceph/cephsource/ceph-source /data/ceph/cephsource/ceph-source
    Directory walk started
    Directory walk done - 2 packages
    Temporary output repo path: /data/ceph/cephsource/ceph-source/.repodata/
    Preparing sqlite DBs
    Pool started (with 5 workers)
    Pool finished
    
    
    
    
    
    

    6、安装nginx,搭建本地Web服务器

    [root@yumserver /]#  dnf -y install nginx
    
    在/etc/nginx/conf.d/下面创建repos.conf配置文件
    
    [root@ceph ceph-source]# cat  /etc/nginx/conf.d/repos.conf
    server {
        listen        80;
        server_name   _;
    
        # 404 错误页面重定向配置
        error_page  404  /404.html;
    
        # 50x 错误页面重定项配置
        error_page   500 503 504  /50x.html;
    
        error_log    /var/log/nginx/repos_error.log;
        access_log   /var/log/nginx/repos_access.log;
    
        root /data/ceph/;
    
        location / {
            autoindex on;
        }
    
        location = /50x.html {
            root   /usr/share/nginx/html;
        }
    
        location = /404.html {
            root   /usr/share/nginx/html;
        }
    }
    
    
    修改 /etc/nginx/nginx.conf 注释掉nginx默认的80端口服务:
    #    server {
    #        listen       80 default_server;
    #        listen       [::]:80 default_server;
    #        server_name  _;
    #        root         /usr/share/nginx/html;
    
    #        root         /cephyum;
    
            # Load configuration files for the default server block.
    #        include /etc/nginx/default.d/*.conf;
    
    #        location / {
    #        }
    
    #        error_page 404 /404.html;
    #            location = /40x.html {
    #        }
    
    #        error_page 500 502 503 504 /50x.html;
    #            location = /50x.html {
    #        }
    #    }
    
    
    重启nginx服务或让nginx重新加载配置
    systemctl restart nginx.service
    #或
    systemctl reload nginx.service
    

    7、修改ceph YUM仓库配置

    登录到ceph主机:192.168.6.159
    
    [root@ceph ceph]# cat /etc/yum.repos.d/ceph.repo
    [ceph]
    name=ceph
    baseurl=http://192.168.6.178/ceph/ceph/
    gpgcheck=0
    priority=1
    
    [ceph-noarch]
    name=ceph-noarch
    baseurl=http://192.168.6.178/cephnoarch/ceph-noarch/
    gpgcheck=0
    priority=1
    
    [ceph-source]
    name=ceph-source
    baseurl=http://192.168.6.178/cephsource/ceph-source/
    gpgcheck=0
    priority=1
    
    
    #####################刷新缓存
    dnf clean all
    dnf makecache
    dnf repolist
    
    

    8、客户端安装ceph测试部署

    #!/bin/bash
    #ceph一键部署脚本
    #for Centos7
    #1.disable iptables&selinux
     
    echo -n "正在配置iptables防火墙……"
    systemctl stop firewalld > /dev/null 2>&1
    systemctl disable firewalld  > /dev/null 2>&1
    if [ $? -eq 0 ];then
    echo -n "Iptables防火墙初始化完毕!"
    fi
     
    echo -n "正在关闭SELinux……"
    setenforce 0 > /dev/null 2>&1
    sed -i '/^SELINUX=/s/=.*/=disabled/' /etc/selinux/config
    if [ $? -eq 0 ];then
            echo -n "SELinux初始化完毕!"
    fi
    #2.set hostname as ceph##
     
    HOSTNAME=ceph
    hostnamectl set-hostname ceph
    IP=`ip route |grep src|grep metric|awk -F" " '{ print $9 }'`
    echo "$IP $HOSTNAME" >>/etc/hosts
    #3.install epel.repo#
    #yum install -y epel-release
     
    cat <<EOF > /etc/yum.repos.d/ceph.repo
    [ceph]
    name=ceph
    baseurl=http://192.168.6.178/ceph/ceph/
    gpgcheck=0
    priority=1
    
    [ceph-noarch]
    name=ceph-noarch
    baseurl=http://192.168.6.178/cephnoarch/ceph-noarch/
    gpgcheck=0
    priority=1
    
    [ceph-source]
    name=ceph-source
    baseurl=http://192.168.6.178/cephsource/ceph-source/
    gpgcheck=0
    priority=1
     
    EOF
     
     
     
    ceph-deploy是用于快速部署集群的工具。
    重要:不再维护ceph-deploy。未在Nautilus之前的Ceph版本上进行测试。它不支持RHEL8,CentOS 8或更新的操作系统。 
     
     
    dnf clean all && dnf -y install ceph  
    
    
    说明:本文只介绍ceph这个包,后面会讲解ceph集群部署
    
    

    ceph安装完毕

    广告时间:


    • 关于我 :全国7*24高效代维服务
    • 微信:lianglab
    • QQ:867266199
    • 淘宝店全国7*24高效代维服务
    • 全国高效代维:为中小型企业,提供云计算咨询代维、架构设计、降低成本。
  • 相关阅读:
    为知笔记使用备注
    困惑激发的正能量
    再多坚持一会,相信自己就好!
    看博文《前路漫漫,何为终点?》的一点小感想
    前端的杂谈
    JS 客户端检测
    DOM
    JavaScript & XML
    我所认识的XPath
    Javascript 面向对象编程
  • 原文地址:https://www.cnblogs.com/lianglab/p/14100048.html
Copyright © 2011-2022 走看看