[关闭]
@tony-yin 2017-11-02T16:42:18.000000Z 字数 1176 阅读 650

Manual create and enable osd script

Magicloud Osd Script


  1. #! /bin/bash
  2. start_time=`date +%s`
  3. echo "start time: `date -d @$start_time "+%Y-%m-%d %H:%M:%S"`"
  4. disk=/dev/$1
  5. osd_id=`ceph osd create`
  6. osd_dir=/data/osd.$osd_id
  7. host=10.16.100.99
  8. bucket=default_$host
  9. echo "osd $osd_id is created ..."
  10. mkdir -p $osd_dir
  11. echo "osd directory: /data/osd.$osd_id is created ..."
  12. mkfs -t ext4 -m 0 $disk
  13. echo "disk $disk is built with ext4 file system ..."
  14. mount -o noatime,user_xattr $disk $osd_dir
  15. echo "device: $disk is mounted on directory: $osd_dir ..."
  16. ceph mon getmap -o /tmp/monmap
  17. ceph-osd -i $osd_id --monmap /tmp/monmap --mkfs --mkjournal
  18. echo "osd $osd_id is initialized ..."
  19. osd_uuid=`ceph-osd -i $osd_id --get-osd-fsid`
  20. cat >> /etc/ceph/ceph.conf <<EOF
  21. [osd.$osd_id]
  22. host = $host
  23. public addr = $host
  24. cluster addr = $host
  25. osd uuid = $osd_uuid
  26. post stop command = python /usr/local/bin/syncfs.py -f /data/osd.$osd_id/ceph_fsid && /opt/MegaRAID/MegaCli
  27. EOF
  28. echo 'ceph config file is configured ...'
  29. mcs3-ha service_ceph start osd.$osd_id
  30. echo "osd $osd_id start ..."
  31. ceph osd crush add $osd_id 0 pool=default host=$bucket
  32. echo "osd $osd_id is added in crush ..."
  33. echo 'all works done ...'
  34. end_time=`date +%s`
  35. echo "end time: `date -d @$end_time "+%Y-%m-%d %H:%M:%S"`"
  36. time_consuming=$(($end_time - $start_time))
  37. echo "The total time consuming is $time_consuming s"
添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注