Ceph分布式存储安装部署过程

一、环境准备
1、架构
官方文档:http://docs.ceph.org.cn/start/quick-start-preflight/

Ceph分布式存储安装部署过程

文章插图
 
2、创建ceph.repo
[root@admin-node yum.repos.d]# cat ceph.repo
[ceph]
name=ceph
baseurl=http://mirrors.aliyun.com/ceph/rpm-jewel/el7/x86_64/
gpgcheck=0
priority=1
[ceph-noarch]
name=cephnoarch
baseurl=http://mirrors.aliyun.com/ceph/rpm-jewel/el7/noarch/
gpgcheck=0
priority=1
[root@admin-node yum.repos.d]#
3、在管理节点安装ceph部署工具
yum install ceph-deploy
4、配置NTP时间同步
yum install chrony -y && systemctl start chronyd && systemctl status chronyd && systemctl enable chronyd && egrep -v "#|^$" /etc/chrony.conf
[root@osd-node2 ~]# egrep -v "#|^$" /etc/chrony.conf
server 10.100.50.120 iburst
driftfile /var/lib/chrony/drift
makestep 1.0 3
rtcsync
logdir /var/log/chrony
5、创建各个节点上的ceph账户
我们建议在集群内的所有 Ceph 节点上给 ceph-deploy 创建一个特定的用户,但不要用 “ceph” 这个名字 。全集群统一的用户名可简化操作(非必需),然而你应该避免使用知名用户名,因 为黑客们会用它做暴力破解(如 root 、 admin 、 {productname} ) 。后续步骤描述了如何创建无 sudo 密码的用户,你要用自己取的名字替换 {username}。
useradd -d /home/{username} -m {username}
passwd {username}
6、配置SSH无密钥登录
1、生成密钥:不要使用soudu或者root用户
[sysadmin@admin-node ~]$ ssh-keygen -t rsa 使用-t 选择密钥加密类型
Generating public/private rsa key pair.
Enter file in which to save the key (/home/sysadmin/.ssh/id_rsa): 直接回车
Created directory '/home/sysadmin/.ssh'.
Enter passphrase (empty for no passphrase): 直接回车
Enter same passphrase again: 直接回车
Your identification has been saved in /home/sysadmin/.ssh/id_rsa. 私钥路径
Your public key has been saved in /home/sysadmin/.ssh/id_rsa.pub. 公钥路径
The key fingerprint is:
SHA256:2jiM64WbNMHu3n6wrHIz3dED8ezKDcFCRnZ4erps8uo sysadmin@admin-node
The key's randomart image is:
+---[RSA 2048]----+
| .o.. |
| .+.o |
| o + + |
| . o = o |
| o +S= |
| . =o+o + |
| *+**.= . |
| .o=BB.= . |
| *EX+. |
+----[SHA256]-----+
[sysadmin@admin-node ~]$
2、将密钥拷贝到其他节点
ssh-copy-id sysadmin@10.100.50.128
ssh-copy-id sysadmin@10.100.50.129
ssh-copy-id sysadmin@10.100.50.130
尝试登录测试
[sysadmin@admin-node ~]$10.100.50.130
Last login: Fri May 4 14:25:14 2018 from 10.100.50.127
[sysadmin@osdb-node2 ~]$
7、配置hosts解析
[root@admin-node ~]# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
10.100.50.127 admin-node
10.100.50.128 mon-node1
10.100.50.129 osd-node1
10.100.50.130 osd-node2
8、修改管理节点的~/.ssh/config 简化SSH登录
[sysadmin@admin-node ~]$ cat ~/.ssh/config
Host mon-node1
Hostname mon-node1
User sysadmin
Host osd-node1
Hostname osd-node1
User sysadmin
Host osd-node2
Hostname osd-node2
User sysadmin
登录测试:
[sysadmin@admin-node ~]$ ssh osd-node2
Last login: Fri May 4 16:55:54 2018 from admin-node
[sysadmin@osd-node2 ~]$
二、安装部署
1、创建配置文件夹用来保存配置文件和密钥对
/home/sysadmin/my-cluster
2、禁用 requiretty
将Defaults !visiblepw 修改为Defaults visiblepw
报错信息如下:
[ceph_deploy.cli][INFO ] gpg_url : None
[ceph_deploy.install][DEBUG ] Installing stable version jewel on cluster ceph hosts mon-node1
[ceph_deploy.install][DEBUG ] Detecting platform for host mon-node1 ...
[mon-node1][DEBUG ] connection detected need for sudo
We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:
#1) Respect the privacy of others.
#2) Think before you type.
#3) With great power comes great responsibility.
sudo: no tty present and no askpass program specified
[ceph_deploy][ERROR ] RuntimeError: connecting to host: mon-node1 resulted in errors: IOError cannot send (already closed?)
[sysadmin@admin-node my-cluster]$
在某些发行版(如 centos )上,执行 ceph-deploy 命令时,如果你的 Ceph 节点默认设置了 requiretty 那就会遇到报错 。可以这样禁用此功能:


推荐阅读