centos7部署ceph集群(正确)

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了centos7部署ceph集群(正确)相关的知识,希望对你有一定的参考价值。

环境介绍

主机名

系统

ip地址

ceph版本

ceph-node1

CentOS Linux release 7.2.1511

192.168.1.120

jewel

ceph-node2

CentOS Linux release 7.2.1511

192.168.1.121

jewel

ceph-node3

CentOS Linux release 7.2.1511

192.168.1.128

jewel

准备工作

    1-7在三台ceph节点上都需要进行操作

    ◆ 8只在ceph1操作即可

1:修改主机名

[[email protected] ~]# hostname ceph-node1

[[email protected] ~]# vim /etc/sysconfig/network

HOSTNAME=ceph-node1

2:配置ip地址,子网掩码,网关

[[email protected] ~]# cat /etc/sysconfig/network-scripts/ifcfg-eno16777736

TYPE="Ethernet"

BOOTPROTO="none"

DEFROUTE="yes"

IPV4_FAILURE_FATAL="no"

IPV6INIT="no"

IPV6_AUTOCONF="yes"

IPV6_DEFROUTE="yes"

IPV6_PEERDNS="yes"

IPV6_PEERROUTES="yes"

IPV6_FAILURE_FATAL="no"

NAME="eth1"

DEVICE="eno16777736"

ONBOOT="yes"

IPADDR="192.168.1.120"

PREFIX="24"

GATEWAY="192.168.1.1"

DNS1="192.168.0.220"

3:配置hosts文件

[[email protected] ~]# vim /etc/hosts

ceph-node1 192.168.1.120

ceph-node2 192.168.1.121

ceph-node3 192.168.1.128

4:配置防火墙

[[email protected] ~]# firewall-cmd --zone=public --add-port=6789/tcp --permanent

success

[[email protected] ~]# firewall-cmd --zone=public --add-port=6800-7100/tcp --permanent

success

[[email protected] ~]# firewall-cmd --reload

success

[[email protected] ~]# firewall-cmd --zone=public --list-all

public (default, active)

  interfaces: eno16777736

  sources:

  services: dhcpv6-client ssh

  ports: 6789/tcp 6800-7100/tcp

  masquerade: no

  forward-ports:

  icmp-blocks:

  rich rules:

5:禁用selinux

[[email protected] ~]# setenforce 0

[[email protected] ~]# sed -i "s/enforcing/permissive/g" /etc/selinux/config

6:配置时间同步

[[email protected] ~]# yum -y install ntp ntpdate

[[email protected] ~]# systemctl restart ntpd.service

[[email protected] ~]# systemctl enable ntpd.service

Created symlink from /etc/systemd/system/multi-user.target.wants/ntpd.service to /usr/lib/systemd/system/ntpd.service.

[[email protected] ~]# systemctl enable ntpdate.service

Created symlink from /etc/systemd/system/multi-user.target.wants/ntpdate.service to /usr/lib/systemd/system/ntpdate.service.

7:添加ceph jewel版本并更新yum

[[email protected] ceph]# rpm -Uvh https://download.ceph.com/rpm-jewel/el7/noarch/ceph-release-1-0.el7.noarch.rpm

[[email protected] ~]# yum -y update

8:配置ceph1的免秘钥登录

[[email protected] ~]# ssh-keygen

[[email protected] ~]# ssh-copy-id [email protected]

[[email protected] ~]# ssh-copy-id [email protected]

ceph-node1上创建集群

1:安装ceph-deploy

[[email protected] ~]# yum -y install ceph-deploy

2:使用ceph-deploy创建一个ceph集群

[[email protected] ~]# mkdir /etc/ceph

[[email protected] ~]# cd /etc/ceph/

[[email protected] ceph]# ceph-deploy new ceph-node1

[[email protected] ceph]# ls

ceph.conf  ceph.log  ceph.mon.keyring

3:使用ceph-deploy在所有节点安装ceph二进制包

[[email protected] ceph]# ceph-deploy install ceph-node1 ceph-node2 ceph-node3

[[email protected] ceph]# ceph -v

ceph version 9.2.1 (752b6a3020c3de74e07d2a8b4c5e48dab5a6b6fd)

4:在ceph-node1上创建第一个ceph monitor

[[email protected] ceph]# ceph-deploy mon create-initial

5:在ceph-node1上创建osd

[r[email protected] ceph]# ceph-deploy disk list ceph-node1

[[email protected] ceph]# ceph-deploy disk zap ceph-node1:sdb ceph-node1:sdc ceph-node1:sdd

[[email protected] ~]# ceph-deploy disk zap ceph-node1:sdb ceph-node1:sdc ceph-node1:sdd

[[email protected] ~]# ceph-deploy osd create ceph-node1:sdb ceph-node1:sdc ceph-node1:sdd

[[email protected] ~]# ceph -s

扩展ceph集群

1:添加公共网络地址到配置文件

[[email protected] ~]# cd /etc/ceph/

[[email protected] ceph]# vim /etc/ceph/ceph.conf

2:在ceph-node2ceph-node3上创建一个monitor

[[email protected] ceph]# ceph-deploy mon create ceph-node2

[[email protected] ceph]# ceph-deploy mon create ceph-node3

3:从ceph-node2ceph-node3中添加osd

[[email protected] ceph]# ceph-deploy disk list ceph-node2 ceph-node3

[[email protected] ceph]# ceph-deploy disk zap ceph-node2:sdb ceph-node2:sdc ceph-node2:sdd

[[email protected] ceph]# ceph-deploy disk zap ceph-node3:sdb ceph-node3:sdc ceph-node3:sdd

[[email protected] ceph]# ceph-deploy osd create ceph-node2:sdb ceph-node2:sdc ceph-node2:sdd

[[email protected] ceph]# ceph-deploy osd create ceph-node3:sdb ceph-node3:sdc ceph-node3:sdd

4:调整pgpgp的数量

[[email protected] ceph]# ceph osd pool set rbd pg_num 256

[[email protected] ceph]# ceph osd pool set rbd pgp_num 256

5:查看集群状态,此时集群应该是health状态

[[email protected] ceph]# ceph -s

    cluster 266bfddf-7f45-416d-95df-4e6487e8eb20

     health HEALTH_OK

     monmap e3: 3 mons at {ceph-node1=192.168.1.120:6789/0,ceph-node2=192.168.1.121:6789/0,ceph-node3=192.168.1.128:6789/0}

            election epoch 8, quorum 0,1,2 ceph-node1,ceph-node2,ceph-node3

     osdmap e53: 9 osds: 9 up, 9 in

            flags sortbitwise,require_jewel_osds

      pgmap v158: 256 pgs, 1 pools, 0 bytes data, 0 objects

            320 MB used, 134 GB / 134 GB avail

                 256 active+clean

技术分享


本文出自 “庭中有奇树” 博客,请务必保留此出处http://zhangdl.blog.51cto.com/11050780/1880340

以上是关于centos7部署ceph集群(正确)的主要内容,如果未能解决你的问题,请参考以下文章

基于centos7.3安装部署jewel版本ceph集群实战演练

CentOS7.6 使用ceph-deploy部署mimic 13.2.8集群

Centos7.4部署ceph块设备

Ceph入门----CentOS7部署ceph三节点分布式存储系统

Centos7-Ceph分布式存储快速部署

ceph部署手册