2008-04-18 17:05:55 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
2008-10-03 20:43:35 +00:00
|
|
|
[ "$CEPH_NUM_MON" == "" ] && CEPH_NUM_MON=3
|
2008-10-15 05:29:21 +00:00
|
|
|
[ "$CEPH_NUM_OSD" == "" ] && CEPH_NUM_OSD=4
|
2008-10-03 20:43:35 +00:00
|
|
|
[ "$CEPH_NUM_MDS" == "" ] && CEPH_NUM_MDS=1
|
|
|
|
|
|
|
|
let debug=0
|
2008-10-16 19:13:09 +00:00
|
|
|
norestart=""
|
2008-10-03 20:43:35 +00:00
|
|
|
|
|
|
|
while [ $# -ge 1 ]; do
|
|
|
|
case $1 in
|
|
|
|
-d | --debug )
|
|
|
|
debug=1
|
2008-10-15 21:01:22 +00:00
|
|
|
;;
|
|
|
|
-n )
|
|
|
|
norestart="--norestart"
|
2008-10-03 20:43:35 +00:00
|
|
|
esac
|
|
|
|
shift
|
|
|
|
done
|
|
|
|
|
|
|
|
ARGS="-f"
|
|
|
|
|
|
|
|
if [ $debug -eq 0 ]; then
|
|
|
|
CMON_ARGS="--debug_mon 10 --debug_ms 1"
|
|
|
|
COSD_ARGS=""
|
|
|
|
CMDS_ARGS=""
|
|
|
|
else
|
|
|
|
echo "** going verbose **"
|
2008-11-03 03:50:00 +00:00
|
|
|
CMON_ARGS="--lockdep 1 --debug_mon 20 --debug_ms 1 --debug_paxos 20"
|
|
|
|
COSD_ARGS="--lockdep 1 --debug_osd 20 --debug_journal 20 --debug_ms 1" # --debug_journal 20 --debug_osd 20 --debug_filestore 20 --debug_ebofs 20
|
|
|
|
CMDS_ARGS="--lockdep 1 --mds_cache_size 500 --mds_log_max_segments 2 --debug_ms 1 --debug_mds 20 --mds_thrash_fragments 0 --mds_thrash_exports 0"
|
2008-10-03 20:43:35 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
|
2008-09-10 23:30:29 +00:00
|
|
|
# sudo if btrfs
|
|
|
|
test -d dev/osd0 && SUDO="sudo"
|
|
|
|
|
|
|
|
$SUDO ./stop.sh
|
2008-10-28 23:50:38 +00:00
|
|
|
$SUDO rm -f core*
|
2008-04-18 17:05:55 +00:00
|
|
|
|
|
|
|
test -d out || mkdir out
|
2008-10-28 23:50:38 +00:00
|
|
|
$SUDO rm -f out/*
|
2008-04-18 17:05:55 +00:00
|
|
|
|
|
|
|
# figure machine's ip
|
|
|
|
HOSTNAME=`hostname`
|
2008-05-11 23:54:53 +00:00
|
|
|
IP=`host $HOSTNAME | grep $HOSTNAME | cut -d ' ' -f 4`
|
2008-04-18 17:05:55 +00:00
|
|
|
[ "$CEPH_BIN" == "" ] && CEPH_BIN=.
|
2008-09-09 00:10:12 +00:00
|
|
|
[ "$CEPH_PORT" == "" ] && CEPH_PORT=12345
|
2008-04-18 17:05:55 +00:00
|
|
|
|
|
|
|
echo hostname $HOSTNAME
|
|
|
|
echo "ip $IP"
|
|
|
|
if [ `echo $IP | grep '^127\\.'` ]
|
|
|
|
then
|
|
|
|
echo
|
|
|
|
echo "WARNING: hostname resolves to loopback; remote hosts will not be able to"
|
|
|
|
echo " connect. either adjust /etc/hosts, or edit this script to use your"
|
|
|
|
echo " machine's real IP."
|
|
|
|
echo
|
|
|
|
fi
|
|
|
|
|
|
|
|
# build a fresh fs monmap, mon fs
|
2008-10-03 20:43:35 +00:00
|
|
|
# $CEPH_BIN/monmaptool --create --clobber --print .ceph_monmap
|
|
|
|
str="$CEPH_BIN/monmaptool --create --clobber"
|
|
|
|
for f in `seq 0 $((CEPH_NUM_MON-1))`
|
|
|
|
do
|
|
|
|
str=$str" --add $IP:$(($CEPH_PORT+$f))"
|
|
|
|
done
|
|
|
|
str=$str" --print .ceph_monmap"
|
|
|
|
echo $str
|
|
|
|
$str
|
|
|
|
|
|
|
|
for f in `seq 0 $((CEPH_NUM_MON-1))`
|
2008-06-30 21:57:04 +00:00
|
|
|
do
|
2008-10-03 20:43:35 +00:00
|
|
|
# $CEPH_BIN/monmaptool --add $IP:$(($CEPH_PORT+$f)) --print .ceph_monmap
|
2008-06-30 21:57:04 +00:00
|
|
|
$CEPH_BIN/mkmonfs --clobber mondata/mon$f --mon $f --monmap .ceph_monmap
|
2008-10-03 20:57:12 +00:00
|
|
|
$CEPH_BIN/cmon $ARGS -d $CMON_ARGS mondata/mon$f
|
2008-06-30 21:57:04 +00:00
|
|
|
done
|
2008-04-18 17:05:55 +00:00
|
|
|
|
|
|
|
# build and inject an initial osd map
|
2008-09-20 22:02:04 +00:00
|
|
|
$CEPH_BIN/osdmaptool --clobber --createsimple .ceph_monmap 4 .ceph_osdmap # --pgbits 2
|
2008-04-18 17:05:55 +00:00
|
|
|
$CEPH_BIN/cmonctl osd setmap -i .ceph_osdmap
|
|
|
|
|
2008-10-03 20:43:35 +00:00
|
|
|
for osd in `seq 0 $((CEPH_NUM_OSD-1))`
|
2008-04-18 17:05:55 +00:00
|
|
|
do
|
2008-09-12 18:44:23 +00:00
|
|
|
echo mkfs osd$osd
|
2008-10-03 20:43:35 +00:00
|
|
|
$SUDO $CEPH_BIN/cosd --mkfs_for_osd $osd dev/osd$osd # --debug_journal 20 --debug_osd 20 --debug_filestore 20 --debug_ebofs 20
|
2008-09-12 18:44:23 +00:00
|
|
|
echo start osd$osd
|
2008-10-15 21:01:22 +00:00
|
|
|
$CEPH_BIN/crun $norestart $SUDO $CEPH_BIN/cosd -m $IP:$CEPH_PORT dev/osd$osd $ARGS $COSD_ARGS &
|
2008-09-12 22:09:34 +00:00
|
|
|
# echo valgrind --leak-check=full --show-reachable=yes $CEPH_BIN/cosd dev/osd$osd --debug_ms 1 --debug_osd 20 --debug_filestore 10 --debug_ebofs 20 #1>out/o$osd #& #--debug_osd 40
|
2008-04-18 17:05:55 +00:00
|
|
|
done
|
|
|
|
|
|
|
|
# mds
|
2008-10-03 20:43:35 +00:00
|
|
|
for mds in `seq 0 $((CEPH_NUM_MDS-1))`
|
|
|
|
do
|
2008-10-15 21:01:22 +00:00
|
|
|
$CEPH_BIN/crun $norestart $CEPH_BIN/cmds $ARGS $CMDS_ARGS &
|
2008-10-03 20:43:35 +00:00
|
|
|
|
2008-09-12 22:09:34 +00:00
|
|
|
#valgrind --tool=massif $CEPH_BIN/cmds $ARGS --mds_log_max_segments 2 --mds_thrash_fragments 0 --mds_thrash_exports 0 > m #--debug_ms 20
|
|
|
|
#$CEPH_BIN/cmds -d $ARGS --mds_thrash_fragments 0 --mds_thrash_exports 0 #--debug_ms 20
|
|
|
|
#$CEPH_BIN/cmonctl mds set_max_mds 2
|
2008-10-03 20:43:35 +00:00
|
|
|
done
|
2008-04-18 17:05:55 +00:00
|
|
|
|
|
|
|
echo "started. stop.sh to stop. see out/* (e.g. 'tail -f out/????') for debug output."
|
|
|
|
|