Microservices Event Sourcing 是一个微服务架构的在线购物网站,使用Spring Boot、Spring Cloud、Spring Reactor、OAuth2、CQRS 构建,实现了基于Event Sourcing的最终一致性,提供了构建端到端微服务的最佳实践
https://github.com/chaokunyang/microservices-event-sourcing.git
Microservices Event Sourcing 是一个微服务架构的在线购物平台,使用Spring Boot、Spring Cloud、Spring Reactor、OAuth2、CQRS 构建,实现了基于Event Sourcing的最终一致性,提供了构建端到端微服务的最佳实践。
Microservices Event Sourcing使用以下数据库类型.
1、分别为user-service、account-service、catalog-service、shopping-cart-service创建单独的mysql数据库与用户
`` sql
CREATE DATABASE time_store_user CHARACTER SET utf8 COLLATE utf8_general_ci;
grant all privileges on time_store_user.* to 'time'@'localhost' identified by '123456';
grant all privileges on time_store_user.* to 'time'@'127.0.0.1' identified by '123456';
grant all privileges on time_store_user.* to 'time'@'::1' identified by '123456';
flush privileges;
%%CODEBLOCK0%% sql
CREATE DATABASE time_store_account CHARACTER SET utf8 COLLATE utf8_general_ci;
grant all privileges on time_store_account.* to 'time'@'localhost' identified by '123456';
grant all privileges on time_store_account.* to 'time'@'127.0.0.1' identified by '123456';
grant all privileges on time_store_account.* to 'time'@'::1' identified by '123456';
flush privileges;
%%CODEBLOCK1%% sql
CREATE DATABASE time_store_catalog CHARACTER SET utf8 COLLATE utf8_general_ci;
grant all privileges on time_store_catalog.* to 'time'@'localhost' identified by '123456';
grant all privileges on time_store_catalog.* to 'time'@'127.0.0.1' identified by '123456';
grant all privileges on time_store_catalog.* to 'time'@'::1' identified by '123456';
flush privileges;
%%CODEBLOCK2%% sql
CREATE DATABASE time_store_cart CHARACTER SET utf8 COLLATE utf8_general_ci;
grant all privileges on time_store_cart.* to 'time'@'localhost' identified by '123456';
grant all privileges on time_store_cart.* to 'time'@'127.0.0.1' identified by '123456';
grant all privileges on time_store_cart.* to 'time'@'::1' identified by '123456';
flush privileges;
%%CODEBLOCK3%% shell
curl -v -u neo4j:neo4j -X POST localhost:7474/user/neo4j/password -H "Content-type:application/json" -d "{\"password\":\"secret\"}"
``
3、为order-service安装mongo。在 localhost:27017上启动mongo
4、依次启动以下微服务
如果每个服务成功加载,浏览在线购物网站首页。点击登录,你将被重定向到Oauth2.0授权服务器,即user-service。用户名是 user,密码是 password。你将被认证和请求允许对在线购物网站进行令牌授权。在完成授权后,你将被重定向到在线购物网站,然后便可以访问来自边缘服务的受保护资源。
This project is licensed under Apache License 2.0.