Hi Jeremy Evans, 
Thank for quick response. 

This is my setting, where can i configure my another master database?
DB=Sequel.connect(:adapter=>'mysql2', :host=>'127.0.0.1',
 :database=>'databaseName', :user=>'root', :password=>'password',
 :max_connections => 30,
 :logger => Logger.new('sequel-log.txt'),
 :servers=>{ :default=>proc{|db| {:host=>db.get_master_host}}
  })

def DB.get_master_host
  @current_master_host ||= -1
  "master_server#{(@current_master_host+=1)%4}"
end

On Thursday, September 25, 2014 11:28:19 AM UTC+8, 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
>

-- 
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.

Reply via email to