README.md in distribute_reads-0.2.4 vs README.md in distribute_reads-0.3.0
- old
+ new
@@ -135,10 +135,20 @@
lag_failover: true,
failover: false
}
```
+### Logging
+
+Messages about failover are logged to the Active Record logger by default. Set a different logger with:
+
+```ruby
+DistributeReads.logger = Logger.new(STDERR)
+```
+
+Or use `nil` to disable logging.
+
## Distribute Reads by Default
At some point, you may wish to distribute reads by default.
```ruby
@@ -158,9 +168,29 @@
Get replication lag in seconds
```ruby
DistributeReads.replication_lag
```
+
+Most of the time, Makara does a great job automatically routing queries to replicas. If it incorrectly routes a query to primary, you can use:
+
+```ruby
+distribute_reads(replica: true) do
+ # send all queries in block to replica
+end
+```
+
+## Rails 6
+
+Rails 6 has [native support for replicas](https://edgeguides.rubyonrails.org/active_record_multiple_databases.html) :tada:
+
+```ruby
+ActiveRecord::Base.connected_to(role: :reading) do
+ # do reads
+end
+```
+
+However, it’s not able to automatically route queries like Makara just yet.
## Thanks
Thanks to [TaskRabbit](https://github.com/taskrabbit) for Makara, [Sherin Kurian](https://github.com/sherinkurian) for the max lag option, and [Nick Elser](https://github.com/nickelser) for the write-through cache.