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,

https://docs.spring.io/spring-session/docs/current/reference/html5/

CodePudding user response:



The
reference 3 floor maradona1984 response:
system designed this way is not recommended
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


Design for the first time, also didn't bosses lead, don't know how to design the session problem solved now, as long as don't use the path to unify the various micro service path can be Shared, but now we also according to the division micro service database, each service corresponding to a database, some data from other micro service now, don't know what kind of way is reasonable, we are the worst is to simulate HTTP as the interaction between the various micro service

CodePudding user response:

reference 5 floor op520f reply:
Quote: refer to the third floor maradona1984 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


Design for the first time, also didn't bosses lead, don't know how to design the session problem solved now, as long as don't use the path to unify the various micro service path can be Shared, but now we also according to the division micro service database, each service corresponding to a database, some data from other micro service now, don't know what kind of way is reasonable, we are the worst is to simulate HTTP as the interaction between the various micro service



Feign can invoke other services data

CodePudding user response:

Do use iphash when load balancing strategy

CodePudding user response:

https://blog.csdn.net/luckyZQC/article/details/105731463
Refer to the
  • Related