thiagopradi / octopus_sharding_example Goto Github PK
View Code? Open in Web Editor NEWSample Rails app using Octopus Library to Enable database Sharding on ActiveRecord
Home Page: http://github.com/tchandy/octopus
Sample Rails app using Octopus Library to Enable database Sharding on ActiveRecord
Home Page: http://github.com/tchandy/octopus
Hi, I am new to rails and trying out sharding/replication. This example works except that rake db:create kept saying that the master shard was created when it wasnt! Upon manual creation the example worked.
Hi ,
I am trying to use this gem and after adding and installing the gem , i try to do rails s and get the following error
block in replace_gem': Please install the sqlite3 adapter: gem install activerecord-sqlite3-adapter
(sqlite3 is not part of the bundle. Add it to Gemfile.) (LoadError)
from /Users/hrastogi/.rvm/gems/ruby-1.9.2-p320/gems/activerecord-3.2.12/lib/active_record/connection_adapters/sqlite3_adapter.rb:3:in <top (required)>' from /Users/hrastogi/.rvm/gems/ruby-1.9.2-p320/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:251:in
require'
from /Users/hrastogi/.rvm/gems/ruby-1.9.2-p320/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:251:in block in require' from /Users/hrastogi/.rvm/gems/ruby-1.9.2-p320/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:236:in
load_dependency'
from /Users/hrastogi/.rvm/gems/ruby-1.9.2-p320/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:251:in `require'
Whats interesting is that i am using mysql and tried with mysql2 also .
GIT
remote: git://github.com/tchandy/octopus.git
revision: f74656eae32ba4fe698d9a8b15f6344a6f9d4ebe
specs:
ar-octopus (0.5.0beta)
activerecord (>= 2.3.0)
activesupport (>= 2.3.0)
GEM
remote: https://rubygems.org/
specs:
actionmailer (3.2.12)
actionpack (= 3.2.12)
mail (> 2.4.4)> 3.0.0)
actionpack (3.2.12)
activemodel (= 3.2.12)
activesupport (= 3.2.12)
builder (
erubis (> 2.7.0)> 1.0.4)
journey (
rack (> 1.4.5)> 1.2)
rack-cache (
rack-test (> 0.6.1)> 2.2.1)
sprockets (
activemodel (3.2.12)
activesupport (= 3.2.12)
builder (> 3.0.0)> 3.0.2)
activerecord (3.2.12)
activemodel (= 3.2.12)
activesupport (= 3.2.12)
arel (
tzinfo (> 0.3.29)> 0.6)
activeresource (3.2.12)
activemodel (= 3.2.12)
activesupport (= 3.2.12)
activesupport (3.2.12)
i18n (
multi_json (> 1.0)> 3.2.0)
arel (3.0.2)
builder (3.0.4)
coffee-rails (3.2.2)
coffee-script (>= 2.2.0)
railties (
coffee-script (2.2.0)
coffee-script-source
execjs
coffee-script-source (1.6.1)
erubis (2.7.0)
execjs (1.4.0)
multi_json (> 1.0)> 1.16)
hike (1.2.1)
i18n (0.6.4)
journey (1.0.4)
jquery-rails (2.2.1)
railties (>= 3.0, < 5.0)
thor (>= 0.14, < 2.0)
json (1.7.7)
mail (2.4.4)
i18n (>= 0.4.0)
mime-types (
treetop (> 1.4.8)> 1.0)
mime-types (1.21)
multi_json (1.6.1)
mysql2 (0.3.11)
polyglot (0.3.3)
rack (1.4.5)
rack-cache (1.2)
rack (>= 0.4)
rack-ssl (1.3.3)
rack
rack-test (0.6.2)
rack (>= 1.0)
rails (3.2.12)
actionmailer (= 3.2.12)
actionpack (= 3.2.12)
activerecord (= 3.2.12)
activeresource (= 3.2.12)
activesupport (= 3.2.12)
bundler (
railties (= 3.2.12)
railties (3.2.12)
actionpack (= 3.2.12)
activesupport (= 3.2.12)
rack-ssl (> 1.3.2)> 3.4)
rake (>= 0.8.7)
rdoc (
thor (>= 0.14.6, < 2.0)
rake (10.0.3)
rdoc (3.12.2)
json (> 1.4)> 3.2.0)
sass (3.2.7)
sass-rails (3.2.6)
railties (
sass (>= 3.1.10)
tilt (> 1.3)> 1.2)
sprockets (2.2.2)
hike (
multi_json (> 1.0)> 1.0)
rack (
tilt (> 1.1, != 1.3.0)> 1.0, >= 1.0.2)
thor (0.17.0)
tilt (1.3.5)
treetop (1.4.12)
polyglot
polyglot (>= 0.3.1)
tzinfo (0.3.37)
uglifier (1.3.0)
execjs (>= 0.3.0)
multi_json (
PLATFORMS
ruby
DEPENDENCIES
ar-octopus!
coffee-rails (> 3.2.1)> 3.2.3)
jquery-rails
mysql2
rails (= 3.2.12)
sass-rails (
uglifier (>= 1.0.3)
I have added it to a repo
https://github.com/hr1383/myproj1
Line 7 of items_controller.rb is
@items = Item.using(current_user.country.to_sym).all
but isn't this unnecessary because this will be executed within around_filter :select_shard
?
Just to point out that there is a typo in the create_item migration file. It should be:
t.string :name
Rather than 'nome'.
On another note, I upgraded the version of Rails to 3.0.4, and the migration wouldn't run on the sharded database.
The following is my version of the Gemfile:
https://gist.github.com/866382
Please help me in resolving this issue. Thanks in advance,
Jerry
Is it possible to use a postgres DB as a main DB, and connect to a mongoDB shard?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.