A lightweight clustering method for distributed computing with mobile code
Sorry, I just couldn’t resist a little hyperbole in the title.
I am, in fact, talking about this humble command line:
ssh -t somehost perl -e\''$|++; while(<STDIN>){ /^__END__$/ ? last : ( $^A .= $_ ) } eval $^A'\'
After invoking this, you pipe a bunch of Perl code to ssh(1)
’s STDIN, followed by a line containing just __END__
. At this point the code is executed, with anything that followed it into STDIN available to it for reading. Anything the sent code writes to STDIN and/or STDERR will be available on the local end as output from ssh(1)
– business as usual.
Thus, you can send data to the remote host along with the Perl code to munge it and then read back the output: the essence of distributed computing with clusters.