节点信息配置
虚拟机名称 | 虚拟机ip | 虚拟机应用 |
---|---|---|
ceph-master | 192.168.56.101 | ceph-master/deployment |
ceph-node-1 | 192.168.56.102 | ceph-node |
ceph-node-2 | 192.168.56.102 | ceph-node |
环境准备
1.关闭防火墙(所有节点)
1 | sed -i 's/SELINUX=.*/SELINUX=disabled/' /etc/selinux/config |
2.配置节点host解析设置hostname(所有节点)
1 | 192.168.56.101 ceph-master |
3.安装依赖(所有节点)
1 | yum install tree nmap sysstat lrzsz dos2unix wegt git net-tools -y |
4.设置免密登录
生成秘钥文件(ceph-master节点)
ssh-keygen -t rsa
拷贝秘钥文件
1
2
3ssh-copy-id root@ceph-master
ssh-copy-id root@ceph-node-1
ssh-copy-id root@ceph-node-2
5.配置NTP服务
安装NTP服务(所有节点)
yum install -y ntp
ceph-master节点配置
修改NTP配置文件/etc/ntp.conf
1
2
3
4
5
6
7
8
9vim /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 192.168.56.1 mask 255.255.255.0 nomodify notrap
server 127.127.1.0 minpoll 4
fudge 127.127.1.0 stratum 0修改配置文件/etc/ntp/step-tickers
1
2
3vim /etc/ntp/step-tickers
0.centos.pool.ntp.org
127.127.1.0启动NTP服务并设置开机启动
1
2systemctl enable ntpd
systemctl start ntpd
所有OSD节点配置
修改NTP配置文件/etc/ntp.conf
1
2
3
4
5
6vim /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 192.168.56.101启动NTP服务并设置开机启动
1
2systemctl enable ntpd
systemctl start ntpd
验证NTP(所有节点)
1
2
3
4
5ntpstat
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.更新系统源(所有节点)
1 | yum install -y wget |
2.安装ceph-deploy和配置ceph集群(master节点执行)
安装ceph-deploy
1
yum install http://mirrors.163.com/ceph/rpm-jewel/el7/noarch/ceph-deploy-1.5.38-0.noarch.rpm
创建ceph集群
1
eph-deploy new ceph-node-1 ceph-node-2
编辑ceph配置文件
在global下添加一下配置
1
2
3
4
5
6vim ceph.conf
[global]
mon_clock_drift_allowed = 5
osd_journal_size = 20480
查看自己的网关地址
public_network=192.168.56.1/24使用163源安装CEPH
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
初始化节点
1
ceph-deploy mon create-initial
配置管理节点(ceph-master)
1
2
3
4ceph-deploy admin ceph-master
chmod +r /etc/ceph/ceph.client.admin.keyring
查询集群状态
ceph -s
创建和配置OSD存储节点
1.查看OSD节点的磁盘情况(找到要挂载的新磁盘)
1 | eph-deploy disk list ceph-node-1 |
2.创建并激活OSD节点
1 | 重建分区表,磁盘存储要大些,如果比较小会报错 |
部署时常用命令
1 | #若部署出现问题可以清空一切重新开始部署 |
默认相关文件地址
- 配置文件:默认 /etc/ceph/ceph.conf
- 日志文件:默认 /var/log/ceph
- 运行时文件:默认 /var/run/ceph
每个进程的管理套接字位置:/var/run/ceph/cluster-name.asok
使用管理套接字查看osd.0的运行时配置信息:
1 | ceph --admin-daemon /var/run/ceph/ceph-osd.0.asok config show | less |
集群启动后,每个守护进程从配置文件 /etc/ceph/ceph.conf中查看配置信息
1 | [ global ] |
其他相关
1 | #查看pool类型 默认rbd |