ceph

Ceph Luminous(12.2.2)安装

2017-10-31  本文已影响626人  Patrick_QiWei

1. 环境:


        1. CentOS Linux release  7.4.1708 (Core)(Basic-web安装)
        2. Ceph Luminous 12.2.2
        3. ceph-deploy 1.5.39

集群配置如下:

主机 IP 功能
node1 192.168.1.58 ceph-deploy、mon1、osd1
node2 192.168.1.61 mon1、osd1
node3 192.168.1.62 mon1、osd1

2. 环境预检


yum源修改成aliyun的源

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
sed -i 's/$releasever/7/g' /etc/yum.repos.d/CentOS-Base.repo

配置firewalld&关闭selinux

firewall-cmd --zone=public --add-port=6789/tcp --permanent
firewall-cmd --zone=public --add-port=6800-7100/tcp --permanent
firewall-cmd --reload
firewall-cmd --zone=public --list-all
setenforce 0
sed -i s'/SELINUX.*=.*enforcing/SELINUX=disabled'/g /etc/selinux/config

配置ntp服务

yum install ntp ntpdate -y
ntpdate pool.ntp.org
systemctl enable ntpd.service
systemctl enable ntpdate.service

更新hostname&hosts

# 在58上修改hostname为node1,在61上修改hostname为node2,在62上修改hostname为node3
echo node1 > /etc/hostname(58)
echo node2 > /etc/hostname(61)
echo node3 > /etc/hostname(62)

将以下内容添加到各个节点的/etc/hosts
192.168.1.58 node1
192.168.1.61 node2
192.168.1.62 node3

3. 安装过程看的是Ceph官网上的手动安装


To install Ceph with RPMs, execute the following steps:
Install yum-plugin-priorities

sudo yum install yum-plugin-priorities -y

Ensure /etc/yum/pluginconf.d/priorities.conf exists.

Ensure priorities.conf enables the plugin.

[main]
enabled = 1

Ensure your YUM ceph.repo entry includes priority=2. See Get Packages for details:

[ceph]
name=Ceph packages for $basearch
# ceph版本填写为luminsou版,操作系统为el7,如果是centos6那就是el6
baseurl=https://download.ceph.com/rpm-luminous/el7/$basearch
enabled=1
priority=2
gpgcheck=1
gpgkey=https://download.ceph.com/keys/release.asc

[ceph-noarch]
name=Ceph noarch packages
baseurl=https://download.ceph.com/rpm-luminous/el7/noarch
enabled=1
priority=2
gpgcheck=1
gpgkey=https://download.ceph.com/keys/release.asc

[ceph-source]
name=Ceph source packages
baseurl=https://download.ceph.com/rpm-luminous/el7/SRPMS
enabled=0
priority=2
gpgcheck=1
gpgkey=https://download.ceph.com/keys/release.asc

Install pre-requisite packages:

sudo yum install snappy leveldb gdisk python-argparse gperftools-libs -y

Once you have added either release or development packages, or added a ceph.repo file to /etc/yum.repos.d
, you can install Ceph packages.

sudo yum install ceph -y

4. 部署


先在node1节点安装ceph-deploy

[root@node1 ~]# yum -y install ceph-deploy
[root@node1 ~]# ceph-deploy --version
1.5.39
[root@node1 ~]# ceph -v
ceph version 12.2.2 (cf0baeeeeba3b47f9427c6c97e2144b094b7e5ba) luminous (stable)

配置各节点的无密码登录

[root@node1 ~]# ssh-keygen
[root@node1 ~]# ssh-copy-id node2
[root@node1 ~]# ssh-copy-id node3
验证:
[root@node1 ~]# ssh root@node2 hostname
node2
[root@node1 ~]# ssh root@node3 hostname
node3

在node1上开始部署集群

[root@node1 ~]# cd /etc/ceph
[root@node1 ~]# ceph-deploy new node1 node2 node3
[root@node1 ~]# ceph-deploy mon create-initial

部署osd
我使用最新的bluestore方式部署,其中slow部署在HDD(/dev/sdb),db和wal部署在SDD(/dev/sdc&/dev/sdd)


# 在ceph.conf中添加如下内容
[osd]
bluestore_block_db_size = 28991029248     # 设置db为27G
bluestore_block_wal_size = 1073741824     # 设置wal为1G
[root@node1 ~]# ceph-deploy --overwrite-conf config push node2
[root@node1 ~]# systemctl restart ceph.target
[root@node2 ~]# systemctl restart ceph.target


[root@node1 ~]# ceph-disk prepare --bluestore /dev/sdb --block.db /dev/sdc --block.wal /dev/sdb
#将在sdb创建两个分区,使用符号链接,将block指向第二个分区,block.db指向sdc的第一个分区,block.wal指向sdb的第一个分区

配置mgr
在mon_server上创建名称为mon_mgr的mgr服务

ceph-deploy mgr create node1:node1-mgr
上一篇下一篇

猜你喜欢

热点阅读