sofastack / sofa-jarslink

Jarslink is a sofa ark plugin used to manage multi-application deployment
Apache License 2.0
3.04k stars 706 forks source link

关于数据源的问题 #58

Closed fordCheng closed 6 years ago

fordCheng commented 6 years ago

模块中如果要进行数据库操作,需要配置数据源么? 如果模块中配置了数据源,模块加载之后,主系统中会有多个数据源么?

模块最终还是要加载到主系统中的,能复用主系统中配置好的数据源么?

kiral commented 6 years ago

不建议在模块里配置数据源,而是通过接口调用其他系统管理数据。


方腾飞/kiral 并发编程网创始人

Email:tengfei@ifeve.com 微信公众号:ifeves weibo:@方腾飞-清英 Web:http://ifeve.com

On 10 Apr 2018, at 3:50 PM, fordCheng notifications@github.com wrote:

模块中如果要进行数据库操作,需要配置数据源么? 如果模块中配置了数据源,模块加载之后,主系统中会有多个数据源么?

模块最终还是要加载到主系统中的,能复用主系统中配置好的数据源么?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/alibaba/jarslink/issues/58, or mute the thread https://github.com/notifications/unsubscribe-auth/ADpZWGIdqYmvIOUXt4yae_o2RBPACtg6ks5tnGQvgaJpZM4TNwx5.

mylonelyplanet commented 6 years ago

@kiral 请问如果在模块里配置数据源,会有什么问题吗?会有长期稳定性问题吗?谢谢

kiral commented 6 years ago

一个数据源建议给一个系统使用,多系统不建议共用数据源,如果模块之间共用数据源主要是有很多运维成本,因为模块在不同的代码分支里,不能一眼看到该数据源的所有SQL,同样一张表会不会被多模块使用?新增或修改字段会不会影响其他模块?模块的安装和卸载是否能释放数据库连接?

如果给模块使用,要有很多约束,比如模块用的表有统一的前缀。比如A模块的表叫A_XXX,B模块的表叫B_XXX。

方腾飞/kiral 并发编程网创始人

Email:tengfei@ifeve.com 微信公众号:ifeves weibo:@方腾飞-清英 Web:http://ifeve.com

On 10 Apr 2018, at 11:06 PM, mylonelyplanet notifications@github.com wrote:

@kiral https://github.com/kiral 请问如果在模块里配置数据源,会有什么问题吗?会有长期稳定性问题吗?谢谢

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/alibaba/jarslink/issues/58#issuecomment-380135265, or mute the thread https://github.com/notifications/unsubscribe-auth/ADpZWNtUQU2KJopswOij_9H9Ivnw__Siks5tnMqDgaJpZM4TNwx5.