diff --git a/scripts/ceph/start.sh b/scripts/ceph/start.sh index a36b2f50a..db4c645a7 100755 --- a/scripts/ceph/start.sh +++ b/scripts/ceph/start.sh @@ -4,20 +4,22 @@ set -x set -e +script_dir=$(readlink -f $(dirname $0)) + fsid=`uuidgen` -base_dir=`pwd` +base_dir=/var/tmp/ceph mon_ip=127.0.0.1 -mon_dir=${base_dir}/ceph/mon.a/ -pid_dir=${base_dir}/ceph/pid +mon_dir=${base_dir}/mon.a/ +pid_dir=${base_dir}/pid ceph_conf=${base_dir}/ceph.conf -ceph_conf_temp=${base_dir}/ceph.conf.tmp -mnt_dir=${base_dir}/ceph/mnt +mnt_dir=${base_dir}/mnt dev_backend=/dev/ceph image=/var/tmp/ceph_raw.img dev=/dev/loop200 # partition osd -cp $ceph_conf $ceph_conf_temp +mkdir ${base_dir} +cp ${script_dir}/ceph.conf $ceph_conf if [ ! -e $image ]; then fallocate -l 10G $image @@ -57,20 +59,20 @@ rm -rf ${mon_dir}/* mkdir -p ${mon_dir} mkdir -p ${pid_dir} -ceph-authtool --create-keyring --gen-key --name=mon. ${base_dir}/ceph/keyring --cap mon 'allow *' -ceph-authtool --gen-key --name=client.admin --set-uid=0 --cap mon 'allow *' --cap osd 'allow *' --cap mds 'allow *' --cap mgr 'allow *' ${base_dir}/ceph/keyring +ceph-authtool --create-keyring --gen-key --name=mon. ${base_dir}/keyring --cap mon 'allow *' +ceph-authtool --gen-key --name=client.admin --set-uid=0 --cap mon 'allow *' --cap osd 'allow *' --cap mds 'allow *' --cap mgr 'allow *' ${base_dir}/keyring -monmaptool --create --clobber --add a ${mon_ip}:12046 --print ${base_dir}/ceph/monmap +monmaptool --create --clobber --add a ${mon_ip}:12046 --print ${base_dir}/monmap -sh -c "ulimit -c unlimited && exec ceph-mon --mkfs -c ${ceph_conf} -i a --monmap=${base_dir}/ceph/monmap --keyring=${base_dir}/ceph/keyring --mon-data=${mon_dir}" +sh -c "ulimit -c unlimited && exec ceph-mon --mkfs -c ${ceph_conf} -i a --monmap=${base_dir}/monmap --keyring=${base_dir}/keyring --mon-data=${mon_dir}" -cp ${base_dir}/ceph/keyring ${mon_dir}/keyring +cp ${base_dir}/keyring ${mon_dir}/keyring cp $ceph_conf /etc/ceph/ceph.conf -cp ${base_dir}/ceph/keyring /etc/ceph/keyring +cp ${base_dir}/keyring /etc/ceph/keyring -ceph-run sh -c "ulimit -n 16384 && ulimit -c unlimited && exec ceph-mon -c ${ceph_conf} -i a --keyring=${base_dir}/ceph/keyring --pid-file=${base_dir}/ceph/pid/root@`hostname`.pid --mon-data=${mon_dir}" || true +ceph-run sh -c "ulimit -n 16384 && ulimit -c unlimited && exec ceph-mon -c ${ceph_conf} -i a --keyring=${base_dir}/keyring --pid-file=${base_dir}/pid/root@`hostname`.pid --mon-data=${mon_dir}" || true # create osd @@ -90,6 +92,3 @@ sleep 2 mkdir -p ${pid_dir} env -i TCMALLOC_MAX_TOTAL_THREAD_CACHE_BYTES=134217728 ceph-osd -c ${ceph_conf} -i 0 --pid-file=${pid_dir}/ceph-osd.0.pid - -rm -f $ceph_conf -mv $ceph_conf_temp $ceph_conf diff --git a/scripts/ceph/stop.sh b/scripts/ceph/stop.sh index 57399b8e6..5c1c4a950 100755 --- a/scripts/ceph/stop.sh +++ b/scripts/ceph/stop.sh @@ -2,14 +2,12 @@ set -x -base_dir=`pwd` -home_folder=${base_dir}/ceph -image=/var/tmp/ceph_raw.img +base_dir=/var/tmp/ceph +image=${base_dir}/ceph_raw.img dev_backend=/dev/ceph pkill -9 ceph sleep 3 umount /dev/loop200p2 losetup -d $dev_backend -rm -rf $home_folder -rm $image +rm -rf $base_dir