Hi John,

Thank you very much for your help.

Would you have more details about the rules behind org.apache.shardingsphere
.example.algorithm.PreciseModuloShardingTableAlgorithmand and org.apache.
shardingsphere.example.algorithm.RangeModuloShardingTableAlgorithm?

Regards,
Eric Poon

On Sun, May 26, 2019 at 9:49 PM [email protected] <[email protected]>
wrote:

> There are tow different sharding strategies  for databases and tables which
> you can config.
> FIY:
>
> https://github.com/apache/incubator-shardingsphere-example/blob/dev/sharding-jdbc-example/sharding-example/sharding-raw-jdbc-example/src/main/resources/META-INF/sharding-databases-tables-range.yaml
> for
> Sharding-JDBC, but Sharding-Proxy is similar.
>
> We will add using sharding with databases and tables together's document
> later.
>
> ------------------
>
> Liang Zhang (John)
> Apache ShardingSphere & Dubbo
>
>
> Eric <[email protected]> 于2019年5月25日周六 上午5:58写道:
>
> >  Hi,
> >
> > I read the documents that the sharding-proxy example uses user_id in the
> > defaultDatabaseStrategy to decide which database the query routed to. If
> I
> > want to separate the data horizontally for all tables which each table
> may
> > have their own keys, how to configure the yaml file?
> >
> > For example I have database 0 and database 1 with all the tables
> identical.
> > I want the data separated in half bases on the tables' primary keys like
> > the one below. How to write the sharding rules in the yaml file?
> >
> > database0.employee
> > Primary Key: emp_id
> > Sharding Rule: emp_id % 2 = 0
> >
> > database0.computers
> > Primary Key: serial_no
> > Sharding Rule: serial_no % 2 = 0
> >
> > database1.employee
> > Primary Key: emp_id
> > Sharding Rule: emp_id % 2 = 1
> >
> > database1.computers
> > Primary key: serial_no
> > Sharding Rule: serial_no % 2 =1
> >
> > Regards,
> > Eric
> >
>

Reply via email to