#�˿ں�
server.port=561000
#ʵ������
spring.application.name= sharding_order
#��ʾ���ֵ�bean�Ḳ��֮ǰ��ͬ���Ƶ�bean
spring.main.allow-bean-definition-overriding=true
#�����������ָ�������»��ߵı��ֶ�ӳ��Ϊ�շ��ʽ��ʵ��������
mybatis.configuration.map-underscore-to-camel-case=true

#�����Ƿ�Ƭ��������

##��������Դ
spring.shardingsphere.datasource.names=m1,m2,s1,s2
#------------------------------------------------------------------------
#����order_db_1����Դ����
spring.shardingsphere.datasource.m1.type=com.alibaba.druid.pool.DruidDataSource
spring.shardingsphere.datasource.m1.driver-class-name =com.mysql.jdbc.Driver
spring.shardingsphere.datasource.m1.url=jdbc:mysql://localhost:3306/order_db_1?useUnicode=true
spring.shardingsphere.datasource.m1.username=root
spring.shardingsphere.datasource.m1.password=root

#����order_db_1����Դ�ӿ�
spring.shardingsphere.datasource.s1.type=com.alibaba.druid.pool.DruidDataSource
spring.shardingsphere.datasource.s1.driver-class-name =com.mysql.jdbc.Driver
spring.shardingsphere.datasource.s1.url=jdbc:mysql://localhost:3307/order_db_1?useUnicode=true
spring.shardingsphere.datasource.s1.username=root
spring.shardingsphere.datasource.s1.password=root

#��д���룬����ʹӿ��
spring.shardingsphere.sharding.master-slave-rules.ds1.masterDataSourceName=m1
spring.shardingsphere.sharding.master-slave-rules.ds1.slaveDataSourceNames=s1

#-------------------------------------------------------------------------------------

#����order_db_2����Դ����
spring.shardingsphere.datasource.m2.type=com.alibaba.druid.pool.DruidDataSource
spring.shardingsphere.datasource.m2.driver-class-name =com.mysql.jdbc.Driver
spring.shardingsphere.datasource.m2.url=jdbc:mysql://localhost:3306/order_db_2?useUnicode=true
spring.shardingsphere.datasource.m2.username=root
spring.shardingsphere.datasource.m2.password=root

#����order_db_2����Դ�ӿ�
spring.shardingsphere.datasource.s2.type=com.alibaba.druid.pool.DruidDataSource
spring.shardingsphere.datasource.s2.driver-class-name =com.mysql.jdbc.Driver
spring.shardingsphere.datasource.s2.url=jdbc:mysql://localhost:3307/order_db_2?useUnicode=true
spring.shardingsphere.datasource.s2.username=root
spring.shardingsphere.datasource.s2.password=root

#��д���룬����ʹӿ��
spring.shardingsphere.sharding.master-slave-rules.ds2.masterDataSourceName=m2
spring.shardingsphere.sharding.master-slave-rules.ds2.slaveDataSourceNames=s2


#ָ��t_order������ݷֲ�������������ݽڵ�
#spring.shardingsphere.sharding.tables.t_order.actualDataNodes=m$->{1..2}.t_order_$->{1..2}
spring.shardingsphere.sharding.tables.t_order.actualDataNodes=ds$->{1..2}.t_order_$->{1..2}

#ָ��t_order����������ɲ���ΪSNOWFLAKE
spring.shardingsphere.sharding.tables.t_order.keyGenerator.column=order_id
spring.shardingsphere.sharding.tables.t_order.keyGenerator.type=SNOWFLAKE

#t_order�ֱ���ԣ�ָ��t_order��ķ�Ƭ���ԣ���Ƭ���԰�����Ƭ���ͷ�Ƭ�㷨
spring.shardingsphere.sharding.tables.t_order.tableStrategy.inline.shardingColumn=order_id
spring.shardingsphere.sharding.tables.t_order.tableStrategy.inline.algorithmExpression=t_order_$->{order_id % 2+1}

#�ֿ���ԣ���user_idΪ��Ƭ������Ƭ����Ϊuser_id%2+1��user_idΪż������m1����Դ���������m2��
spring.shardingsphere.sharding.tables.t_order.databaseStrategy.inline.shardingColumn=user_id
spring.shardingsphere.sharding.tables.t_order.databaseStrategy.inline.algorithmExpression=ds$->{user_id % 2+1 }

#��sql�����־
spring.shardingsphere.props.sql.show=true

#��־����
logging.level.root=info
logging.level.org.springframework.web=info
logging.level.com.itheima=debug
logging.level.druid.sql=debug
