Home > Back-end > Session sharing between multiple micro service problems
Session sharing between multiple micro service problems
Time:09-22
Now we have A zuul + redis + springcloud, then there are multiple springboot do service, one of the specialized do personal micro service center, we will do in the service log in operation, and then do business with other micro service, because is the first time to do it, don't know whether this gateway can achieve multiple session sharing between micro service, is our login in A micro service operation, save the user information to the session, and then take A user information in micro service B, multiple micro service project name is not the same, if it is the same service, deployed on A different server that we can do the session sharing,
CodePudding user response:
Use use iphash session consistency haproxy do load balancing
CodePudding user response:
Use redis session sharing also line
CodePudding user response:
Do not recommend system designed this way Micro service database is isolated, you even can share the cache, this is not reasonable, each service access to the session, if personal center, stored in the session object structure change other services have to upgrade? Service can have a way of multiple versions compatible, but only one session you, you this coupling is too high, defeats the purpose of the micro service architecture Advice to make loose login authorization model is better
CodePudding user response:
The Session ID is based on the browser cookies with automatically along with when sending a Request, as long as your gateway service Zuul no filter out cookies, HTTP headers, is your upstream service can get ID for identification, and in the appropriate filter or interceptor to query and packaging to the Request of the Session, as to your Session information is stored in the Redis or some other place, can make, but I remember Spring like on this aspect is support, suggest you look at the Spring Session - this project,