小编Jan*_*ück的帖子

如何一对多设计微服务数据库?

我对微服务和数据库设计有疑问。情况:我有一个Service AircraftsService,可以处理有关飞机,飞机类型等的所有数据。我有一个Service FlightsService,可以处理有关航班的所有数据。我必须把飞机和飞机联系起来。通常,我会在链接飞机的飞行表中创建一个外键。但是在微服务架构中,我了解到我拥有域和独立的数据库。所以我的问题是我怎么代表这个问题。

My first thought was that i have a database for all aircrafts and a database for all flights. the flights table becoms a 'indirect' foreign key to the aircraft. When i call the flight service the flight service call the aircraft service with the id from the flight table, then build the response. That promised that i do not call the aircraft database direct from the flight service.

Is my solution correct? What is the best practice …

database foreign-keys microservices

5
推荐指数
1
解决办法
220
查看次数

标签 统计

database ×1

foreign-keys ×1

microservices ×1