rules:
sharding:
default-database-strategy:
standard:
sharding-column: site
sharding-algorithm-name: databaseInline
default-table-strategy:
none:
sharding-algorithms:
databaseInline:
type: INLINE
props:
algorithm-expression: ds$->{site}
tables:
student_info:
logicTable: student_info
我想问下,下面这个规则,我在DistSQL中应该怎么写
tables:
student_info:
logicTable: student_info
我现在的DistSQL实现
create database demo;
use demo;
ADD RESOURCE demo1 (
HOST=192.168.0.201,
PORT=3306,
DB=demo1,
USER=root,
PASSWORD=Longnows@888
);
ADD RESOURCE demo2 (
HOST=192.168.0.201,
PORT=3306,
DB=demo2,
USER=root,
PASSWORD=Longnows@888
);
SHOW SCHEMA RESOURCES FROM demo;
DROP DEFAULT SHARDING DATABASE STRATEGY;
DROP SHARDING ALGORITHM database_inline;
CREATE SHARDING ALGORITHM database_inline (
TYPE(NAME=inline,PROPERTIES("algorithm-expression"="demo${site}"))
);
CREATE DEFAULT SHARDING DATABASE STRATEGY (
TYPE = standard,SHARDING_COLUMN=site,SHARDING_ALGORITHM=database_inline
);
SHOW SHARDING TABLE RULES;
DROP SHARDING TABLE RULE student_info;
CREATE SHARDING TABLE RULE student_info (
datanodes("demo${1..2}.student_info")
)
SELECT * FROM student_info where site = 1;
我想实现的模式是多租户只分库不分表
tables:
student_info:
logicTable: student_info
这一段怎么转成DistSQL实现