1、基本環境介紹:node
本文采用ceph-deploy工具進行ceph安裝,ceph-deploy能夠單獨做爲一個admin節點,也能夠裝在任意node節點上。linux
系統環境以下:vim
一、 系統採用redhat-6.5x86_64 basic_server安裝,總共3個節點,ntp時間同步bash
二、 關閉selinux,用epel及ceph官方源,版本爲0.86網絡
三、 3個節點已作互信,並配置host,每一個節點上有3個磁盤作osdtcp
四、 升級內核爲3.18,並重新內核啓動。ide
2、安裝步驟:工具
一、 每一個node上設置iptables規則或關閉iptables(eth0指ceph網絡所在的網卡名稱)spa
iptables -A INPUT -i eth0 -p tcp -s0.0.0.0/0 --dport 6789 -j ACCEPT iptables -A INPUT -i eth0 -m multiport -ptcp -s 0.0.0.0/0 --dports 6800:7300 -j ACCEPT service iptables save
二、 格式化、掛載osddebug
yum -y install xfsprogs mkfs.xfs /dev/sdb mkdir /osd{0..2} #blkid 查看sdb的UUID echo 'UUID=89048e27-ff01-4365-a103-22e95fb2cc93/osd0 xfs noatime,nobarrier,nodiratime 00' >> /etc/fstab
一個磁盤對應一個osd,每一個節點都建立osd0、osd1、osd2目錄,對應的磁盤掛載相應目錄便可。
3、安裝ceph部署工具
#mkdir ceph #最好建立一個目錄,由於安裝ceph過程當中,會在安裝目錄生成一些文件 #cd ceph #yum -y install ceph-deploy
4、建立mon
ceph-deploy new node1 nod2 node3 #這個命令其實就是僅僅生成了ceph.conf和ceph.mon.keyring 文件 vim ceph.conf 追加如下內容(根據需求更改) debug_ms = 0 mon_clock_drift_allowed = 1 osd_pool_default_size = 2 #副本數量 osd_pool_default_min_size = 1 osd_pool_default_pg_num = 128 #pg數量 osd_pool_default_pgp_num = 128 osd_crush_chooseleaf_type = 0 debug_auth = 0/0 debug_optracker = 0/0 debug_monc = 0/0 debug_crush = 0/0 debug_buffer = 0/0 debug_tp = 0/0 debug_journaler = 0/0 debug_journal = 0/0 debug_lockdep = 0/0 debug_objclass = 0/0 debug_perfcounter = 0/0 debug_timer = 0/0 debug_filestore = 0/0 debug_context = 0/0 debug_finisher = 0/0 debug_heartbeatmap = 0/0 debug_asok = 0/0 debug_throttle = 0/0 debug_osd = 0/0 debug_rgw = 0/0 debug_mon = 0/0 osd_max_backfills = 4 filestore_split_multiple = 8 filestore_fd_cache_size = 1024 filestore_queue_committing_max_bytes =1048576000 filestore_queue_max_ops = 500000 filestore_queue_max_bytes = 1048576000 filestore_queue_committing_max_ops = 500000 osd_max_pg_log_entries = 100000 osd_mon_heartbeat_interval = 30 #Performance tuning filestore osd_mount_options_xfs =rw,noatime,logbsize=256k,delaylog #osd_journal_size = 20480 日誌大小,不指定,默認是5G osd_op_log_threshold = 50 osd_min_pg_log_entries = 30000 osd_recovery_op_priority = 1 osd_mkfs_options_xfs = -f -i size=2048 osd_mkfs_type = xfs osd_journal =/var/lib/ceph/osd/$cluster-$id/journal journal_queue_max_ops = 500000 journal_max_write_bytes = 1048576000 journal_max_write_entries = 100000 journal_queue_max_bytes = 1048576000 objecter_infilght_op_bytes = 1048576000 objecter_inflight_ops = 819200 ms_dispatch_throttle_bytes = 1048576000 sd_data = /var/lib/ceph/osd/$cluster-$id merge_threshold = 40 backfills = 1 mon_osd_min_down_reporters = 13 mon_osd_down_out_interval = 600 rbd_cache_max_dirty_object = 0 rbd_cache_target_dirty = 235544320 rbd_cache_writethrough_until_flush = false rbd_cache_size = 335544320 rbd_cache_max_dirty = 335544320 rbd_cache_max_dirty_age = 60 rbd_cache = false
5、安裝ceph
#On All nodes to Install
yum -y install ceph
admin節點上執行:
ceph-deploy mon create node1 node2 node3 ceph-deploy gatherkeys node1 #從moniter節點得到keys,用來管理節點
6、建立激活osd
ceph-deploy osd prepare node1:/osd0node1:/osd1 node1:/osd2 node2:/osd0 node2:/osd1 node2:/osd2 node3:/osd0node3:/osd1 node3:/osd2 ceph-deploy osd activate node1:/osd0node1:/osd1 node1:/osd2 node2:/osd0 node2:/osd1 node2:/osd2 node3:/osd0node3:/osd1 node3:/osd2 ceph-deploy admin node1 node2 node3 #從admin節點複製配置文件及key到node chmod +r/etc/ceph/ceph.client.admin.keyring (全部節點爲該文件添加讀權限)
也能夠建立相關的pool
ceph osd pool create volumes 128 ceph osd pool create p_w_picpaths 128 ceph osd pool create vms 128 ceph osd pool create backups 128
若是ceph安裝失敗,要清除ceph環境,執行如下命令
ceph-deploy purge node1 node2 node3 (全部節點) ceph-deploy purgedata node1 node2 node3 (全部節點) ceph-deploy forgetkeys