On Wednesday, September 24, 2014 8:28:19 PM UTC-7, henry beh wrote:
>
> I'm trying to do an application it need to connecting *multiple *databases,
> therefore how can i configure the database? itzi using *master and slave
> concept *?
>
> * master and slave concept*
> DB=Sequel.connect('mysql2://master_server/database',
> :servers=>{:read_only=>proc{|db| {:host=>db.get_slave_host}}})
> def DB.get_slave_host
> @current_slave_host ||= -1
> "slave_server#{(@current_slave_host+=1)%4}"
> end
> def DB.get_master_host
> @current_master_host ||= -1
> "master_server#{(@current_master_host+=1)%4}"
> end
>
Well, get_master_host seems unused, but otherwise that looks OK. You don't
state what problems you are having, though, so it's hard to help...
Jeremy
--
You received this message because you are subscribed to the Google Groups
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.