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节点配置

磁盘分区

240GSSD盘分出420G的分区用作 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的更多相关文章

  1. CentOS 7 x64 安装 Ceph

    CentOS 7  x64 安装 Ceph 二, 实验环境 节点            IP                 主机名                  系统 MON         1 ...

  2. [转帖]CentOS 7 x64 安装 Ceph

    CentOS 7 x64 安装 Ceph https://www.cnblogs.com/jicki/p/5801712.html 改天尝试一下. k8s 可以使用ceph 作为 pv和pvc的后端存 ...

  3. Ceph Jewel 10.2.3 环境部署

    Ceph 测试环境部署 本文档内容概要 测试环境ceph集群部署规划 测试环境ceph集群部署过程及块设备使用流程 mon节点扩容及osd节点扩容方法 常见问题及解决方法 由于暂时没有用到对象存储,所 ...

  4. CentOS7.0安装Ceph(jewel)及以上版本

    背景 由于docker的Ceph插件rexray对Ceph版本有一定的要求,当Ceph版本为hammer (0.94.10)时,rexray无法成功创建rbd设备.CentOS 7及以上版本,默认安装 ...

  5. 基于centos的docker安装

    1. 安装需求 内核版本3.10以上 Centos 7以上 64位版本 2. 使用root登录或者具有sudo权限 3. 确保系统是最新的 yum update 4. 添加yum源 tee /etc/ ...

  6. 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. ...

  7. 基于Centos搭建Maven 安装与使用

    CentOS 7.2 64 位操作系统 安装 Maven Maven 简介 Apache Maven 是一个软件项目管理及自动构建工具,由 Apache 软件基金会所提供.基于项目对象模型(缩写:PO ...

  8. (转)基于CentOS 7安装Zabbix 3.4和Zabbix4.0

    原文:https://blog.csdn.net/leshami/article/details/78708049 CentOS 7环境下Zabbix4.0的安装和配置实例-----------htt ...

  9. 基于CentOS与VmwareStation10搭建Oracle11G RAC 64集群环境:1.资源准备

    最近,在VmwareStation 10虚拟机上,基于CentOS5.4安装Oracle 11g RAC,并把过程记录下来.刚开始时,是基于CentOS 6.4安装Oracle 11g RAC, 没有 ...

随机推荐

  1. netty-Selector

    上图中加入一句: socketChannel.configureBlocking(false);//设置为非阻塞的 keyIterator.clear(); 每连接一个SocketChannel 都会 ...

  2. 线程join方法 小demo

    1.第一个示例: package cn.threaddemo; public class T implements Runnable { public static int a = 0; @Overr ...

  3. php round()函数 语法

    php round()函数 语法 作用:round()函数的作用是对浮点数进行四舍五入 语法:round(X,prec) 参数: 参数 描述 X 要做处理的数字 prec 指定小数点后的位数 说明:返 ...

  4. 远程仓库(GitHub)的使用

    1.注册登录 在 GitHub 上注册登录 暂时忽略不讲 2.创建新的远程仓库 在GitHub网站上创建新的仓库.不管你是先在本地创建仓库还是先在远程创建仓库,要想把代码提交到远程仓库都是要先手动创建 ...

  5. git分支merger

  6. 《Spring Cloud构建微服务架构》系列博文示例

    SpringCloud-Learning   源码下载地址:http://download.csdn.net/detail/k21325/9650968     本项目内容为Spring Cloud教 ...

  7. Bugku | Easy_vb

    载入ida,直接搜‘ctf’就有了,坑点是不要交“MCTF{XXX}”,要交“flag{XXXX}”

  8. ip地址与子网掩码----基础知识

    前言 IP地址有三种基本类型,由网络号的第一组数字来表示. A类地址的第一组数字为1-126. B类地址的第一组数字为128-191. C类地址的第一组数字为192-223. 注:数字0和 127不作 ...

  9. Windows 08R2 IIS网站架设

    目录 目录 配置和安装IIS 环境设置 安装IIS服务器 网站的站点目录和欢迎页面 配置和安装IIS IIS是Windows的网站服务器,所以配置IIS服务的前提是需要一个网址.和DNS域名并添加主机 ...

  10. write(byte[] b, int off, int len)

    write(byte[] b, int off, int len)就是将数组 b 中的 len 个字节按顺序写入输出流. 所以如果 b 为 null,则抛出 NullPointerException. ...