DRb + SSH

S

Saji N. Hameed

Dear Gurus,

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

Thanks in advance,
saji
 
B

Brian Candler

Saji said:
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.
 
S

Saji N. Hameed

* Brian Candler said:
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
 
A

ara.t.howard

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/
 
B

Brian Candler

Ara said:
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.
 
R

Robert Dober

Thanks very much. I have been googleing to no avail. Yes, there are point= ers
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 ;).



--=20
C'est v=E9ritablement utile puisque c'est joli.

Antoine de Saint Exup=E9ry
 
A

ara.t.howard

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...96b0?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/
 
A

ara.t.howard

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 ;-)


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


a @ http://codeforpeople.com/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,197
Messages
2,571,038
Members
47,633
Latest member
BriannaLyk

Latest Threads

Top