Skip to content

set master only for write operations #24

@clarkyi

Description

@clarkyi

I want set master only for wirte operations,so i set pool_weight is zero
my database.yml like this

development:
  adapter: seamless_database_pool
  database: mydb_development
  username: read_user
  password: abc123
  pool_adapter: mysql2
  port: 3306
  master:
    host: master-db.example.com
    port: 6000
    username: master_user
    password: 567pass
    pool_weight: 0
  read_pool:
    - host: read-db-1.example.com
      pool_weight: 2
    - host: read-db-2.example.com

but when i select my data list then using master not read_pool
my application_controller.rb

class ApplicationController < ActionController::Base
  include SeamlessDatabasePool::ControllerFilter
  use_database_pool :all => :master, [:create, :update, :destroy] => :master
  protect_from_forgery
end

why?? my step is error?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions