DB读写分离、一主多从
添加DB读写分离、一主多从的,仅分库,对以前的代码无需修改,该功能对代码是透明的.
需要在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
------------------------------------------------------------
Bee,互联网新时代的Java ORM框架,更快、更简单、更自动,开发速度快,运行快,更智能!
更多资料,请查看: