Mercurial > hg > Database > Christie
changeset 182:1559aa74dc74
add paxos sh
author | akahori |
---|---|
date | Sat, 02 Feb 2019 15:18:17 +0900 |
parents | 33b4966d4d24 |
children | 1bffd8151c6a |
files | scripts/Log/paxos.dot scripts/paxos.pl scripts/paxos.sh |
diffstat | 3 files changed, 76 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/Log/paxos.dot Sat Feb 02 11:42:48 2019 +0900 +++ b/scripts/Log/paxos.dot Sat Feb 02 15:18:17 2019 +0900 @@ -1,17 +1,15 @@ -digraph test { - proposer1 -> acceptor1 [label="acceptor1"] - proposer1 -> acceptor2 [label="acceptor2"] - proposer1 -> acceptor3 [label="acceptor3"] - proposer2 -> acceptor1 [label="acceptor1"] - proposer2 -> acceptor2 [label="acceptor2"] - proposer2 -> acceptor3 [label="acceptor3"] +digraph paxos { + acceptor0 -> learner0 [label="learner0"] + acceptor0 -> proposer0 [label="proposer0"] + acceptor0 -> proposer1 [label="proposer1"] + acceptor1 -> learner0 [label="learner0"] + acceptor1 -> proposer0 [label="proposer0"] acceptor1 -> proposer1 [label="proposer1"] + acceptor2 -> learner0 [label="learner0"] + acceptor2 -> proposer0 [label="proposer0"] acceptor2 -> proposer1 [label="proposer1"] - acceptor3 -> proposer1 [label="proposer1"] - acceptor1 -> proposer2 [label="proposer2"] - acceptor2 -> proposer2 [label="proposer2"] - acceptor3 -> proposer2 [label="proposer2"] - acceptor1 -> learner1 [label="learner1"] - acceptor2 -> learner1 [label="learner1"] - acceptor3 -> learner1 [label="learner1"] + proposer0 -> acceptor1 [label="acceptor1"] + proposer0 -> acceptor2 [label="acceptor2"] + proposer1 -> acceptor0 [label="acceptor0"] + proposer1 -> acceptor1 [label="acceptor1"] }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/paxos.pl Sat Feb 02 15:18:17 2019 +0900 @@ -0,0 +1,37 @@ +#!usr/bin/perl + +my $debug = 0; + +sub mysystem { + my ($cmd) = @_; + if ($debug) { + print $cmd ,"\n"; + } else { + system $cmd; + } +} + +ruby ./paxos.rb $1 $2 $3 > Log/paxos.dot + +my $nodes = $ENV{'PBS_NODEFILE'}; +my $java11binPath = "/mnt/data/christie_workspace/jdk-11.0.1/bin/"; +my $christieDir = "/mnt/data/christie_workspace/"; +my $dotFile = "${christieDir}scripts/Log/paxos.dot" +my $logFile = "${christieDir}Log/"; +my $logNum = "0000"; + +open my $fd,"<",$nodes or die("can't read file $nodes $!"); + +while (<$fd>) { + chop ; + unshift(@nodes,$_); +} + +mysystem("ssh $nodes[0] \"cd $christieDir;${java11binPath}java -cp Christie.jar christie.topology.manager.StartTopologyManager --localPort 10000 --confFile ${dotFile} > $logFile$logNum\" &"); + +$logNum++; +for my $i (1..($#nodes)) { + print "nodes[i]: $i $nodes[$i]\n"; + mysystem("ssh $nodes[$i] \"cd $christieDir;${java11binPath}java -cp Christie.jar christie.test.topology.paxos.StartPaxosNode --localPort 10000 --managerHost $nodes[0] --managerPort 10000 > $logFile$logNum\" &"); + $logNum++; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/paxos.sh Sat Feb 02 15:18:17 2019 +0900 @@ -0,0 +1,27 @@ +#!/bin/bash + + +proposer_num=$1 +acceptor_num=$2 +learner_num=$3 + +max=$(( proposer_num + acceptor_num + learner_num)); +dot_file=Log/paxos.dot +jar_path=../build/libs/Christie.jar +topo_jarname=ChristieStartTopologyManager-1.0.jar +torquetest_jarname=ChristieStartTorqueTestTopology-1.0.jar + +mkdir -p Log + +#ruby ./paxos.rb $proposer_num $acceptor_num $learner_num > ${dot_file} +#dot -Tpng ./topology/ring.dot > ./topology/ring.png +#open ./topology/ring.png +java -cp ${jar_path} christie.topology.manager.StartTopologyManager --localPort 10000 --confFile ${dot_file} & + +cnt=0 +while (($cnt < $max )) +do + (java -cp ${jar_path} christie.test.topology.paxos.StartPaxosNode --managerHost localhost --managerPort 10000 --localPort $(( 10001 + cnt )) --level debug) & + cnt=$(( cnt + 1 )) +done +wait \ No newline at end of file