mirror of https://github.com/citusdata/citus.git
Adds worker host parameters
parent
119bf590c8
commit
4b9705f714
|
@ -278,6 +278,7 @@ my $mitmPort = 9060;
|
||||||
my $masterPort = 57636;
|
my $masterPort = 57636;
|
||||||
|
|
||||||
my $workerCount = 2;
|
my $workerCount = 2;
|
||||||
|
my @workerHosts = ();
|
||||||
my @workerPorts = ();
|
my @workerPorts = ();
|
||||||
|
|
||||||
if ( $conninfo )
|
if ( $conninfo )
|
||||||
|
@ -322,20 +323,36 @@ if ( $conninfo )
|
||||||
print $out "s/", substr("$masterPort", 0, length("$masterPort")-2), "[0-9][0-9]/xxxxx/g\n";
|
print $out "s/", substr("$masterPort", 0, length("$masterPort")-2), "[0-9][0-9]/xxxxx/g\n";
|
||||||
|
|
||||||
|
|
||||||
|
my $worker1host = `psql "$conninfo" -t -c "SELECT nodename FROM pg_dist_node ORDER BY nodeid LIMIT 1;"`;
|
||||||
my $worker1port = `psql "$conninfo" -t -c "SELECT nodeport FROM pg_dist_node ORDER BY nodeid LIMIT 1;"`;
|
my $worker1port = `psql "$conninfo" -t -c "SELECT nodeport FROM pg_dist_node ORDER BY nodeid LIMIT 1;"`;
|
||||||
|
my $worker2host = `psql "$conninfo" -t -c "SELECT nodename FROM pg_dist_node ORDER BY nodeid OFFSET 1 LIMIT 1;"`;
|
||||||
my $worker2port = `psql "$conninfo" -t -c "SELECT nodeport FROM pg_dist_node ORDER BY nodeid OFFSET 1 LIMIT 1;"`;
|
my $worker2port = `psql "$conninfo" -t -c "SELECT nodeport FROM pg_dist_node ORDER BY nodeid OFFSET 1 LIMIT 1;"`;
|
||||||
|
|
||||||
|
$worker1host =~ s/^\s+|\s+$//g;
|
||||||
$worker1port =~ s/^\s+|\s+$//g;
|
$worker1port =~ s/^\s+|\s+$//g;
|
||||||
|
$worker2host =~ s/^\s+|\s+$//g;
|
||||||
$worker2port =~ s/^\s+|\s+$//g;
|
$worker2port =~ s/^\s+|\s+$//g;
|
||||||
|
|
||||||
push(@workerPorts, $worker1port);
|
push(@workerPorts, $worker1port);
|
||||||
push(@workerPorts, $worker2port);
|
push(@workerPorts, $worker2port);
|
||||||
|
push(@workerHosts, $worker1host);
|
||||||
|
push(@workerHosts, $worker2host);
|
||||||
|
|
||||||
|
my $worker1hostReplaced = $worker1host;
|
||||||
|
my $worker2hostReplaced = $worker2host;
|
||||||
|
|
||||||
|
$worker1hostReplaced =~ s/\./\\\./g;
|
||||||
|
$worker2hostReplaced =~ s/\./\\\./g;
|
||||||
|
|
||||||
|
print $out "s/\\b$worker1hostReplaced\\b/<host>/g\n";
|
||||||
|
print $out "s/\\b$worker2hostReplaced\\b/<host>/g\n";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for (my $workerIndex = 1; $workerIndex <= $workerCount; $workerIndex++) {
|
for (my $workerIndex = 1; $workerIndex <= $workerCount; $workerIndex++) {
|
||||||
my $workerPort = $masterPort + $workerIndex;
|
my $workerPort = $masterPort + $workerIndex;
|
||||||
push(@workerPorts, $workerPort);
|
push(@workerPorts, $workerPort);
|
||||||
|
push(@workerHosts, "localhost");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -531,6 +548,11 @@ for my $workeroff (0 .. $#workerPorts)
|
||||||
my $port = $workerPorts[$workeroff];
|
my $port = $workerPorts[$workeroff];
|
||||||
print $fh "--variable=worker_".($workeroff+1)."_port=$port ";
|
print $fh "--variable=worker_".($workeroff+1)."_port=$port ";
|
||||||
}
|
}
|
||||||
|
for my $workeroff (0 .. $#workerHosts)
|
||||||
|
{
|
||||||
|
my $host = $workerHosts[$workeroff];
|
||||||
|
print $fh "--variable=worker_".($workeroff+1)."_host=\"$host\" ";
|
||||||
|
}
|
||||||
for my $workeroff (0 .. $#followerWorkerPorts)
|
for my $workeroff (0 .. $#followerWorkerPorts)
|
||||||
{
|
{
|
||||||
my $port = $followerWorkerPorts[$workeroff];
|
my $port = $followerWorkerPorts[$workeroff];
|
||||||
|
|
Loading…
Reference in New Issue