当前位置:文档之家› Ceph安装部署文档

Ceph安装部署文档

Ceph安装部署文档Ceph安装部署文档目录二:部署环境介绍主机名公网IP(eth0)私网IP(eth1)双网卡绑定bond0运行服务操作系统内核备注anode1 172.16.100.35 mon、osdCentOS6.7主节点anode2 172.16.100.36 mon、osdCentOS6.7anode3 172.16.100.37 mon、osdCentOS6.7三:集群配置准备工作3.1 : 生成SSH证书,节点建立连接1)所有节点修改hostnamevim /etc/sysconfig/network2)安装SSH (主节点)sudo apt-get install openssh-server3)s sh登陆证书(主节点)ssh-keygen将配置完成的证书传输到其它服务器:ssh-copy-id {其他节点用户名}@{其他节点IP} Example:ssh-copy-id root@anode24)创建并编辑~/.ssh/config 文件,添加其他Host Host {Hostname}Hostname{}User {Username}Example:Host anode1Hostname 172.16.100.35User rootHost anode2Hostname 172.16.100.36User rootHost anode3Hostname 172.16.100.37User root3.2 : 建立ip地址list, 修改host文件1)创建工作文件夹,建立ip地址list,为文件传输做准备主节点执行mkdir /workspace/cd /workspace/vim cephlist.txt 主机列表写入:anode1anode2anode32)修改host文件vim /etc/hosts追加内容如下:172.16.100.35 anode1172.16.100.36 anode2172.16.100.37 anode3将host文件传输到其它主机for ip in $(cat /workspace/cephlist.txt);do echo -----$ip-----;rsync -avp /etc/hosts $ip:/etc/;done3.3 : 网络端口设置检查网络设置,确定这些设置是永久生效的,重启之后不会改变。

(1)Network设置,所有节点执行vim /etc/sysconfig/network-scripts/ifcfg-{iface}确认ONBOOT 为YESBOOTPROTO 对于静态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 -s172.16.100.35/255.255.255.0 --dport 6789 -jACCEPTsudo iptables -I INPUT 1 -i eth0 -p tcp -s172.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 cache3.5 : 添加时间同步定时任务(1) 安装NTP软件包,所有节点执行yum install ntp完成后,都需要配置NTP服务为自启动chkconfig ntpd onchkconfig --list ntpdntpd 0:关闭 1:关闭 2:启用 3:启用 4:启用 5:启用 6:关闭在配置前,先使用ntpdate手动同步下时间,免得本机与外部时间服务器时间差距太大,让ntpd不能正常同步。

# ntpdate -u (2) 配置内网时间服务器NTP-Server(172.16.100.35) NTPD服务配置核心就在/etc/ntp.conf文件,红色部分修改,其他的是默认。

# For more information about this file, see theman 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 timesource, but do not# permit the source to query or modify the service on this system.restrict default kod nomodify notrap nopeer noqueryrestrict -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.1restrict -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 project.# Please consider joining the pool(/join.html).# 中国这边最活跃的时间服务器 : /zone/cnserver perfer # 中国国家受时中心server # . server # 0.as #broadcast 192.168.1.255 autokey # broadcast server#broadcastclient# broadcast client#broadcast 224.0.1.1 autokey # multicast server#multicastclient224.0.1.1 # multicast client#manycastserver 239.255.254.254 # manycast server#manycastclient 239.255.254.254 autokey #manycast client# allow update time by the upper server# 允许上层时间服务器主动修改本机时间restrict nomodify notrap noqueryrestrict nomodify notrap noqueryrestrict nomodify notrap noquery# Undisciplined Local Clock. This is a fake driver intended for backup# and when no outside source of synchronized time is available.# 外部时间服务器不可用时,以本地时间作为时间服务server 127.127.1.0 # local clockfudge 127.127.1.0 stratum 10# Enable public key cryptography.#cryptoincludefile /etc/ntp/crypto/pw# Key file containing the keys and keyidentifiers used when operating# with symmetric key cryptography.keys /etc/ntp/keys# Specify the key identifiers which are trusted.#trustedkey 4 8 42# Specify the key identifier to use with the ntpdcutility.#requestkey 8# Specify the key identifier to use with the ntpqutility.#controlkey 8# Enable writing of statistics records.#statistics clockstats cryptostats loopstatspeerstats使修改立即生效chkconfig ntpd onchkconfig ntpdate on(3) 与本地时间服务器同步的其他节点设置yum install ntp...chkconfig ntpd onvim /etc/ntp.conf(直接替换原来文件)driftfile /var/lib/ntp/driftrestrict 127.0.0.1restrict -6 ::1# 配置时间服务器为本地的时间服务器server 172.16.100.35restrict 172.16.100.35 nomodify notrap noqueryserver 127.127.1.0 #local clockfudge 127.127.1.0 stratum10includefile/etc/ntp/crypto/pwkeys /etc/ntp/keys使用ntpdate手动同步本地服务器时间ntpdate -u 192.168.0.13522 Dec 17:09:57 ntpdate[6439]: adjust time server 172.16.100.35 offset 0.004882 sec这里有可能出现同步失败,一般情况下原因都是本地的NTPD 服务器还没有正常启动起来,一般需要几分钟时间后才能开始同步。

相关主题