基于CentOS 7.3 安装Ceph Jewel 10.2.9
https://www.lijiawang.org/posts/intsall-ceph.html
配置说明:
采用了4台centos7.3系统的虚拟机,1台Ceph-Master作为安装节点,NTP Server;3台Ceph节点,既作为OSD节点,也作为Monitor节点。每个OSD节点有6个盘:300G的系统盘,3个2TB作为SATA池的OSD,800GB作为SSD池的OSD,240GB SSD盘作为日志盘。
环境准备
这里安装centos7.3的操作系统我就不多说了,下面我说一下环境准备工作。
1.检查操作系统的版本
1
2
|
# cat /etc/redhat-release
CentOS Linux release 7.3.1611 (Core)
|
2.查看系统内核版本
1
2
|
# uname -r
3.10.0-514.26.2.el7.x86_64
|
3.关闭防火墙和selinux
1
2
3
4
|
sed -i 's/SELINUX=.*/SELINUX=disabled/' /etc/selinux/config
setenforce 0
systemctl stop firewalld
systemctl disable firewalld
|
4.查看设备信息(所有的OSD
节点)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 300G 0 disk
├─sda1 8:1 0 1G 0 part /boot
└─sda2 8:2 0 299G 0 part
├─cl-root 253:0 0 50G 0 lvm /
├─cl-swap 253:1 0 2G 0 lvm [SWAP]
└─cl-home 253:2 0 247G 0 lvm /home
sdb 8:16 0 2T 0 disk
sdc 8:32 0 2T 0 disk
sdd 8:48 0 2T 0 disk
sde 8:64 0 800G 0 disk
sdf 8:80 0 240G 0 disk
sr0 11:0 1 1024M 0 rom
|
5.查看网卡配置(所有OSD
节点)
1
2
3
4
5
6
7
8
9
10
11
12
13
|
# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 00:0c:29:06:c8:a4 brd ff:ff:ff:ff:ff:ff
inet 172.16.0.11/24 brd 172.16.0.255 scope global eth0
valid_lft forever preferred_lft forever
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 00:0c:29:06:c8:ae brd ff:ff:ff:ff:ff:ff
inet 192.168.0.11/24 brd 192.168.0.255 scope global eth1
valid_lft forever preferred_lft forever
|
6.在所有节点配置hosts
解析
1
2
3
4
|
172.16.0.10 ceph-master
172.16.0.11 ceph-node-1
172.16.0.12 ceph-node-2
172.16.0.13 ceph-node-3
|
7.安装基础的软件包(所有节点)
1
|
yum install tree nmap sysstat lrzsz dos2unix wegt git net-tools -y
|
8.建立SSH
通信(在ceph-master
节点上执行)
(1)生成秘钥文件
1
|
ssh-keygen -t rsa
|
(2)拷贝秘钥文件
1
2
3
4
|
ssh-copy-id root@ceph-master
ssh-copy-id root@ceph-node-1
ssh-copy-id root@ceph-node-2
ssh-copy-id root@ceph-node-3
|
环境准备基本完成
配置NTP
服务
首先我们要在所有的节点上安装NTP
服务
1
|
# yum install -y ntp
|
在CEPH-MASTER
节点上配置
1.修改NTP
配置文件/etc/ntp.conf
1
2
3
4
5
6
7
8
|
# vim /etc/ntp.conf
#server 0.centos.pool.ntp.org iburst
#server 1.centos.pool.ntp.org iburst
#server 2.centos.pool.ntp.org iburst
#server 3.centos.pool.ntp.org iburst
restrict 172.16.0.0 mask 255.255.255.0 nomodify notrap
server 127.127.1.0 minpoll 4
fudge 127.127.1.0 stratum 0
|
2.修改配置文件/etc/ntp/step-tickers
1
2
3
|
# vim /etc/ntp/step-tickers
#0.centos.pool.ntp.org
127.127.1.0
|
3.启动NTP
服务,并设置开机启动
1
|
systemctl enable ntpd ; systemctl start ntpd
|
在所有的OSD
节点配置
1.修改NTP配置文件/etc/ntp.conf
1
2
3
4
5
6
|
# vim /etc/ntp.conf
#server 0.centos.pool.ntp.org iburst
#server 1.centos.pool.ntp.org iburst
#server 2.centos.pool.ntp.org iburst
#server 3.centos.pool.ntp.org iburst
server 172.16.0.10
|
2.启动NTP
服务,并设置开机启动
1
|
systemctl enable ntpd ; systemctl start ntpd
|
验证NTP
在所有节点执行
1
2
3
4
5
|
# ntpq -p
remote refid st t when poll reach delay offset jitter
==============================================================================
*ceph-master .LOCL. 1 u 16 64 377 0.269 0.032 0.269
|
前面有 * 表示已经同步。
安装ceph
####跟新系统源(所有节点执行)
1
2
3
4
5
6
7
8
|
rm -rf /etc/yum.repos.d/*.repo
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
sed -i '/aliyuncs/d' /etc/yum.repos.d/CentOS-Base.repo
sed -i 's/$releasever/7/g' /etc/yum.repos.d/CentOS-Base.repo
sed -i '/aliyuncs/d' /etc/yum.repos.d/epel.repo
yum clean all
yum makecache fast
|
安装CEPH-DEPLOY
以下在ceph-master
节点上执行
1
|
# yum install http://mirrors.163.com/ceph/rpm-jewel/el7/noarch/ceph-deploy-1.5.38-0.noarch.rpm
|
查看CEPH-DEPLOY
版本
1
2
|
# ceph-deploy --version
1.5.38
|
创建CEPH
集群
1
|
ceph-deploy new ceph-node-1 ceph-node-2 ceph-node-3
|
编辑CEPH
配置文件
在global
下添加以下配置:
1
2
3
4
5
|
# vim ceph.conf
[global]
mon_clock_drift_allowed = 5
osd_journal_size = 20480
public_network=172.16.0.0/24
|
安装CEPH
直接指定源地址,不用担心ceph.com
官方源无法下载了。
1
|
ceph-deploy install --release jewel --repo-url http://mirrors.163.com/ceph/rpm-jewel/el7 --gpg-url http://mirrors.163.com/ceph/keys/release.asc ceph-master ceph-node-1 ceph-node-2 ceph-node-3
|
检查CEPH
版本
1
2
|
ceph -v
ceph version 10.2.9 (2ee413f77150c0f375ff6f10edd6c8f9c7d060d0)
|
初始化MOM
节点
1
|
ceph-deploy mon create-initial
|
查看集群状态(在OSD
节点上查看)
1
2
3
4
5
6
7
8
9
10
11
|
# ceph -s
cluster 60597e53-ad29-44bd-8dcd-db6aeae6f580
health HEALTH_ERR
no osds
monmap e2: 3 mons at {ceph-node-1=172.16.0.11:6789/0,ceph-node-2=172.16.0.12:6789/0,ceph-node-3=172.16.0.13:6789/0}
election epoch 6, quorum 0,1,2 ceph-node-1,ceph-node-2,ceph-node-3
osdmap e1: 0 osds: 0 up, 0 in
flags sortbitwise,require_jewel_osds
pgmap v2: 64 pgs, 1 pools, 0 bytes data, 0 objects
0 kB used, 0 kB / 0 kB avail
64 creating
|
配置管理节点ceph-master
为什么每次查看ceph –s
的只能在OSD
节点上执行,而不能在Master
节点上执行?
用ceph-deploy
把配置文件和admin
密钥拷贝到Master
节点
1
|
# ceph-deploy admin ceph-master
|
确保你对ceph.client.admin.keyring
有正确的操作权限
1
|
# chmod +r /etc/ceph/ceph.client.admin.keyring
|
检查集群的健康状况
1
2
3
4
5
6
7
8
9
10
11
|
# ceph -s
cluster 60597e53-ad29-44bd-8dcd-db6aeae6f580
health HEALTH_ERR
no osds
monmap e2: 3 mons at {ceph-node-1=172.16.0.11:6789/0,ceph-node-2=172.16.0.12:6789/0,ceph-node-3=172.16.0.13:6789/0}
election epoch 6, quorum 0,1,2 ceph-node-1,ceph-node-2,ceph-node-3
osdmap e1: 0 osds: 0 up, 0 in
flags sortbitwise,require_jewel_osds
pgmap v2: 64 pgs, 1 pools, 0 bytes data, 0 objects
0 kB used, 0 kB / 0 kB avail
64 creating
|
对OSD
节点配置
磁盘分区
将240G
的SSD
盘分出4
个20G
的分区用作 journal
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
# fdisk /dev/sdf
Welcome to fdisk (util-linux 2.23.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Device does not contain a recognized partition table
Building a new DOS disklabel with disk identifier 0x9ec0a047.
Command (m for help): g
Building a new GPT disklabel (GUID: 31D328DD-E9A0-4306-9C99-8D42F7BA8008)
Command (m for help): n
Partition number (1-128, default 1):
First sector (2048-503316446, default 2048):
Last sector, +sectors or +size{K,M,G,T,P} (2048-503316446, default 503316446): +20G
Created partition 1
Command (m for help): n
Partition number (2-128, default 2):
First sector (41945088-503316446, default 41945088):
Last sector, +sectors or +size{K,M,G,T,P} (41945088-503316446, default 503316446): +20G
Created partition 2
Command (m for help): n
Partition number (3-128, default 3):
First sector (83888128-503316446, default 83888128):
Last sector, +sectors or +size{K,M,G,T,P} (83888128-503316446, default 503316446): +20G
Created partition 3
Command (m for help): n
Partition number (4-128, default 4):
First sector (125831168-503316446, default 125831168):
Last sector, +sectors or +size{K,M,G,T,P} (125831168-503316446, default 503316446): +20G
Created partition 4
Command (m for help): p
Disk /dev/sdf: 257.7 GB, 257698037760 bytes, 503316480 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: gpt
# Start End Size Type Name
1 2048 41945087 20G Linux filesyste
2 41945088 83888127 20G Linux filesyste
3 83888128 125831167 20G Linux filesyste
4 125831168 167774207 20G Linux filesyste
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
|
查看分区
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 300G 0 disk
├─sda1 8:1 0 1G 0 part /boot
└─sda2 8:2 0 299G 0 part
├─cl-root 253:0 0 50G 0 lvm /
├─cl-swap 253:1 0 2G 0 lvm [SWAP]
└─cl-home 253:2 0 247G 0 lvm /home
sdb 8:16 0 2T 0 disk
sdc 8:32 0 2T 0 disk
sdd 8:48 0 2T 0 disk
sde 8:64 0 800G 0 disk
sdf 8:80 0 240G 0 disk
├─sdf1 8:81 0 20G 0 part
├─sdf2 8:82 0 20G 0 part
├─sdf3 8:83 0 20G 0 part
└─sdf4 8:84 0 20G 0 part
sr0 11:0 1 1024M 0 rom
|
修改 JOURNAL
分区权限
1
|
chown ceph:ceph /dev/sdf[1-4]
|
添加OSD
在ceph-master
执行
先部署SATA
1
|
ceph-deploy osd prepare ceph-node-1:/dev/sdb:/dev/sdf1 ceph-node-1:/dev/sdc:/dev/sdf2 ceph-node-1:/dev/sdd:/dev/sdf3 ceph-node-2:/dev/sdb:/dev/sdf1 ceph-node-2:/dev/sdc:/dev/sdf2 ceph-node-2:/dev/sdd:/dev/sdf3 ceph-node-3:/dev/sdb:/dev/sdf1 ceph-node-3:/dev/sdc:/dev/sdf2 ceph-node-3:/dev/sdd:/dev/sdf3
|
再部署SSD
1
|
ceph-deploy osd prepare ceph-node-1:/dev/sde:/dev/sdf4 ceph-node-2:/dev/sde:/dev/sdf4 ceph-node-3:/dev/sde:/dev/sdf4
|
先部署SATA
,再部署SSD
,这样序号就会连续了…
查看集群状态
1
2
3
4
5
6
7
8
9
10
|
# ceph -s
cluster f9dba93b-c40f-4b31-8e6d-6ea830cad944
health HEALTH_OK
monmap e1: 3 mons at {ceph-node-1=172.16.0.11:6789/0,ceph-node-2=172.16.0.12:6789/0,ceph-node-3=172.16.0.13:6789/0}
election epoch 6, quorum 0,1,2 ceph-node-1,ceph-node-2,ceph-node-3
osdmap e56: 12 osds: 12 up, 12 in
flags sortbitwise,require_jewel_osds
pgmap v142: 128 pgs, 1 pools, 0 bytes data, 0 objects
413 MB used, 20821 GB / 20821 GB avail
128 active+clean
|
查看OSD
的分布
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
# ceph osd tree
ID WEIGHT TYPE NAME UP/DOWN REWEIGHT PRIMARY-AFFINITY
-1 20.33363 root default
-2 6.77788 host ceph-node-1
0 1.99899 osd.0 up 1.00000 1.00000
1 1.99899 osd.1 up 1.00000 1.00000
4 1.99899 osd.4 up 1.00000 1.00000
9 0.78090 osd.9 up 1.00000 1.00000
-3 6.77788 host ceph-node-2
2 1.99899 osd.2 up 1.00000 1.00000
3 1.99899 osd.3 up 1.00000 1.00000
5 1.99899 osd.5 up 1.00000 1.00000
10 0.78090 osd.10 up 1.00000 1.00000
-4 6.77788 host ceph-node-3
6 1.99899 osd.6 up 1.00000 1.00000
7 1.99899 osd.7 up 1.00000 1.00000
8 1.99899 osd.8 up 1.00000 1.00000
11 0.78090 osd.11 up 1.00000 1.00000
|
安装完毕
ceph
安装完毕
基于CentOS 7.3 安装Ceph Jewel 10.2.9的更多相关文章
- CentOS 7 x64 安装 Ceph
CentOS 7 x64 安装 Ceph 二, 实验环境 节点 IP 主机名 系统 MON 1 ...
- [转帖]CentOS 7 x64 安装 Ceph
CentOS 7 x64 安装 Ceph https://www.cnblogs.com/jicki/p/5801712.html 改天尝试一下. k8s 可以使用ceph 作为 pv和pvc的后端存 ...
- Ceph Jewel 10.2.3 环境部署
Ceph 测试环境部署 本文档内容概要 测试环境ceph集群部署规划 测试环境ceph集群部署过程及块设备使用流程 mon节点扩容及osd节点扩容方法 常见问题及解决方法 由于暂时没有用到对象存储,所 ...
- CentOS7.0安装Ceph(jewel)及以上版本
背景 由于docker的Ceph插件rexray对Ceph版本有一定的要求,当Ceph版本为hammer (0.94.10)时,rexray无法成功创建rbd设备.CentOS 7及以上版本,默认安装 ...
- 基于centos的docker安装
1. 安装需求 内核版本3.10以上 Centos 7以上 64位版本 2. 使用root登录或者具有sudo权限 3. 确保系统是最新的 yum update 4. 添加yum源 tee /etc/ ...
- CentOS 6.8安装Ceph
机器规划 IP 主机名 角色 10.101.0.1 ceph01 mon admin mds 10.101.0.2 ceph02 ods 10.101.0.3 ceph03 ods 10.101.0. ...
- 基于Centos搭建Maven 安装与使用
CentOS 7.2 64 位操作系统 安装 Maven Maven 简介 Apache Maven 是一个软件项目管理及自动构建工具,由 Apache 软件基金会所提供.基于项目对象模型(缩写:PO ...
- (转)基于CentOS 7安装Zabbix 3.4和Zabbix4.0
原文:https://blog.csdn.net/leshami/article/details/78708049 CentOS 7环境下Zabbix4.0的安装和配置实例-----------htt ...
- 基于CentOS与VmwareStation10搭建Oracle11G RAC 64集群环境:1.资源准备
最近,在VmwareStation 10虚拟机上,基于CentOS5.4安装Oracle 11g RAC,并把过程记录下来.刚开始时,是基于CentOS 6.4安装Oracle 11g RAC, 没有 ...
随机推荐
- 阿里云HPC助力新制造 | 上汽仿真计算云SSCC
随着上汽集团与阿里云的合作开展,阿里云各项技术逐步深入到上汽汽车研发领域的核心业务实现落地.其中上海汽车集团股份有限公司乘用车分公司(以下简称上汽乘用车)与阿里云共建的仿真计算混合云就是新制造产业升级 ...
- IOC(控制反转)和DI(依赖注入)
IOC(控制反转): 那么IoC是如何做的呢?有点像通过婚介找女朋友,在我和女朋友之间引入了一个第三者:婚姻介绍所.婚介管理了很多男男女女的资料,我可以向婚介提出一个列表,告诉它我想找个什么样的女朋友 ...
- 【HDOJ6608】Fansblog(威尔逊定理)
题意:给定质数p,求q!模p的值,其中q为小于p的最大质数 1e9<=p<=1e14 思路:根据质数密度近似分布可以暴力找q并检查 找到q后根据威尔逊定理: 把q+1到p-1这一段的逆元移 ...
- C#读取csv、xls、sql数据库的实现
using System; using System.Data; using System.Configuration; using System.Web; using System.Web.Secu ...
- BZOJ 5137: [Usaco2017 Dec]Standing Out from the Herd(后缀自动机)
传送门 解题思路 这个似乎和以前做过的一道题很像,只不过这个是求本质不同子串个数.肯定是先把广义\(SAM\)造出来,然后\(dfs\)时把子节点的信息合并到父节点上,看哪个只被一个串覆盖,\(ans ...
- LOJ 3093 「BJOI2019」光线——数学+思路
题目:https://loj.ac/problem/3093 考虑经过种种反射,最终射下去的光线总和.往下的光线就是这个总和 * a[ i ] . 比如只有两层的话,设射到第二层的光线是 lst ,那 ...
- wsl中加载git之后,发现文件是修改状态
查看git status,发现所有文件都被修改. git diff文件查看,发现是行尾的问题导致的. https://github.com/Microsoft/WSL/issues/184 在wsl里 ...
- sdb报告-10 错误问题定位
# sdb报告-10 错误问题定位在sdb 的集群环境中,如果面对的是一个高并发的操作场景,有时候会莫名其妙地报告 -10 错误. 在 sdb 的错误列表中,-10 错误代表:系统错误. 这是一个笼统 ...
- jenkins配置到gitlab拉代码
参照: jenkins 从git拉取代码-简明扼要 https://www.cnblogs.com/jwentest/p/7065783.html 持续集成①安装部署jenkins从git获取代码-超 ...
- 把 MongoDB 当成是纯内存数据库来使用(Redis 风格)
基本思想 将MongoDB用作内存数据库(in-memory database),也即,根本就不让MongoDB把数据保存到磁盘中的这种用法,引起了越来越多的人的兴趣.这种用法对于以下应用场合来讲,超 ...