由于自己一直痴迷于大型分布式系统的设计原理与实践。奈何条件有限,毕竟还在读书,根本无法接触到真正的分布式,真正的大数据。便只能在自己电脑上通过docker这种虚拟化技术来自己搭建”分布式系统”来玩玩,体验一下分布式Session,分布式事物等等。
这篇文章将搭建出一个”分布式”系统,并先体验分布式系统中Session管理的问题,并通过集中Session管理方案解决
构建两个SpringBoot镜像,提供Session服务。
先使用SpringBoot搭建构建一个Restful 接口,并做一些很简单的Session操作。
Maven:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.4.0.RELEASE</version>
<relativePath></relativePath>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
然后写一个比较简单的Controller:
@SpringBootApplication
@RestController
public