diff --git a/sandbox/clear.sh b/sandbox/clear.sh index 65e66a76..41de5f48 100755 --- a/sandbox/clear.sh +++ b/sandbox/clear.sh @@ -1,8 +1,8 @@ #!/usr/bin/env bash -killall -9 nameserver -killall -9 chunkserver -killall -9 bfs_client +killall -9 nameserver > /dev/null 2>&1 +killall -9 chunkserver > /dev/null 2>&1 +killall -9 bfs_client > /dev/null 2>&1 rm -rf nameserver* chunkserver* rm -rf master* slave* diff --git a/sandbox/deploy.sh b/sandbox/deploy.sh index 6d9d0f5e..d7852a1f 100755 --- a/sandbox/deploy.sh +++ b/sandbox/deploy.sh @@ -10,8 +10,16 @@ if [ "$1"x = "x" ]; then ns_num=1; elif [ "$1x" == "raftx" ]; then ns_num=3 -elif [ "$1x" == "master_slave" ]; then +elif [ "$1" == "master_slave" ]; then ns_num=2 +elif [ "$1" == "-h" ]; then + echo "Usage:" + echo " $0 [mode = none | master_slave | raft | -h]" + echo " none: one nameserver, default mode." + echo " master_slave: two nameservers, one is master and the other is slave." + echo " raft: three nameservers, master server is choosen by inbuilt raft protocol." + echo " -h: show this usage." + exit 0 fi echo '--default_replica_num=3' >> bfs.flag diff --git a/sandbox/small_test.sh b/sandbox/small_test.sh index bde20ff1..68dfeede 100755 --- a/sandbox/small_test.sh +++ b/sandbox/small_test.sh @@ -21,6 +21,9 @@ fi sleep 5 +if [ "$1"x == "raft"x ]; then + sleep 30 +fi # Test sl ./bfs_client ls / @@ -110,6 +113,9 @@ do done; sleep 10 +if [ "$1"x == "raft"x ]; then + sleep 30 +fi ./bfs_client get /bin/bfs_client ./binary rm -rf ./binary diff --git a/sandbox/start_bfs.sh b/sandbox/start_bfs.sh index 5fee3c54..89939211 100755 --- a/sandbox/start_bfs.sh +++ b/sandbox/start_bfs.sh @@ -12,19 +12,22 @@ do cd nameserver$i; ./bin/nameserver --node_index=$i 1>nlog 2>&1 & echo $! > pid - cd - + echo "start nameserver$i with pid `cat pid`" + cd - > /dev/null done; if [ "$1"x == "master_slave"x ]; then cd nameserver0; ./bin/nameserver --master_slave_role=slave --node_index=0 1>nlog 2>&1 & echo $! > pid - cd - + echo "start slave nameserver0 with pid `cat pid`" + cd - > /dev/null sleep 1 cd nameserver1; ./bin/nameserver --master_slave_role=master --node_index=1 1>nlog 2>&1 & echo $! > pid - cd - + echo "start master nameserver1 with pid `cat pid`" + cd - > /dev/null fi for i in `seq 0 3`; @@ -32,5 +35,6 @@ do cd chunkserver$i; ./bin/chunkserver --chunkserver_port=802$i 1>clog1 2>&1 & echo $! > pid - cd - + echo "start chunkserver$i with pid `cat pid` at port 802$i" + cd - > /dev/null done