-
Notifications
You must be signed in to change notification settings - Fork 60
14、读写分离一主多从, 仅分库等多数据源使用指南
Bee edited this page Jul 27, 2020
·
6 revisions
DB read-write separation, one master and many slaves
Add DB read-write separation, one master and many slaves, no need to modify the previous code, this function is transparent to the code.
Just need config the following info in bee.properties:
bee.dosql.multi-DS.enable=true
#1:类名字段名与数据库信息映射问题:only r/w, one master and more slave; 2:only more database (table name is same)
bee.dosql.multi-DS.type=1
bee.dosql.multi-DS.defalut-DS=ds1
#when type is 1
bee.dosql.multi-DS.wDB=ds1
bee.dosql.multi-DS.rDB=ds2,ds3
#poll:1, rand:2
bee.dosql.multi-DS.rDB.routeWay=1
only more database
#when type is 2
bee.dosql.multi-DS.db=ds1,ds2,ds3
#不同ds用分号隔开,同一ds用逗号隔开.Different DS are separated by semicolons and the same DS by commas.
bee.dosql.multi-DS.match.entityClassPath=ds2:com.xxx.aa.User,com.xxx.bb.*,com.xxx.cc.**;ds3:com.xxx.dd.User
bee.dosql.multi-DS.match.table=ds2:user