How do you actually use Starling to communicate between different machines?

147 views
Skip to first unread message

rodmclaughlin

unread,
Aug 4, 2010, 11:27:32 AM8/4/10
to starling
First, if this list has any moderators, could they delete all the
pornographic spam messages? Thanks.

Second, this must sound really dumb, but I can't make Starling
communicate between different machines. I can start Starling on any
machine
sudo starling -d
then
starling = Starling.new 'localhost:22122'
in several Ruby programs and they all communicate

But if I start Starling on machine 10.1.2.229 and then run a Ruby
program like this
starling = Starling.new '10.1.2.229:22122'
it says
"starling.rb:138:in `get_server_for_key': No servers available (all
dead) (MemCache::MemCacheError)
from /usr/lib64/ruby/gems/1.8/gems/memcache-client-1.8.5/lib/
memcache.rb:920:in `request_setup'
from /usr/lib64/ruby/gems/1.8/gems/memcache-client-1.8.5/lib/
memcache.rb:885:in `with_server'
from /usr/lib64/ruby/gems/1.8/gems/memcache-client-1.8.5/lib/
memcache.rb:246:in `_original_get'
from /usr/lib64/ruby/gems/1.8/gems/starling-0.10.1/lib/starling.rb:
14:in `get'
from /usr/lib64/ruby/gems/1.8/gems/starling-0.10.1/lib/starling.rb:
13:in `loop'
from /usr/lib64/ruby/gems/1.8/gems/starling-0.10.1/lib/starling.rb:
13:in `get'"

I read that if you insert the following line into a config.yml file
listens_on: [10.1.2.175:22122, 10.1.2.229:22122]
and run
starling -d -f config.yml
it will work, but it doesn't

I read about Starlilng in 'Distributed Programming with Ruby' by Mark
Bates, but it's lightweight and doesn't answer the question. The
online documentation doesn't say anything either. Has anyone any
ideas?

Thanks a lot, Rod McLaughlin

Nic Benders

unread,
Aug 4, 2010, 11:35:02 AM8/4/10
to starl...@googlegroups.com

On Aug 4, 2010, at 11:27 AM, rodmclaughlin wrote:
> Second, this must sound really dumb, but I can't make Starling
> communicate between different machines. I can start Starling on any
> machine
> sudo starling -d
> then
> starling = Starling.new 'localhost:22122'
> in several Ruby programs and they all communicate
>
> But if I start Starling on machine 10.1.2.229 and then run a Ruby
> program like this
> starling = Starling.new '10.1.2.229:22122'
> it says
> "starling.rb:138:in `get_server_for_key': No servers available (all
> dead) (MemCache::MemCacheError)


You need to make sure that starling is listening on the wildcard address (0.0.0.0), or your interface address (10.1.2.229), and not just on localhost (127.0.0.1).

The easiest way to do this is to pass the "--host 0.0.0.0" argument when starting up starling. I added it as an argument to the starling.rake file I use with my Rails project.

You can confirm that this is working properly with the 'netstat' command. Under Linux you could use:

$ netstat -ntlp | grep 22122
tcp 0 0 0.0.0.0:22122 0.0.0.0:* LISTEN 4796/ruby

This shows that there is a single ruby process, with the PID of 4796, listening on port 22122 on the wildcard interface.

If that is working properly, you will also need to check your firewall, to make sure that TCP port 22122 is open from the client to the server.

rodmclaughlin

unread,
Aug 4, 2010, 12:20:18 PM8/4/10
to starling
Thanks for being alive, Nic. I'll study your solution.
In the meantime, I solved it like this:
Edit /etc/hosts on both machines
Add these lines to both files
10.1.2.175 rmclaughlin
10.1.2.229 rodlaptop
Run starling on rodlaptop like this
sudo starling -d -v -h rodlaptop -p 22122
Run Starling server and client on the other machine like this
URL = 'rodlaptop:22122'
def put( q, msg )
starling = Starling.new URL
starling.set q, msg
end
def get( q )
starling = Starling.new URL
starling.get q
end
and write one program which calls put and another which calls get
Reply all
Reply to author
Forward
0 new messages