Table Configuration
Configuring Tables
To configure table settings globally, you may do so during NoBrainer configuration:
NoBrainer.configure do |config|
config.table_options = { :shards => 1, :replicas => 1,
:write_acks => :majority }
end
To configure per table settings, you may use Model.table_config
as such:
class Model
table_config :shards => 2, :replicas => 2,
:write_acks => :single, :durability => :soft
end
Synchronizing Table Schema
When changing the configuration of tables, the new schema must be reflected on the database.
When using Rails, you may use the rake task:
$ rake nobrainer:sync_schema
Programmatically, you may invoke sync_schema
:
NoBrainer.sync_schema
NoBrainer waits for the tables to be ready by default.
You may pass :wait => false
to sync_schema
to skip the wait.