From: Ezra Zygmuntowicz Date: 2006-09-22T03:44:15+09:00 Subject: Re: Question about drb and databases On Sep 21, 2006, at 10:25 AM, Ben Johnson wrote: > Paul Lutus wrote: >> Ben Johnson wrote: >> >>> Let's say I have 2 servers. One has the database, the other >>> doesn't. The >>> main application is being ran on the one with the database. If I >>> was to >>> distribute ruby using DRb to the other server does that process >>> need a >>> different kind of database connection? Basically what I'm asking >>> is do I >>> need to connect to the database using localhost or the IP? >>> Because wont >>> the database calls go over the wire like all of the other calls >>> therefore a localhost connection should work, right? >> >> No -- unless I am not understanding you. But if both machines are >> on the >> same intranet, the IP approach (using an intranet IP) should be >> fairly >> swift. >> >> Strictly speaking, 'localhost' refers to a particular machine's >> self-identity, not to an intranet machine's identity. > > Right, but if I distribute ruby onto a completely different machine > the > ruby files do not have to be present over there do they? Does it cache > them on the other server or do everything over the wire? > > I'm doing a ruby on rails project here. So, if it does everything over > the wire, wouldn't it do the db calls over the wire as well since > the db > calls run through the ActiveRecord files? > > Thanks for your help. > > -- > Posted via http://www.ruby-forum.com/. > Hey Ben- You are going to need to use an IP connection for the drb server on the machine without the database. If you want it to be able to run queries and work with your models it needs a db connection. Unless the only way you access your models is over drb and the models include DRbUndumped on the machine with the database. But I think that for what you are trying to do, you will need to have the drb server on the machine with no database, use an IP address as its host in the database.yml file. -Ezra