DRb + SSH


#1

Dear Gurus,

Any advice and sample code on how to setup DRb over SSH would
be greatly appreciated.

Thanks in advance,
saji


#2

On Nov 6, 2008, at 1:51 AM, Saji N. Hameed wrote:

Dear Gurus,

Any advice and sample code on how to setup DRb over SSH would
be greatly appreciated.

Thanks in advance,
saji

http://segment7.net/projects/ruby/drb/DRbSSL/

a @ http://codeforpeople.com/


#3

Saji N. Hameed wrote:

Any advice and sample code on how to setup DRb over SSH would
be greatly appreciated.

Google “DRbTutorial”. This was hosted on the rubygarden wiki which has
sadly died, but you might be able to find a cached copy.


#4

Saji N. Hameed wrote:

Any advice and sample code on how to setup DRb over SSH would
be greatly appreciated.

Google “DRbTutorial”. This was hosted on the rubygarden wiki which has
sadly died, but you might be able to find a cached copy.

Thanks very much. I have been googleing to no avail. Yes, there are
pointers
to the rubygarden wiki, but as you said the link is dead and I am not
able to find a cached copy.

saji


#5

Any advice and sample code on how to setup DRb over SSH would
be greatly appreciated.

http://segment7.net/projects/ruby/drb/DRbSSL/

Thanks for the suggestion. However, I thought that was for
using DRb with SSL not SSH.

saji


Saji N. Hameed

APEC Climate Center +82 51 668 7470
National Pension Corporation Busan Building 12F
Yeonsan 2-dong, Yeonje-gu, BUSAN 611705 removed_email_address@domain.invalid
KOREA


#6

Saji N. Hameed wrote:

Google “DRbTutorial”. This was hosted on the rubygarden wiki which has
sadly died, but you might be able to find a cached copy.

Thanks very much. I have been googleing to no avail. Yes, there are
pointers
to the rubygarden wiki, but as you said the link is dead and I am not
able to find a cached copy.

Enter the URL into the Wayback Machine at www.archive.org

This gives you:

http://web.archive.org/web/20070711135306/http://wiki.rubygarden.org/Ruby/page/show/DrbTutorial

There is a section headed “Running DRb over ssh”


#7

On Nov 6, 2008, at 5:52 PM, Saji N. Hameed wrote:

Thanks for the suggestion. However, I thought that was for
using DRb with SSL not SSH.

you cannot. you can’t tunnel drb over a single connection - every drb
node is a servant and may need to open up another connection for
certain method calls. you can tunnel the main connection over ssh,
but not subsequent ones as they are dynamic.

a @ http://codeforpeople.com/


#8

This gives you:

http://web.archive.org/web/20070711135306/http://wiki.rubygarden.org/Ruby/page/show/DrbTutorial

There is a section headed “Running DRb over ssh”

Thanks a lot. I appreciate it.

saji


#9

Ara Howard wrote:

On Nov 6, 2008, at 5:52 PM, Saji N. Hameed wrote:

Thanks for the suggestion. However, I thought that was for
using DRb with SSL not SSH.

you cannot. you can’t tunnel drb over a single connection - every drb
node is a servant and may need to open up another connection for
certain method calls. you can tunnel the main connection over ssh,
but not subsequent ones as they are dynamic.

ssh lets you set up port forwarding in both directions. It works fine,
although of course you have to set up the ssh connection yourself first.


#10

Thanks very much. I have been googleing to no avail. Yes, there are pointers
to the rubygarden wiki, but as you said the link is dead and I am not
Your message got cut right here in my mail reader, you will therefore
understand why I am very happy for you ;).


C’est véritablement utile puisque c’est joli.

Antoine de Saint Exupéry


#11

On Nov 7, 2008, at 11:06 AM, Brian C. wrote:

ssh lets you set up port forwarding in both directions. It works fine,
although of course you have to set up the ssh connection yourself
first.

i don’t think that’s true. certain operations in drb will cause a
new connection to be opened up on a new port. it’s not the bi-
directionality that kills you, it’s that you cannot know which ports
drb will use in advance. it’s been a while since i played with this
but block methods, iirc, involve opening up a new connection on an
unknown port

http://groups.google.com/group/ruby-talk-google/browse_thread/thread/df0582e5213b8f21/3efaa1c9e9c896b0?hl=en&lnk=gst&q=drb+ssh#3efaa1c9e9c896b0

possibly i’m wrong, but i played with this for quite a while and,
while i could get simple methods working but not complex ones. i
think the testcase to use is

remote_object.each do |remote_element|
remote_element.method
end

the block cannot be serialzed so the remote_object has to call back to
the client on a new connection - and that’s where things get messy.

hopefully i’m wrong.

cheers.

a @ http://codeforpeople.com/


#12

On Nov 7, 2008, at 11:06 AM, Brian C. wrote:

ssh lets you set up port forwarding in both directions. It works fine,
although of course you have to set up the ssh connection yourself
first.

yeah looks like i might eat my words - hadn’t played with that in a
while but this works

the tunnel - ran from client

ssh -L 4242:localhost:4242 -R 4243:localhost:4243
aragorn.globe.ucar.edu -N

the server

require ‘drb’

DRb.start_service “druby://localhost:4242”, %w( a b c )
puts DRb.uri
DRb.thread.join

the client

require ‘drb’

DRb.start_service ‘druby://localhost:4243’
remote_array = DRbObject.new_with_uri ‘druby://localhost:4242’
remote_array.each{|element| p element}

i guess NAT is an issue, but this does seem to work - not sure how
robustly - but it’s promising :wink:

put this up for posterity here:
http://drawohara.com/post/58529480/ruby-drb-over-an-ssh-tunnel

a @ http://codeforpeople.com/