通過ceph-deploy搭建ceph 13.2.5 mimic

一、ceph介紹

  1. 操作系統需要內核版本在kernel 3.10+或CentOS7以上版本中部署
  2. 通過deploy工具安裝簡化部署過程,本文中選用的ceph-deploy版本為1.5.39
  3. 至少準備6個環境,分別為1個ceph-admin管理節點、3個mon/mgr/mds節點、2個osd節點

二、ceph安裝

1. 部署ceph-admin

  • a) 配置主機名,配置hosts文件。
shell> hostnamectl --static set-hostname shyt-ceph-admin
shell> cat /etc/hosts
10.52.0.181 shyt-ceph-mon1
10.52.0.182 shyt-ceph-mon2
10.52.0.183 shyt-ceph-mon3
10.52.0.201 shyt-ceph-osd-node1
10.52.0.202 shyt-ceph-osd-node2
  • b) 生成ssh key文件并復制到各個節點
shell> ssh-keygen 
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa): 
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:TvZDQwvZpIKFAeSyh8Y1QhEOG9EzKaHaNN1rMl8kxfI root@shyt-ceph-admin
The key's randomart image is:
+---[RSA 2048]----+
|=O=o.o... .      |
|*+=..+...=      |
|+++=o +o= o      |
|o*o..  =Eo .    |
|+oo o o S +      |
|..  = = o .    |
|      . . o      |
|          .    |
|                |
+----[SHA256]-----+shell> ssh-copy-id shyt-ceph-mon1
shell> ssh-copy-id shyt-ceph-mon2
shell> ssh-copy-id shyt-ceph-mon3
shell> ssh-copy-id shyt-ceph-osd-node1
shell> ssh-copy-id shyt-ceph-osd-node2
  • c) 安裝ceph-deploy
# 修改本地yum源
shell> wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
shell> yum clean all
shell> yum makecacheshell> yum -y install https://mirrors.aliyun.com/ceph/rpm-mimic/el7/noarch/ceph-deploy-1.5.39-0.noarch.rpm
shell> ceph-deploy --version
1.5.39
  • d) 創建部署目錄
shell> mkdir deploy_ceph_cluster && cd deploy_ceph_cluster

2. 部署mon/mgr/mds節點

  • a) 配置主機名
shell> hostnamectl --static set-hostname shyt-ceph-mon1
  • b) 修改yum源
shell> wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
shell> wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
shell> yum clean all
shell> yum makecache
  • c) 創建Ceph Monitor節點(在ceph-admin中執行)
# 生成ceph配置文件、monitor秘鑰文件以及部署日志文件。
shell> ceph-deploy new shyt-ceph-mon1 shyt-ceph-mon2 shyt-ceph-mon3
  • d) 在ceph.conf配置中增加以下信息(注釋版詳見附件)
shell> cat /etc/ceph/ceph.conf
[global]osd pool default size = 3osd pool default min size = 1public network = 10.52.0.0/24cluster network = 10.52.0.0/24cephx require signatures = truecephx cluster require signatures = truecephx service require signatures = truecephx sign messages = true[mon]mon data size warn = 15*1024*1024*1024mon data avail warn = 30mon data avail crit = 10# 由于ceph集群中存在異構PC,導致時鐘偏移總是大于默認0.05s,為了方便同步直接把時鐘偏移設置成0.5smon clock drift allowed = 2mon clock drift warn backoff = 30mon allow pool delete = truemon osd allow primary affinity = true[osd]osd journal size = 10000osd mkfs type = xfsosd max write size = 512osd client message size cap = 2147483648osd deep scrub stride = 131072osd op threads = 16osd disk threads = 4osd map cache size = 1024osd map cache bl size = 128#osd mount options xfs = "rw,noexec,nodev,noatime,nodiratime,nobarrier"osd recovery op priority = 5osd recovery max active = 10osd max backfills = 4osd min pg log entries = 30000osd max pg log entries = 100000osd mon heartbeat interval = 40ms dispatch throttle bytes = 148576000objecter inflight ops = 819200osd op log threshold = 50osd crush chooseleaf type = 0filestore xattr use omap = truefilestore min sync interval = 10filestore max sync interval = 15filestore queue max ops = 25000filestore queue max bytes = 1048576000filestore queue committing max ops = 50000filestore queue committing max bytes = 10485760000filestore split multiple = 8filestore merge threshold = 40filestore fd cache size = 1024filestore op threads = 32journal max write bytes = 1073714824journal max write entries = 10000journal queue max ops = 50000journal queue max bytes = 10485760000[mds]debug ms = 1/5[client]rbd cache = truerbd cache size = 335544320rbd cache max dirty = 134217728rbd cache max dirty age = 30rbd cache writethrough until flush = falserbd cache max dirty object = 2rbd cache target dirty = 235544320
  • e) 安裝ceph軟件包
shell> ceph-deploy install shyt-ceph-mon1 shyt-ceph-mon2 shyt-ceph-mon3 \
--release mimic \
--repo-url http://mirror.tuna.tsinghua.edu.cn/ceph/rpm-mimic/el7/ \
--gpg-url http://mirror.tuna.tsinghua.edu.cn/ceph/keys/release.asc
  • f) 配置初始monitor、并收集所有密鑰
shell> ceph-deploy mon create-initial
  • g) 分發配置文件
# 通過ceph-deploy將配置文件以及密鑰拷貝至其他節點,使得不需要指定mon地址以及用戶信息就可以直接管理我們的ceph集群
shell> ceph-deploy admin shyt-ceph-mon1 shyt-ceph-mon2 shyt-ceph-mon3
  • h)配置mgr
# 運行ceph health,打印
# HEALTH_WARN no active mgr
# 自從ceph 12開始,manager是必須的,應該為每個運行monitor的機器添加一個mgr,否則集群處于WARN狀態。
shell> ceph-deploy mgr create shyt-ceph-mon1:cephsvr-16101 shyt-ceph-mon2:cephsvr-16102 shyt-ceph-mon3:cephsvr-16103# 提示:當ceph-mgr發生故障,相當于整個ceph集群都會出現嚴重問題,
# 建議在每個mon中都創建獨立的ceph-mgr(至少3個ceph mon節點),只需要在每個mon節點參考上面的方法進行創建即可(每個mgr需要不同的獨立命名)。 # 關閉ceph-mgr的方式
shell> systemctl stop ceph-mgr@cephsvr-16101

3. 部署osd節點

  • a) 配置主機名
shell> hostnamectl --static set-hostname shyt-ceph-osd-node1
  • b) 修改yum源
shell> wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
shell> wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
shell> yum clean all
shell> yum makecache
  • c) 安裝ceph軟件包
shell> ceph-deploy install shyt-ceph-osd-node1 shyt-ceph-osd-node2 \
--release mimic \
--repo-url http://mirror.tuna.tsinghua.edu.cn/ceph/rpm-mimic/el7/ \
--gpg-url http://mirror.tuna.tsinghua.edu.cn/ceph/keys/release.asc
  • d) 配置osd節點
shell> ceph-deploy disk zap shyt-ceph-osd-node1:sdb shyt-ceph-osd-node1:sdc shyt-ceph-osd-node1:sdd
shell> ceph-deploy osd create shyt-ceph-osd-node1:sdb shyt-ceph-osd-node1:sdc shyt-ceph-osd-node1:sdd
  • e) 分發配置文件
shell> ceph-deploy admin shyt-ceph-osd-node1 shyt-ceph-osd-node2# 查看ceph osd節點狀態
shell> ceph -s
shell> ceph osd tree

三、啟用Dashboard

  • 在任意節點中執行,開啟dashboard支持
# 啟用dashboard插件
shell> ceph mgr module enable dashboard
# 生成自簽名證書
shell> ceph dashboard create-self-signed-cert
Self-signed certificate created
# 配置dashboard監聽IP和端口
shell> ceph config set mgr mgr/dashboard/server_port 8080
# 配置dashboard認證
shell> ceph dashboard set-login-credentials root 123456
Username and password updated
# 關閉SSL支持,只用HTTP的方式訪問
shell> ceph config set mgr mgr/dashboard/ssl false
# 每個mon節點重啟dashboard使配置生效
shell> systemctl restart ceph-mgr.target
# 瀏覽器訪問 http://10.52.0.181:8080# 查看ceph-mgr服務
shell> ceph mgr services
{"dashboard": "http://shyt-ceph-mon1:8080/"
}

四、創建Ceph MDS角色

1. 安裝ceph mds

# 為防止單點故障,需要部署多臺MDS節點
shell> ceph-deploy mds create shyt-ceph-mon1 shyt-ceph-mon2 shyt-ceph-mon3

2、手動創建data和metadata池

shell> ceph osd pool create data 128 128
shell> ceph osd pool create metadata 128 128
shell> ceph fs new cephfs metadata data
shell> ceph mds stat
cephfs-1/1/1 up {0=shyt-ceph-mon3=up:active}, 2 up:standby

3、掛載cephfs文件系統

shell> wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
shell> wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
shell> cat >> /etc/yum.repos.d/ceph.repo << EOF
[ceph]
name=Ceph packages for $basearch
baseurl=http://mirror.tuna.tsinghua.edu.cn/ceph/rpm-mimic/el7/$basearch
enabled=1
gpgcheck=1
priority=1
type=rpm-md
gpgkey=http://mirror.tuna.tsinghua.edu.cn/ceph/keys/release.asc[ceph-noarch]
name=Ceph noarch packages
baseurl=http://mirror.tuna.tsinghua.edu.cn/ceph/rpm-mimic/el7/noarch
enabled=1
gpgcheck=1
priority=1
type=rpm-md
gpgkey=http://mirror.tuna.tsinghua.edu.cn/ceph/keys/release.asc[ceph-source]
name=Ceph source packages
baseurl=http://mirror.tuna.tsinghua.edu.cn/ceph/rpm-mimic/el7/SRPMS
enabled=0
gpgcheck=1
type=rpm-md
gpgkey=http://mirror.tuna.tsinghua.edu.cn/ceph/keys/release.asc
priority=1EOFshell> yum clean all
shell> yum makecache
shell> yum -y install https://mirrors.aliyun.com/ceph/rpm-mimic/el7/x86_64/ceph-fuse-13.2.5-0.el7.x86_64.rpm
# 創建ceph目錄,將ceph.client.admin.keyring和ceph.conf文件拷貝到該目錄下。
shell> mkdir /etc/ceph/
# 創建掛載目錄
shell> mkdir /storage
shell> ceph-fuse /storage
# 加入開機啟動項
shell> echo "ceph-fuse /storage" >> /etc/rc.d/rc.local

轉載于:https://www.cnblogs.com/91donkey/p/10938488.html

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/386732.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/386732.shtml
英文地址,請注明出處:http://en.pswp.cn/news/386732.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

openstack服務編排

heat列出所有組件時報錯 ERROR: 503 Service Unavailable The server is currently unavailable. Please try again at a later time. 錯誤&#xff1a;503服務不可用 cu錯 w誤 &#xff1a; 5 0 3 f服 w務 b不 kě可 yng用 The server is currently unavailable. Please tr…

phpstudy如何安裝景安ssl證書 window下apache服務器網站https訪問

1. 下載景安免費證書 https://www.zzidc.com/help/helpDetail?id555 2.文件解壓上傳至服務器&#xff0c;位置自己決定 3. 調整apache配置 景安原文鏈接&#xff1a;https://www.zzidc.com/help/helpDetail?id555 ① 確保你的apache編譯了ssl模塊&#xff0c;這是支持ssl證書…

docker下gitlab安裝配置使用(完整版)

docker下gitlab安裝配置使用(完整版) 22018.12.16 00:07:57字數 737閱讀 17595 docker 安裝gitlab以及使用 一、安裝及配置 1.gitlab鏡像拉取 # gitlab-ce為穩定版本&#xff0c;后面不填寫版本則默認pull最新latest版本 $ docker pull gitlab/gitlab-ce拉取鏡像 2.運行g…

hdfs的特性、命令、安全模式、基準測試

1.第一點&#xff1a;如何理解hdfs分布式文件系統&#xff0c;每臺機器出一塊磁盤&#xff0c;湊成一個大的硬盤&#xff0c;大的硬盤的容量來自各個服務器的硬盤容量之和。 你出5毛&#xff0c;我出5毛&#xff0c;大家湊成1塊。 2. HDFS 是 Hadoop Distribute File System 的…

如何push一個docker鏡像到DockerHub上

如何push一個docker鏡像到DockerHub上 2018.01.03 11:31:39字數 139閱讀 202 有時候想要保存自己的docker鏡像&#xff0c;又不想自己搭建docker registry&#xff0c;那么就可以了借用DockerHub來用&#xff0c;一般不會有多少人在意你的鏡像&#xff0c;不過萬一被人看上了…

測開2 - Python(文件操作)

把第一次寫好漏掉的點寫在最前面&#xff1a;文件讀寫的內容都要求是字符串。 幾種文件操作的模式&#xff1a; 1. r&#xff0c;讀模式&#xff08;默認模式&#xff09;&#xff0c;只能讀不能寫&#xff0c;文件不存在時報錯 2. w&#xff0c;寫模式&#xff0c;只能寫不能讀…

使用docker在CentOS7上搭建WordPress

前言 本文基于Centos 7 環境的docker搭建操作&#xff0c;centos 7 用 firewalld 替換了iptables作為默認防火墻操作&#xff0c;但以前習慣了iptables 就不與時俱進了。 環境準備 systemctl disable firewalld systemctl stop firewalld setenforce 0 sed -i "s/SELIN…

企業級應用,如何實現服務化一(項目架構演化)

1.企業級應用架構演化 1.1.架構演化圖 1.2.文字描述 #單一應用架構當網站流量很小時&#xff0c;只需一個應用&#xff0c;將所有功能都部署在一起&#xff0c;以減少部署節點和成本#垂直應用架構當訪問量逐漸增大&#xff0c;單一應用增加機器帶來的加速度越來越小&#xff0c…

Alpine 操作系統是一個面向安全的輕型 Linux 發行版

Alpine 操作系統是一個面向安全的輕型 Linux 發行版。它不同于通常 Linux 發行版&#xff0c;Alpine 采用了 musl libc 和 busybox 以減小系統的體積和運行時資源消耗&#xff0c;但功能上比 busybox 又完善的多&#xff0c;因此得到開源社區越來越多的青睞。在保持瘦身的同時&…

ASP.NET MVC Filter過濾機制(過濾器、攔截器)

https://blog.csdn.net/knqiufan/article/details/82413885 本文為博主原創文章&#xff0c;未經博主允許不得轉載。 https://blog.csdn.net/knqiufan/article/details/82413885參考文章&#xff1a;1、https://www.cnblogs.com/webapi/p/5669057.html 2、htt…

elk docker

換了個運行環境,重新搭建一套公司本地內部的ELK,之前也搭過(可訪問:https://yanganlin.com/31.html),最近做什么事情都想用Docker,這次也用Docker,還算順利,沒掉什么坑里,上次搭建,也用用的6.2的版本,這都過了一年,Elk這三個產品,都已經上7了,用docker搭建的還是用6.2.4,穩定不…

LeetCode Largest Number

1231231轉載于:https://www.cnblogs.com/ZHONGZHENHUA/p/10954249.html

有個需求mybatis?插入的時候不知道有哪些字段,需要動態的傳入值和字段

有個需求mybatis 插入的時候不知道有哪些字段&#xff0c;需要動態的傳入值和字段&#xff0c; Java code? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 Test public void testAddProductGuaranty() { //1 560 50000 2014/10/2 0:00:00 2014/11/1 0…

readonly的用法

轉載于:https://www.cnblogs.com/w123w/p/10958567.html

mybatis insert 動態生成插入的列及插入的值

代碼如下 &#xff1a; 1.mapper.xml 文件 <?xml version"1.0" encoding"UTF-8"?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper name…

loj2245 [NOI2014]魔法森林 LCT

[NOI2014]魔法森林 鏈接 loj 思路 a排序&#xff0c;b做動態最小生成樹。 把邊拆成點就可以了。 uoj98.也許lct復雜度寫假了、、越卡常&#xff0c;越慢 代碼 #include <bits/stdc.h> #define ls c[x][0] #define rs c[x][1] using namespace std; const int N 2e5 7; …

Jenkins發布spring boot到hub.Docker 方法

在生成的目錄下&#xff0c;建立個文件&#xff0c;文件名稱為&#xff1a;Dockerfile FROM java:8 VOLUME /tmp ADD target/assignment-0.0.1-SNAPSHOT.jar /dalaoyang.jar ENTRYPOINT ["java","-Djava.security.egdfile:/dev/./urandom","-jar&q…

網頁視頻直播、微信視頻直播技術解決方案:EasyNVR與EasyDSS流媒體服務器組合之區分不同場景下的直播接入需求...

背景分析 熟悉EasyNVR產品的朋友們都知道&#xff0c;EasyNVR不僅可以獨成體系&#xff0c;而且還可以跟其他系列產品相配合&#xff0c;形成各種不同類型的解決方案&#xff0c;滿足各種不同應用場景的實際需求。針對很多設備現場沒有固定公網IP&#xff0c;但是又想實現公網、…

如何解決VMware Workstation 10.0.0 build-1295980馬賽克現象

VMware Workstation 10.0.0 build-1295980偶爾出現客戶機馬賽克現象&#xff0c;可切換至其它選項卡&#xff0c;再切換回去即可。 還有一種方式是關閉加速3D圖形。 轉載于:https://www.cnblogs.com/rms365/p/10961499.html

不同賬號間的云資源授權方法

阿里云的訪問控制RAM產品可以實現資源的分配和授權,在一個特殊的業務背景下,資源也可以實現跨賬號的授權使用. 背景: 1.A公司,作為甲方Party A,出資購買云資源,對云資源具有所有權,但不實際管理,需要乙方配合. 2.B公司,作為乙方Party B,要管理A公司的云資源,需要A公司授權云資…