Ceph安装部署文档
目录
一:简介 ........................................................................................................................................................................... 1 二:部署环境介绍 ........................................................................................................................................................... 1 三:集群配置准备工作 ................................................................................................................................................... 2
3.1 : 生成SSH证书,节点建立连接 ................................................................................................................... 2 3.2 : 建立ip地址list, 修改host文件 ................................................................................................................. 3 3.3 : 网络端口设置 ............................................................................................................................................... 3 3.4 : 安装centos的yum源软件包 =>全部节点安装 ........................................................................................ 4 3.5 : 添加时间同步定时任务 ............................................................................................................................... 4 3.6 : 安装 yum-plugin-priorities. .......................................................................................................................... 8 四:安装ceph软件包 ..................................................................................................................................................... 8
4.1、安装ceph部署机 ,使用ceph-deploy方式安装部署 ................................................................................ 8 4.2、安装ceph存储集群(包括ceph对象网关) ............................................................................................... 8 五:搭建ceph集群 ......................................................................................................................................................... 8
5.1 : 新建ceph集群 ............................................................................................................................................. 9 5.2 : 添加mon节点 .............................................................................................................................................. 9 5.3 : 添加osd节点 ............................................................................................................................................... 9 六:安装过程出现的部分错误及解决方法 ................................................................................................................. 11 七:常用命令 ................................................................................................................................................................. 11
一:简介
Ceph 生态系统架构可以划分为四部分:
1. Clients:客户端:数据用户
2. mds:Metadata server cluster,元数据服务器:缓存和同步分布式元数据(此文档没有安装mds) 3. osd:Object storage cluster,对象存储集群:将数据和元数据作为对象存储,执行其它关键职能 4. mon:Cluster monitors,集群监视器:执行监视功能
二:部署环境介绍
主机名 公网IP(eth0) 私网IP(eth1) 双网卡绑定 bond0 172.16.100.35 运行服务 操作系统 内核 CentOS6.7 备注 anode1 mon、osd 主节点 anode2 172.16.100.36 mon、osd CentOS6.7 anode3
172.16.100.37 mon、osd CentOS6.7 三:集群配置准备工作
3.1 : 生成SSH证书,节点建立连接
1) 所有节点修改hostname vim /etc/sysconfig/network
2) 安装SSH (主节点)
sudo apt-get install openssh-server
3) ssh登陆证书 (主节点) ssh-keygen
将配置完成的证书传输到其它服务器: ssh-copy-id {其他节点用户名}@{其他节点IP} Example:
ssh-copy-id root@anode2
4) 创建并编辑~/.ssh/config 文件,添加其他Host Host {Hostname}
Hostname {ceph-server.fqdn-or-ip-address.com} User {Username} Example: Host anode1
Hostname 172.16.100.35 User root Host anode2
Hostname 172.16.100.36 User root Host anode3
Hostname 172.16.100.37
User root
3.2 : 建立ip地址list, 修改host文件
1) 创建工作文件夹,建立ip地址list,为文件传输做准备 主节点执行 mkdir /workspace/ cd /workspace/
vim cephlist.txt 主机列表 写入:
anode1 anode2 anode3 2) 修改host文件 vim /etc/hosts 追加内容如下:
172.16.100.35 anode1 172.16.100.36 anode2 172.16.100.37 anode3 将host文件传输到其它主机
for ip in $(cat /workspace/cephlist.txt);do echo -----$ip-----;rsync -avp /etc/hosts $ip:/etc/;done
3.3 : 网络端口设置
检查网络设置,确定这些设置是永久生效的,重启之后不会改变。 (1) Network设置,所有节点执行
vim /etc/sysconfig/network-scripts/ifcfg-{iface}
确认ONBOOT 为YES
BOOTPROTO 对于静态IP地址来说通常为NONE
如果要使用IPV6协议的话,需要设置IPV6{opt} 为YES
(2) 防火墙设置(Iptables),所有节点执行
a) 端口6789:Monitor 需要通过此端口与OSD通信,因此所有Monitor节点需打开 b) 端口6800:7300:用于OSD通信。
每个Ceph Node上的每个OSD需要三个端口,一个用于与client和 Monitor通信;一个 用于与其他OSD传送数据,一个用于心跳检测。如果一个Ceph Node上有4个OSD,打开 12(=3×4)个端口。
sudo iptables -I INPUT 1 -i eth0 -p tcp -s 172.16.100.35/255.255.255.0 --dport 6789 -j ACCEPT sudo iptables -I INPUT 1 -i eth0 -p tcp -s 172.16.100.35/255.255.255.0 --dport 6800:6809 -j ACCEPT
配置完成iptable以后,确保每个节点上的改变永久生效,重启以后也能保持有效。 /sbin/service iptables save (3) tty 设置, 所有节点执行
sudo visudo
找到 Defaults requiretty,大约在50多行,把它改成Defaults:{User} !requiretty 或者直接把原句注释掉。确保Ceph-Deploy不会报错。 (4) SELINUX, 所有节点执行
sudo setenforce 0
确保集群在配置完成之前不会出错。可以在/etc/selinux/config修改永久改变。
3.4 : 安装centos的yum源软件包 =>全部节点安装
(1) 复制此文档所在文件夹中的.repo文件到目录/etc/yum.repos.d/中
(2) 传输yum源文件到其它节点服务器 --delete 删除那些DST中SRC没有的文件
for ip in $(cat /workspace/cephlist.txt);do echo -----$ip-----;rsync -avp --delete /etc/yum.repos.d $ip:/etc/;done (3) yum立即生效(所有节点执行) yum make cache
3.5 : 添加时间同步定时任务
(1) 安装NTP软件包,所有节点执行 yum install ntp
完成后,都需要配置NTP服务为自启动 chkconfig ntpd on chkconfig --list ntpd
ntpd 0:关闭 1:关闭 2:启用 3:启用 4:启用 5:启用 6:关闭
在配置前,先使用ntpdate手动同步下时间,免得本机与外部时间服务器时间差距太大,让ntpd不能正常同步。 # ntpdate -u 2.cn.pool.ntp.org
(2) 配置内网时间服务器NTP-Server(172.16.100.35)
NTPD服务配置核心就在/etc/ntp.conf文件,红色部分修改,其他的是默认。
# For more information about this file, see the man pages
# ntp.conf(5), ntp_acc(5), ntp_auth(5), ntp_clock(5), ntp_misc(5), ntp_mon(5).
driftfile /var/lib/ntp/drift
# Permit time synchronization with our time source, but do not # permit the source to query or modify the service on this system. restrict default kod nomodify notrap nopeer noquery restrict -6 default kod nomodify notrap nopeer noquery
# Permit all access over the loopback interface. This could # be tightened as well, but to do so would effect some of # the administrative functions. restrict 127.0.0.1 restrict -6 ::1
# Hosts on local network are less restricted. # 允许内网其他机器同步时间
restrict 172.16.100.0 mask 255.255.255.0 nomodify notrap
# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html). # 中国这边最活跃的时间服务器 : http://www.pool.ntp.org/zone/cn server 2.cn.pool.ntp.org perfer # 中国国家受时中心 server 1.asia.pool.ntp.org # 1.cn.pool.ntp.org server 3..asia.pool.ntp.org # 0.asia.pool.ntp.org
#broadcast 192.168.1.255 autokey # broadcast server #broadcastclient # broadcast client #broadcast 224.0.1.1 autokey # multicast server #multicastclient 224.0.1.1 # multicast client #manycastserver 239.255.254.254 # manycast server #manycastclient 239.255.254.254 autokey # manycast client