Open andyhu1007 opened 6 years ago
activerecord (4.1.8) ar-octopus (0.9.1) mysql2 (0.3.21)
database.yml
shared: &shared host: localhost adapter: mysql2 encoding: utf8 pool: 5 username: tao password: password socket: /tmp/mysql.sock development: <<: *shared database: tao_development test: <<: *shared database: tao_test
shards.yml
octopus: environments: - development - test development: users2: host: localhost adapter: mysql2 encoding: utf8 pool: 5 username: tao password: password socket: /tmp/mysql2.sock database: tao_development2 test: users2: adapter: mysql2 database: tao_test2
Rails console code:
User.using(:users2).connection u =User.using(:users2).first u.current_shard => :users2 User.using(:users2).connection.class => ActiveRecord::ConnectionAdapters::Mysql2Adapter
but it does not return data in shards db, but from master.
anything wrong with my configuration?
Same for me with:
Rails 4.0.13 ar-octopus (0.9.2) pg (0.18.4)
activerecord (4.1.8) ar-octopus (0.9.1) mysql2 (0.3.21)
database.yml
shards.yml
Rails console code:
but it does not return data in shards db, but from master.
anything wrong with my configuration?