首页 > 代码库 > CEPH

CEPH

Ceph 搭建文档

硬件环境准备

3台CentOS7。数据盘根据需要来定

软件环境准备

关闭 SELINUX

# sed -i s/SELINUX=enforcing/SELINUX=disabled/g /etc/selinux/config

# setenforce 0

关闭iptables

# systemctl stop firewalld

# systemctl disable firewalld

安装 EPEL 软件源:

# rpm –Uvh https://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-8.noarch.rpm

同步时间

# yum -y ntp

# ntpdate asia.pool.ntp.org

分别修改hostname

# hostname node1

# echo node1 > /etc/hostname

分别修改/etc/hosts

# cat /etc/hosts

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4

::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

192.168.50.1        node1

192.168.50.2        node2

192.168.50.3        node3

分别配置ssh免密码登录

# ssh-keygen  -t rsa -P ‘‘

# ssh-copy-id node1

# ssh-copy-id node2

# ssh-copy-id node3

Ceph部署

每台安装配置源

# yum clean all
# 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 ‘/aliyuncs/d‘ /etc/yum.repos.d/epel.repo 

增加ceph源

# vim /etc/yum.repos.d/ceph.repo
[ceph]
name=ceph
baseurl=http://mirrors.aliyun.com/ceph/rpm-jewel/el7/x86_64/
gpgcheck=0
[ceph-noarch]
name=cephnoarch
baseurl=http://mirrors.aliyun.com/ceph/rpm-jewel/el7/noarch/
gpgcheck=0

node1安装deploy

# yum install ceph-deploy –y

创建目录

# mkdir ~/ceph-cluster
# cd ceph-cluster/

创建

# ceph-deploy new node1 node2 node3

安装ceph

# ceph-deploy install node1 node2 node3 

初始化mon

# ceph-deploy mon create-initial 

创建osd

ceph-deploy  --overwrite-conf osd create  mode1:/dev/sdb  node2:/dev/sdb  node3:/dev/sdb 

创建admin

# ceph-deploy --overwrite-conf admin node1 node2 node3 

查看

# ceph health
HEALTH_OK

 

!如果出错,一切都可以重新来过

# ceph-deploy purge node1 node2 node3

# ceph-deploy purgedata node1 node2 node3

# ceph-deploy forgetkeys

 

CEPH