wxl bc16459628 first commit | 1 năm trước cách đây | |
---|---|---|
.. | ||
master_service | 1 năm trước cách đây | |
replica_service | 1 năm trước cách đây | |
README.md | 1 năm trước cách đây | |
docker-compose.yml | 1 năm trước cách đây |
It's a simple demo project contains 2 services:
docker-compose up -d db_pgsql db_mysql
docker-compose run master ./manage.py migrate
docker-compose run replica ./manage.py migrate
docker-compose up -d
docker-compose run master ./manage.py cqrs_sync --cqrs-id=user -f={}
docker-compose run master ./manage.py cqrs_sync --cqrs-id=product -f={}
It starts master WEB app on http://127.0.0.1:8000 and replica on http://127.0.0.1:8001
You can do something with model instances via WEB interface or django shell on master and see how data changes in replica too.
The most common and simple way for replication is used for this model.
This model isn't being synchronized separately, only with related Product.
This models uses custom own written serializer and relation optimization.
This models uses Django REST Framework serializer. Replica service stores this model in redis.
You can monitor CQRS queue by tools provided by chosen transport backend.
For this demo we use RabbitMQ with management plugin. You can find it on http://127.0.0.1:15672 with credentials rabbitmq / password
.