[英]spring boot different instances of a microservice and data integrity
If several instance of a same microservice contain their own database,for scalability, how update all the databases when a create, update or delete operation is made ? 如果同一个微服务的多个实例包含自己的数据库,那么为了可伸缩性,如何在创建,更新或删除操作时更新所有数据库? which tool compatible with Eureka and Zuul spring propose for that ? 哪个工具与Eureka和Zuul弹簧兼容?
I would suggest you use an Event-based architecture where any service has done his work it produces the event and other services subscribe that event will also start his work. 我建议你使用一个基于事件的架构,其中任何服务完成了他的工作,它产生了事件,其他服务订阅该事件也将开始他的工作。
you can use Kafka queue
for same. 你可以使用Kafka queue
。 also, read Distributed Sagas for Microservices 另外,阅读微服务的分布式Sagas
One more thing is that inter-communication use UDP instead of TCP. 还有一件事是通信间使用UDP而不是TCP。
Most of the databases offer replication these days with near 0 latency. 目前,大多数数据库提供复制,延迟接近0。 Unless you use the other databases you can let the database do the synchronization for you. 除非您使用其他数据库,否则您可以让数据库为您执行同步。
I would suggest you to use RabbitMQ 我建议你使用RabbitMQ
The basic architecture of a message queue is simple, there are client applications called producers that create messages and deliver them to the broker (the message queue). 消息队列的基本体系结构很简单,有些客户端应用程序称为生成器,它们创建消息并将它们传递给代理(消息队列)。 Other applications, called consumers, connects to the queue and subscribes to the messages to be processed. 其他称为使用者的应用程序连接到队列并订阅要处理的消息。 A software can be a producer, or consumer, or both a consumer and a producer of messages. 软件可以是生产者,消费者,也可以是消费者和消息的生产者。 Messages placed onto the queue are stored until the consumer retrieves them. 放置在队列中的消息将被存储,直到消费者检索它们。
Why to use this RabbitMQ?? 为什么要使用这个RabbitMQ? https://www.cloudamqp.com/blog/2015-05-18-part1-rabbitmq-for-beginners-what-is-rabbitmq.html https://www.cloudamqp.com/blog/2015-05-18-part1-rabbitmq-for-beginners-what-is-rabbitmq.html
Official document for rabbitMQ.... https://www.rabbitmq.com/ rabbitMQ的官方文件.... https://www.rabbitmq.com/
How to install rabbitMQ: https://www.journaldev.com/11655/spring-rabbitmq 如何安装rabbitMQ: https ://www.journaldev.com/11655/spring-rabbitmq
Configuration in spring boot application: Spring启动应用程序中的配置:
https://spring.io/guides/gs/messaging-rabbitmq/ https://spring.io/guides/gs/messaging-rabbitmq/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.