-
Notifications
You must be signed in to change notification settings - Fork 133
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Active Record Multiple Database > Horizontal Sharding #692 #693
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -258,14 +258,13 @@ Observe que o `connected_to` com um *role* definido buscará e trocará para uma | |||||||||
|
||||||||||
## Horizontal sharding | ||||||||||
|
||||||||||
Horizontal sharding is when you split up your database to reduce the number of rows on each | ||||||||||
database server, but maintain the same schema across "shards". This is commonly called "multi-tenant" | ||||||||||
sharding. | ||||||||||
Fragmentação horizontal é quando você divide seu banco de dados para reduzir o número de linhas em cada | ||||||||||
servidor de banco de dados, mas mantém o mesmo esquema em "fragmentos". Isso é comumente chamado de "multilocatário" fragmentação. | ||||||||||
|
||||||||||
The API for supporting horizontal sharding in Rails is similar to the multiple database / vertical | ||||||||||
sharding API that's existed since Rails 6.0. | ||||||||||
A API para suportar fragmentação horizontal no Rails é semelhante ao banco de dados múltiplo / vertical | ||||||||||
API de fragmentação que existe desde o Rails 6.0. | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Acho que essa frase ficou um pouco fora de ordem, pode dar uma olhada? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. claro, nós olhamos para isso |
||||||||||
|
||||||||||
Shards are declared in the three-tier config like this: | ||||||||||
Os fragmentos são declarados na configuração de três camadas como este: | ||||||||||
|
||||||||||
```yaml | ||||||||||
production: | ||||||||||
|
@@ -285,7 +284,7 @@ production: | |||||||||
replica: true | ||||||||||
``` | ||||||||||
|
||||||||||
Models are then connected with the `connects_to` API via the `shards` key: | ||||||||||
Os modelos são então conectados à API `connects_to` por meio da chave` shards`: | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Normalmente não traduzimos o termo model como citado no manual de tradução, pode dar uma olhada? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. claro, nós olhamos para isso |
||||||||||
|
||||||||||
```ruby | ||||||||||
class ApplicationRecord < ActiveRecord::Base | ||||||||||
|
@@ -298,8 +297,8 @@ class ApplicationRecord < ActiveRecord::Base | |||||||||
end | ||||||||||
``` | ||||||||||
|
||||||||||
Then models can swap connections manually via the `connected_to` API. If | ||||||||||
using sharding both a `role` and `shard` must be passed: | ||||||||||
Então, os modelos podem trocar conexões manualmente por meio da API `connected_to`. Se | ||||||||||
usando o sharding, um `role` e um` shard` devem ser passados: | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
|
||||||||||
```ruby | ||||||||||
ActiveRecord::Base.connected_to(role: :writing, shard: :default) do | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. O que acha de traduzir os comentários desse código? Acho que fica legal. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sim boa sugestão |
||||||||||
|
@@ -312,8 +311,8 @@ ActiveRecord::Base.connected_to(role: :writing, shard: :shard_one) do | |||||||||
end | ||||||||||
``` | ||||||||||
|
||||||||||
The horizontal sharding API also supports read replicas. You can swap the | ||||||||||
role and the shard with the `connected_to` API. | ||||||||||
A API de fragmentação horizontal também oferece suporte a réplicas de leitura. Você pode trocar o | ||||||||||
papel e o fragmento com a API `connected_to`. | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
O que acha de incluirmos os termos técnicos para consultas futuras. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sim faz sentido |
||||||||||
|
||||||||||
```ruby | ||||||||||
ActiveRecord::Base.connected_to(role: :reading, shard: :shard_one) do | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. O que acha de traduzir os comentários desse código? Acho que fica legal. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sim boa sugestão |
||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Será que podemos incluir o termo em inglês pra facilitar no entendimento futuro?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
claro, devemos incluir