CN109547512A - A kind of method and device of the distributed Session management based on NoSQL - Google Patents

A kind of method and device of the distributed Session management based on NoSQL Download PDF

Info

Publication number
CN109547512A
CN109547512A CN201710864855.2A CN201710864855A CN109547512A CN 109547512 A CN109547512 A CN 109547512A CN 201710864855 A CN201710864855 A CN 201710864855A CN 109547512 A CN109547512 A CN 109547512A
Authority
CN
China
Prior art keywords
session
sessionid
session request
request
master node
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201710864855.2A
Other languages
Chinese (zh)
Other versions
CN109547512B (en
Inventor
李海传
郭岳
方炜
余兆成
罗琼
郑海朋
陈润泉
刘兆祥
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
China Mobile Zhejiang Innovation Research Institute Co ltd
China Mobile Communications Group Co Ltd
China Mobile Group Zhejiang Co Ltd
Original Assignee
China Mobile Communications Group Co Ltd
China Mobile Group Zhejiang Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by China Mobile Communications Group Co Ltd, China Mobile Group Zhejiang Co Ltd filed Critical China Mobile Communications Group Co Ltd
Priority to CN201710864855.2A priority Critical patent/CN109547512B/en
Publication of CN109547512A publication Critical patent/CN109547512A/en
Application granted granted Critical
Publication of CN109547512B publication Critical patent/CN109547512B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/56Provisioning of proxy services
    • H04L67/562Brokering proxy services
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/14Session management
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/2866Architectures; Arrangements

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer And Data Communications (AREA)

Abstract

The embodiment of the present invention provide it is a kind of based on NoSQL distributed Session management method and device, this method comprises: receive client send session request, and in session request obtain session request action type and session request sessionID;If session request is write operation, session request is then routed to the master node of cluster server, store the session data of sessionID and session request carrying for the master node and sessionID and session data are synchronized to each slave node of cluster server for the master node;If the session request is read operation, then after judgement knows that the corresponding session data of the sessionID are completed and synchronize, the session request is routed into slave node according to preset load balancing, so that the client reads the session data corresponding with the sessionID according to the sessionID on the slave node.The embodiment of the present invention can guarantee consistency when data are synchronous, and service also can be provided to high-performance under high concurrent scene, and service feature is high.

Description

A kind of method and device of the distributed Session management based on NoSQL
Technical field
The present embodiments relate to Internet communication technology field more particularly to a kind of distributions based on NoSQL The method and device of Session management.
Background technique
Session, that is, session control represents a conversation procedure between application server and client, is generally used for controlling The time-out time that user processed logs in, and storage user log in relevant information.In single application server, Session information There may be in the jvm memory of application server, read-write is all by same application server.But in distributed environment Under, the request of client, which can be supported, is balanced to more application servers, it is therefore desirable to have a kind of mechanism to solve application service Session data sharing problem between device.
Existing distribution Session Managed Solution one: the Session based on browser Cookie is shared.This scheme will Session information is stored into the Cookie of browser, also known as client Session, by Cookie when the page initiates to request In content be sent to Web server together.
Existing distribution Session Managed Solution two: the Session based on traditional database is shared.This scheme will Session information is stored into relevant database, and different application server realizes that Session believes by accessing the database Breath is shared.The program is realized simply, such as the PersistentManager of Tomcat directly supports JDBC database purchase.
Existing distribution Session Managed Solution three: it is based on application server/Servlet container Clustering machine System.This scheme will be present the Session information on separate unit application server and is synchronized in cluster by Session replicanism Other application server.The Clustering mechanism of some common application servers and Servlet container may be implemented The function of Session duplication, such as Tomcat Clustering/Session Replication, Jboss buddy replication。
Existing distribution Session Managed Solution four: the Session based on NFS is shared.This scheme is similar with scheme two, By the storage of Session information into NFS, each server only needs the disk of the storage Session of carry shared server i.e. Can, it realizes relatively simple.
Existing distribution Session Managed Solution five: the Session based on Redis is shared.This scheme believes Session Breath is stored in Redis memory database, and Redis guarantees the High Availabitity of service using the framework of one master and multiple slaves, and read-write is reflected respectively It is mapped on principal and subordinate, the data between principal and subordinate are synchronous to be carried out by asynchronous system.
In existing scheme, the shortcomings that scheme one is the data that Cookie is merely able to the fundamental types such as storage character string, numerical value, And there is limitation in size, quantity;Due to requesting that cookie information will be transmitted every time, bandwidth and network transmission performance have one Fixing is rung;It is problematic in terms of safety, it is easy to be stolen, distort.
In scheme two, database server is more difficult extension relative to application server and resource is more valuable, in high concurrent Web application in, maximum performance bottleneck is generally placed upon database server.So if by Session storage to database Table, high concurrent easily cause database table contention and locking when operating, influence service feature.
The shortcomings that scheme three is that the Session replication performance based on Clustering is poor, and scalability is not high.
The shortcomings that scheme four is that the performance that NFS reads and writes high concurrent is not high, is existed on Hard Disk I/O performance and network bandwidth Larger bottleneck, especially for the scene of the frequent read-write operation of small documents as Session.
The shortcomings that scheme five is under the configuration of read and write abruption, and the data of write operation are not complete from master to slave synchronization Cheng Shi the to be synchronized complete or selection such as can only select to read legacy data (redis configuration if client will read the data It determines).Another drawback, if master failure, can be likely to cause and write in master into slave synchronizing process The loss of data of operation.
In conclusion the prior art is difficult to meet simultaneously performance and data consistency requirement under high concurrent scene.
Summary of the invention
To solve under data inconsistence problems present in existing Session management method and high concurrent scene, client The problems such as holding service feature low, the embodiment of the present invention provide the method and dress of a kind of distributed Session management based on NoSQL It sets.
In a first aspect, the embodiment of the present invention provides a kind of method of distributed Session management based on NoSQL, the party Method includes:
The session request that client is sent is received, and obtains the action type of the session request in the session request With the sessionID of the session request;
If the session request is write operation, the session request is routed to the master node of cluster server, So that the master node stores described in the session data of the sessionID and session request carrying and confession The sessionID and the session data are synchronized to each slave node of cluster server by master node;
If the session request is read operation, know that the corresponding session data of the sessionID are complete in judgement After synchronizing, the session request is routed into slave node according to preset load balancing, for the client root The session data corresponding with the sessionID are read on the slave node according to the sessionID.
Second aspect, the embodiment of the present invention provide a kind of device of distributed Session management based on NoSQL, the dress It sets and includes:
Receiving unit receives the session request that client is sent, and obtains the session request in the session request Action type and the session request sessionID;
The session request is routed to cluster server if the session request is write operation by the first routing unit Master node, so that the master node stores the session number that the sessionID and the session request carry The sessionID and the session data are synchronized to each of cluster server according to and for the master node Slave node;
Secondary route unit knows that the sessionID is corresponding in judgement if the session request is read operation Session data are completed synchronize after, the session request is routed into slave node according to preset load balancing, For the client read on the slave node according to the sessionID it is corresponding with the sessionID described Session data.
The third aspect, the embodiment of the present invention provide a kind of electronic equipment, which includes:
Memory and processor, the processor and the memory complete mutual communication by bus;It is described to deposit Reservoir is stored with the program instruction that can be executed by the processor, and it is as follows that the processor calls described program instruction to be able to carry out Method: receiving the session request that client is sent, and obtain in the session request session request action type and The sessionID of the session request;If the session request is write operation, the session request is routed into cluster service The master node of device, for the session that the master node stores the sessionID and the session request carries The sessionID and the session data are simultaneously synchronized to each of cluster server for the master node by data Slave node;If the session request is read operation, the corresponding session data of the sessionID have been known in judgement After completion synchronizes, the session request is routed into slave node according to preset load balancing, for the client The session data corresponding with the sessionID are read on the slave node according to the sessionID.
Fourth aspect, the embodiment of the present invention provide a kind of computer readable storage medium, are stored thereon with computer program, The computer program realizes following method when being executed by processor: receiving the session request that client is sent, and in the meeting The action type of the session request and the sessionID of the session request are obtained in words request;If the session request is The session request is then routed to the master node of cluster server by write operation, so that the master node stores institute State the session data that sessionID and the session request carry and for the master node by the sessionID and The session data are synchronized to each slave node of cluster server;If the session request is read operation, sentencing It is disconnected know that the corresponding session data of the sessionID are completed and synchronize after, by the session request according to preset load Balance policy routes to slave node, so that the client is read on the slave node according to the sessionID The session data corresponding with the sessionID.
The method and device of distributed Session management provided in an embodiment of the present invention based on NoSQL, by client Increase a kind of middleware device between end and cluster server, bridge is established between cluster server and client, according to client The type of the session request sent and the synchronous regime of client's Session data to be accessed are held, for the session request road By to different server nodes, to solve that service feature under data inconsistence problems and high concurrent scene is not high to ask Topic;In addition, lifting function by providing master gravity treatment, additionally it is possible to solve when the master node of cluster server breaks down Caused by data loss problem.
Detailed description of the invention
Fig. 1 is the distributed Session management architecture figure provided in an embodiment of the present invention based on NoSQL;
Fig. 2 is the process signal of the method for the distributed Session management provided in an embodiment of the present invention based on NoSQL Figure;
Fig. 3 is the illustrative timing diagram of read operation provided in an embodiment of the present invention;
Fig. 4 is the illustrative timing diagram of write operation provided in an embodiment of the present invention;
Fig. 5 is the structural representation of the device of the distributed Session management provided in an embodiment of the present invention based on NoSQL Figure;
Fig. 6 is the structural block diagram of electronic equipment provided in an embodiment of the present invention.
Specific embodiment
In order to make the object, technical scheme and advantages of the embodiment of the invention clearer, below in conjunction with the embodiment of the present invention In attached drawing, technical solution in the embodiment of the present invention is explicitly described, it is clear that described embodiment is the present invention A part of the embodiment, instead of all the embodiments.Based on the embodiments of the present invention, those of ordinary skill in the art are not having Every other embodiment obtained under the premise of creative work is made, shall fall within the protection scope of the present invention.
Fig. 1 is the distributed Session management architecture figure provided in an embodiment of the present invention based on NoSQL.NoSQL (Not Only SQL), refers to non-relational database.NoSQL database is made of NoSQL cluster, which includes one Platform master server and Duo Tai slave server.The NoSQL database provides the reading and storage service of Session data, Namely provide read/write service.The session data of each user are like that key-value pair is equally stored in NoSQL database, In, key is exactly sessionID, and value is exactly the session data that user needs to store.Cluster server is exactly to pass through SessionID distinguishes the session data of different user storage.
As shown in Figure 1, middleware device is between client and NoSQL server, between NoSQL cluster and client Establish bridge.
Fig. 2 is the process signal of the method for the distributed Session management provided in an embodiment of the present invention based on NoSQL Figure.As shown in Fig. 2, method includes the following steps:
S201, the session request that client is sent is received, and obtains the behaviour of the session request in the session request Make the sessionID of type and the session request;
Specifically, when user passes through individual terminal devices (calling user terminal in the following text) first time access client, client meeting A sessionID is distributed for user terminal, and sessionID is back to user terminal, user terminal can save the sessionID, In this way, the access request that client receives just will include sessionID when user's access client again.Also, client It is read operation to be carried out or write operation that end, which also judges the access request that user terminal is sent,.Therefore, client is according to user's Access request and the session request that generates includes at least two information: action type and sessionID.Middleware device receives After the session request that client is sent, the action type and sessionID of the session request are obtained.
If S202, the session request are write operation, the session request is routed to the master of cluster server Node, so that the master node stores the session data of the sessionID and session request carrying and for institute State each slave node that the sessionID and the session data are synchronized to cluster server by master node;
Specifically, if middleware device knows that the session request is write operation, middleware device goes to the session request Master server (i.e. master node), after master server receives the session request, it will talk about request SessionID and session data are stored in the database of master server in the form of key-value pair, and master takes Above-mentioned two information can be synchronized to respectively in the database of each slave server (i.e. slave node) by business device.
Optionally, master server is completed to return to operating result to client after data store.After completing storage Master server can also locally record storage operation, in this way, if master server goes out during storing data When existing failure, middleware can check the corresponding session data of the sessionID on master server by operation note Storage state.
If S203, the session request are read operation, the corresponding session number of the sessionID is known in judgement According to after being completed and synchronizing, the session request is routed into slave node according to preset load balancing, for the visitor Family end the session number corresponding with the sessionID is read on the slave node according to the sessionID According to.
Specifically, if middleware device knows that the session request is read operation, middleware device can be sentenced according to sessionID The synchronous regime for its corresponding session data of breaking, if judgement knows that the session data are write by all slave servers Enter in the database of itself, then the session request is gone into slave server, after slave server receives the session request, Corresponding session data for customer end is found according to the sessionID of session request to read.
Fig. 3 is the illustrative timing diagram of read operation provided in an embodiment of the present invention.
From above embodiment as can be seen that middleware device uses read and write abruption strategy, write if middleware device receives Operation, also referred to as CUD (newly-built/update/deletion) operation, is routed to master node, when receiving R (reading) operation, load balancing is arrived Each slave node, to ensure that the service feature under high concurrent scene;Also, by read operation go to each slave node it Before, the synchronous regime for the session data that can be first accessed client judges, can guarantee that client is accessed in this way Correct session data, rather than stale data.
The method of distributed Session management provided in an embodiment of the present invention based on NoSQL, by client sum aggregate Increase a kind of middleware device between group's server, bridge is established between cluster server and client, is sent according to client Session request type and client's Session data to be accessed synchronous regime, routed to not for the session request Same server node, to solve the problems, such as that the service feature under data inconsistence problems and high concurrent scene is not high.
On the basis of the above embodiments, this method is further comprising the steps of:
Receive the feedback that the slave node is sent after completing the sessionID and session data storage Information;
Specifically, above-mentioned two information can be synchronized to respectively the database of each slave server by master server It is interior, and each slave server is notified that middleware device, middleware device receive slave node after completing data and synchronizing Feedback information.
If receiving the feedback information that all slave nodes are sent, it is determined that the corresponding session of the sessionID Synchronization is completed in data.
Specifically, middleware device can know the sum of slave server in cluster server, be received by statistics The number of feedback information mean sessionID pairs if the number of feedback information is identical as slave server sum The session data answered by master server sync to all slave servers, the database of master server and The data that the database of each slave server is stored are consistent, and ensure that the session data that client needs to access Correctness.
Fig. 4 is the illustrative timing diagram of write operation provided in an embodiment of the present invention.
It is provided in an embodiment of the present invention based on NoSQL distributed Session management method, by middleware device with The interaction of each slave server, the synchronous regime for each session data that can timely update guarantee the strong by one of session data Cause property.
On the basis of the various embodiments described above, this method is further comprising the steps of:
According to the feedback information, the corresponding session data of the sessionID are updated in operation log Synchronously complete state.
Specifically, middleware device locally can be corresponding to record sessionID by way of updating operation log Session data synchronously complete state on each slave server.
For example, the data record form of operation log can are as follows: sessionID and synchronously complete state.Work as middleware device When receiving write operation, middleware device can inquire the sessionID in operation log, then corresponding synchronously complete at its " unfinished " is recorded at state;Then middleware device receives the feedback information of each slave server, if middleware device connects The feedback information of all slave servers is received, then will synchronously complete state and be updated to " being completed ";Conversely, then synchronously completing State is still " unfinished ".
The method of distributed Session management provided in an embodiment of the present invention based on NoSQL, operates day by setting Will can the direct inquiring client terminal session data that are accessed using operation log when middleware device receives read operation State is synchronously completed, and then determines the session request being routed to master server or slave server, so guarantee number According to strong consistency.
On the basis of the various embodiments described above, this method further include:
If the session request is read operation, know that the corresponding session data of the sessionID do not complete in judgement After synchronizing, then the session request is routed into the master node, so that the client exists according to the sessionID The session data corresponding with the sessionID are read on the master node.
Specifically, it is synchronized if middleware device judgement knows that the session data that client to be accessed do not complete also, I.e. there are also part slave servers also in synchronous process, which is then routed to master service by middleware device At device, the newest session data of master server storage are read, without completing number until all slave servers According to synchronization, could be read on slave server.
As can be seen from the above-described embodiment, the distributed Session provided in an embodiment of the present invention based on NoSQL is managed Method can save the read access time of client, in turn ensure client compared with the session secret sharing based on Redis The accuracy of the session data of reading.
On the basis of the various embodiments described above, this method further include:
Receive the master Node registry request that each server is sent in the cluster server;
Specifically, when NoSQL cluster server starts, each server can send master section to middleware device Point registration request, middleware device then receive the master Node registry request that each server is sent.
Optionally, when slave Server Restart or when having new slave server that cluster is added, slave server to Master server initiates full dose synchronization request, and entire memory image is sent to slave server, restarted by master server Afterwards or new addition slave server can also send master node note after synchronously completing memory image to middleware device Volume request.
After receiving the master Node registry request, if not inquiring master Node registry letter in register list Breath then sets master node for the server for sending the master Node registry request, remaining server is set as Slave node.
Specifically, after middleware device receives the request of master Node registry, each clothes can be registered in register list It is engaged in the information of device, such as IP address and and the port of server attribute (master or slave) in the cluster, server Address.When middleware device receives first registration request, due to not yet storing the letter of any server in the register list Breath, namely master node is not present at this time, then the server for sending the registration request is then set as by middleware device Master node;Next, middleware device will continue to receive other registration requests you because master node has been registered, Master server has generated, then other servers are set as slave node by middleware device.
The method of distributed Session management provided in an embodiment of the present invention based on NoSQL, by cluster server Master election is carried out, the availability of NoSQL database is improved.
On the basis of the various embodiments described above, this method further include:
The heartbeat message that the master node is sent is received every preset duration;
Specifically, master server periodically can send heartbeat message to middleware device, and correspondingly, middleware device is then Each preset duration receives the heartbeat message.Middleware device would know that the state of master server is just in this way Often work or failure.If being more than preset duration, middleware device does not receive heartbeat message also, and middleware device is just recognized It breaks down for master server or master server has been deleted.
If being more than that the preset duration does not receive the heartbeat message, to the institute for subscribing to master knot removal event There is server to send master node reselection information, so that each server is sent out after receiving the master node reselection information Master Node registry is sent to request.
Specifically, cluster server can subscribe to master knot removal event in middleware device, in this way, if middleware fills The heartbeat message for not receiving existing master server more than preset duration is set, i.e., existing master server breaks down When, middleware device can send master node reselection information to the Servers-all for subscribing to master knot removal event, and The server for receiving the reselection information can then send the request of master Node registry to middleware device.
As can be seen from the above-described embodiment, middleware device can be monitored master server, work as discovery When master server failure, master server is re-elected from remaining server, further improves NoSQL data The availability in library.
Optionally, when the load balancing in the various embodiments described above includes: polling schemas, randomized policy and minimum response Between tactful at least one.
Specifically, polling schemas refers to that each session request is sequentially allocated according to the time sequencing of request to slave server. Minimum corresponding time parameter method refers to that middleware device can be distributed according to the speed of the response speed of each slave server, it will words Request assignment to Best-case Response Time, namely that slave server that response is most fast.
For example, middleware device has received 3 session requests according to sequencing: session request 1, session request 2 and Session request 3;If there is 5 slave servers: slave1-slave5 in cluster;According to polling schemas, middleware device can be incited somebody to action Above-mentioned 3 session requests route to slave1, slave2 and slave3 respectively.According to minimum response strategy, middleware device The response time of each slave server can be calculated in real time, and then above-mentioned session request 1 is distributed to and responds most fast slave clothes Business device similarly, then session request 2 and 3 is also allocated to and responds most fast slave server.
The method of distributed Session management provided in an embodiment of the present invention based on NoSQL, provides client access Read and write abruption, load-balancing function when NoSQL database improve the overall performance and efficiency of Session management.
Fig. 5 is the structural representation of the device of the distributed Session management provided in an embodiment of the present invention based on NoSQL Figure.As shown in figure 5, the middleware device includes: receiving unit 501, the first routing unit 502 and secondary route unit 503. Wherein:
Receiving unit 501 receives the session request that client is sent, and obtains the session in the session request and ask The sessionID of the action type and the session request asked;If the session request of the first routing unit 502 is write operation, The session request is then routed to the master node of cluster server, for described in master node storage SessionID and the session data of session request carrying simultaneously supply the master node by the sessionID and institute State each slave node that session data are synchronized to cluster server;If the session request of secondary route unit 503 is Read operation, then after judgement knows that the corresponding session data of the sessionID are completed and synchronize, by the session request Route to slave node according to preset load balancing, for the client according to the sessionID described The session data corresponding with the sessionID are read on slave node.
Specifically, using read and write abruption strategy, when receiving unit 501 receives write operation, the first routing unit 502 should Session request is routed to master node;When receiving unit 501 receives read operation, if the judgement of secondary route unit 503 is known Session data have synchronously completed, then by session request load balancing to each slave node.It should be noted that the present invention is real The middleware device for applying example offer is to realize that above method embodiment, function specifically refer to above method implementation Example, details are not described herein again.
The device of distributed Session management provided in an embodiment of the present invention based on NoSQL, passes through receiving unit, the One routing unit and secondary route unit establish bridge between cluster server and client, are asked according to the session that client is sent The synchronous regime of the type and client asked the Session data to be accessed, different services is routed to for the session request Device node, to solve the problems, such as that the service feature under data inconsistence problems and high concurrent scene is not high.
Fig. 6 is the structural block diagram of electronic equipment provided in an embodiment of the present invention.As shown in fig. 6, the electronic equipment includes: to deposit Reservoir 602 and processor 601, the processor 601 and the memory 602 complete mutual communication by bus 603;Institute It states memory 602 and is stored with the program instruction that can be executed by the processor, the processor 601 calls described program to instruct energy Enough execute following method, for example, receive the session request that client is sent, and obtain the meeting in the session request Talk about the action type of request and the sessionID of the session request;If the session request is write operation, by the session Request routes to the master node of cluster server, so that the master node stores the sessionID and the meeting The session data of words request carrying are simultaneously synchronous with the session data by the sessionID for the master node To each slave node of cluster server;If the session request is read operation, the sessionID is known in judgement Corresponding session data are completed synchronize after, the session request is routed into slave according to preset load balancing Node, for the client read on the slave node according to the sessionID it is corresponding with the sessionID The session data.
The embodiment of the present invention also provides a kind of computer program product, and the computer program product is non-temporary including being stored in Computer program on state computer readable storage medium, the computer program include program instruction, when described program instructs When being computer-executed, computer is able to carry out method provided by above-mentioned each method embodiment, for example, receives client The session request of transmission, and obtain in the session request action type and the session request of the session request sessionID;If the session request is write operation, the master that the session request routes to cluster server is saved Point, so that the master node stores described in the session data of the sessionID and session request carrying and confession The sessionID and the session data are synchronized to each slave node of cluster server by master node;If The session request is read operation, then after judgement knows that the corresponding session data of the sessionID are completed and synchronize, The session request is routed into slave node according to preset load balancing, so that the client is according to SessionID reads the session data corresponding with the sessionID on the slave node.
The embodiment of the present invention also provides a kind of computer readable storage medium, the computer-readable recording medium storage meter The instruction of calculation machine, the computer instruction make the computer execute method provided by above-mentioned each method embodiment, for example, The session request that client is sent is received, and obtains the action type and the meeting of the session request in the session request Talk about the sessionID of request;If the session request is write operation, the session request is routed into cluster server Master node, for the session data that the master node stores the sessionID and the session request carries And the sessionID and the session data are synchronized to each slave of cluster server for the master node Node;If the session request is read operation, know that the corresponding session data of the sessionID are completed in judgement After synchronizing, the session request is routed into slave node according to preset load balancing, for the client according to The sessionID reads the session data corresponding with the sessionID on the slave node.
Finally, it should be noted that the above embodiments are merely illustrative of the technical solutions of the present invention, rather than its limitations;Although Present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that: it still may be used To modify the technical solutions described in the foregoing embodiments or equivalent replacement of some of the technical features; And these are modified or replaceed, technical solution of various embodiments of the present invention that it does not separate the essence of the corresponding technical solution spirit and Range.

Claims (10)

1. a kind of method of the distributed Session management based on NoSQL characterized by comprising
The session request that client is sent is received, and obtains action type and the institute of the session request in the session request State the sessionID of session request;
If the session request is write operation, the session request is routed to the master node of cluster server, for The master node stores the session data of the sessionID and session request carrying and supplies the master The sessionID and the session data are synchronized to each slave node of cluster server by node;
If the session request is read operation, know that the corresponding session data of the sessionID are completed together in judgement After step, the session request is routed into slave node according to preset load balancing, so that the client is according to institute It states sessionID and reads the session data corresponding with the sessionID on the slave node.
2. the method according to claim 1, wherein further include:
Receive the feedback letter that the slave node is sent after completing the sessionID and session data storage Breath;
If receiving the feedback information that all slave nodes are sent, it is determined that the corresponding session data of the sessionID Synchronization is completed.
3. according to the method described in claim 2, it is characterized by further comprising:
According to the feedback information, the synchronization of the corresponding session data of the sessionID is updated in operation log Completion status.
4. the method according to claim 1, wherein further include:
If the session request is read operation, knows that the corresponding session data of the sessionID do not complete in judgement and synchronize Afterwards, then the session request is routed into the master node, for the client according to the sessionID described The session data corresponding with the sessionID are read on master node.
5. the method according to claim 1, wherein further include:
Receive the master Node registry request that each server is sent in the cluster server;
After receiving the master Node registry request, if not inquiring master Node registry information in register list, Master node then is set by the server for sending the master Node registry request, remaining server is set as slave Node.
6. according to the method described in claim 5, it is characterized by further comprising:
The heartbeat message that the master node is sent is received every preset duration;
If being more than that the preset duration does not receive the heartbeat message, to all clothes for subscribing to master knot removal event Business device sends master node reselection information, so that each server is sent after receiving the master node reselection information The request of master Node registry.
7. the method according to claim 1, wherein the preset load balancing specifically includes: poll At least one of strategy, randomized policy and Best-case Response Time strategy.
8. a kind of device of the distributed Session management based on NoSQL characterized by comprising
Receiving unit receives the session request that client is sent, and the behaviour of the session request is obtained in the session request Make the sessionID of type and the session request;
The session request is routed to cluster server if the session request is write operation by the first routing unit Master node, for the session data that the master node stores the sessionID and the session request carries And the sessionID and the session data are synchronized to each slave of cluster server for the master node Node;
Secondary route unit knows that the sessionID is corresponding in judgement if the session request is read operation Session data are completed synchronize after, the session request is routed into slave node according to preset load balancing, For the client read on the slave node according to the sessionID it is corresponding with the sessionID described Session data.
9. a kind of electronic equipment characterized by comprising
Memory and processor, the processor and the memory complete mutual communication by bus;The memory It is stored with the program instruction that can be executed by the processor, the processor calls described program instruction to be able to carry out right such as and wants Seek 1 to 7 any method.
10. a kind of computer readable storage medium, is stored thereon with computer program, which is characterized in that the computer program The method as described in claim 1 to 7 is any is realized when being executed by processor.
CN201710864855.2A 2017-09-22 2017-09-22 NoSQL-based distributed Session management method and device Active CN109547512B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710864855.2A CN109547512B (en) 2017-09-22 2017-09-22 NoSQL-based distributed Session management method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710864855.2A CN109547512B (en) 2017-09-22 2017-09-22 NoSQL-based distributed Session management method and device

Publications (2)

Publication Number Publication Date
CN109547512A true CN109547512A (en) 2019-03-29
CN109547512B CN109547512B (en) 2021-09-03

Family

ID=65830585

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710864855.2A Active CN109547512B (en) 2017-09-22 2017-09-22 NoSQL-based distributed Session management method and device

Country Status (1)

Country Link
CN (1) CN109547512B (en)

Cited By (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110493340A (en) * 2019-08-21 2019-11-22 北京小米移动软件有限公司 Session method and device in distributed system
CN110839084A (en) * 2019-11-19 2020-02-25 中国建设银行股份有限公司 Session management method, device, equipment and medium
CN110909076A (en) * 2019-10-31 2020-03-24 北京浪潮数据技术有限公司 Storage cluster data synchronization method, device, equipment and storage medium
CN111258822A (en) * 2020-01-15 2020-06-09 广州虎牙科技有限公司 Data processing method, server and computer readable storage medium
CN111651332A (en) * 2020-02-24 2020-09-11 中国工程物理研究院计算机应用研究所 Large-scale heterogeneous equipment integrated control method based on message middleware
CN111885148A (en) * 2020-07-21 2020-11-03 中国工商银行股份有限公司 Session synchronization method and device
CN112929453A (en) * 2021-03-26 2021-06-08 建信金融科技有限责任公司 Method and device for sharing session data
CN113347231A (en) * 2021-05-12 2021-09-03 浪潮软件股份有限公司 High-performance distributed Session solution
CN113382044A (en) * 2021-05-24 2021-09-10 广东好太太智能家居有限公司 Session information sharing method, system and storage medium based on replication mechanism
CN113535430A (en) * 2021-07-16 2021-10-22 深圳华锐金融技术股份有限公司 Application data read-write separation method and device, computer equipment and storage medium
CN114979234A (en) * 2022-04-22 2022-08-30 中国工商银行股份有限公司 Session control sharing method and system in distributed cluster system
CN115098573A (en) * 2022-06-20 2022-09-23 上海爱可生信息技术股份有限公司 Method for realizing database read-write separation

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2002013442A2 (en) * 2000-08-04 2002-02-14 Intellon Corporation Method and protocol to support contention-free intervals and qos in a csma network
US20120315897A1 (en) * 2010-11-05 2012-12-13 Research In Motion Limited Mobile Communication Device with Subscriber Identity Module
CN105824957A (en) * 2016-03-30 2016-08-03 电子科技大学 Query engine system and query method of distributive memory column-oriented database
CN106027647A (en) * 2016-05-20 2016-10-12 云南云电同方科技有限公司 LXPFS (Linux XProgram File System) cluster distributed file storage system
CN106331813A (en) * 2016-09-23 2017-01-11 四川长虹电器股份有限公司 Method enabling smart phone to control smart television through public network
US20170093961A1 (en) * 2015-09-28 2017-03-30 Verizon Patent And Licensing Inc. Networking functions in a micro-services architecture

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2002013442A2 (en) * 2000-08-04 2002-02-14 Intellon Corporation Method and protocol to support contention-free intervals and qos in a csma network
US20120315897A1 (en) * 2010-11-05 2012-12-13 Research In Motion Limited Mobile Communication Device with Subscriber Identity Module
US20170093961A1 (en) * 2015-09-28 2017-03-30 Verizon Patent And Licensing Inc. Networking functions in a micro-services architecture
CN105824957A (en) * 2016-03-30 2016-08-03 电子科技大学 Query engine system and query method of distributive memory column-oriented database
CN106027647A (en) * 2016-05-20 2016-10-12 云南云电同方科技有限公司 LXPFS (Linux XProgram File System) cluster distributed file storage system
CN106331813A (en) * 2016-09-23 2017-01-11 四川长虹电器股份有限公司 Method enabling smart phone to control smart television through public network

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
K. MURAKAMI: "Mobility management alternatives for migration to mobile Internet session-based services", 《IEEE》 *
严义: "主从模式下通信协议策略及优化算法研究", 《计算机应用与软件》 *

Cited By (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110493340B (en) * 2019-08-21 2023-08-04 北京小米移动软件有限公司 Session method and device in distributed system
CN110493340A (en) * 2019-08-21 2019-11-22 北京小米移动软件有限公司 Session method and device in distributed system
CN110909076A (en) * 2019-10-31 2020-03-24 北京浪潮数据技术有限公司 Storage cluster data synchronization method, device, equipment and storage medium
CN110839084A (en) * 2019-11-19 2020-02-25 中国建设银行股份有限公司 Session management method, device, equipment and medium
CN111258822A (en) * 2020-01-15 2020-06-09 广州虎牙科技有限公司 Data processing method, server and computer readable storage medium
CN111258822B (en) * 2020-01-15 2024-02-27 广州虎牙科技有限公司 Data processing method, server, and computer-readable storage medium
CN111651332A (en) * 2020-02-24 2020-09-11 中国工程物理研究院计算机应用研究所 Large-scale heterogeneous equipment integrated control method based on message middleware
CN111885148A (en) * 2020-07-21 2020-11-03 中国工商银行股份有限公司 Session synchronization method and device
CN112929453A (en) * 2021-03-26 2021-06-08 建信金融科技有限责任公司 Method and device for sharing session data
CN113347231A (en) * 2021-05-12 2021-09-03 浪潮软件股份有限公司 High-performance distributed Session solution
CN113382044A (en) * 2021-05-24 2021-09-10 广东好太太智能家居有限公司 Session information sharing method, system and storage medium based on replication mechanism
CN113535430A (en) * 2021-07-16 2021-10-22 深圳华锐金融技术股份有限公司 Application data read-write separation method and device, computer equipment and storage medium
CN114979234A (en) * 2022-04-22 2022-08-30 中国工商银行股份有限公司 Session control sharing method and system in distributed cluster system
CN115098573A (en) * 2022-06-20 2022-09-23 上海爱可生信息技术股份有限公司 Method for realizing database read-write separation

Also Published As

Publication number Publication date
CN109547512B (en) 2021-09-03

Similar Documents

Publication Publication Date Title
CN109547512A (en) A kind of method and device of the distributed Session management based on NoSQL
US11010358B2 (en) Data migration method and system
US10185497B2 (en) Cluster federation and trust in a cloud environment
CN105607954B (en) A kind of method and apparatus that stateful container migrates online
US10496667B2 (en) System and method for maintaining a master replica for reads and writes in a data store
US20150269239A1 (en) Storage device selection for database partition replicas
US11726984B2 (en) Data redistribution method and apparatus, and database cluster
US20130007253A1 (en) Method, system and corresponding device for load balancing
CN110365750A (en) Service registration system and method
US20120233118A1 (en) Multi-Cluster Container Replication
CN101771723A (en) Data synchronization method
US9367261B2 (en) Computer system, data management method and data management program
CN111400112B (en) Writing method and device of storage system of distributed cluster and readable storage medium
US20150317371A1 (en) Method, device, and system for peer-to-peer data replication and method, device, and system for master node switching
CN101741830A (en) Method, system, client and server for realizing multi-client data synchronization
CN102333029A (en) Routing method in server cluster system
KR101545626B1 (en) System for interoperation between dds and dbms
CN106713391A (en) Session information sharing method and sharing system
WO2022111188A1 (en) Transaction processing method, system, apparatus, device, storage medium, and program product
CN110830574B (en) Method for realizing intranet load balance based on docker container
KR20130114575A (en) Leader arbitration for provisioning services
WO2016082594A1 (en) Data update processing method and apparatus
CN106921721A (en) A kind of server, conversation managing method and system
CN108347455A (en) Metadata exchange method and system
CN101778131A (en) Data synchronization system

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
CP01 Change in the name or title of a patent holder

Address after: No. 19, Jiefang East Road, Hangzhou, Zhejiang Province, 310016

Patentee after: CHINA MOBILE GROUP ZHEJIANG Co.,Ltd.

Patentee after: CHINA MOBILE COMMUNICATIONS GROUP Co.,Ltd.

Address before: No. 19, Jiefang East Road, Hangzhou, Zhejiang Province, 310016

Patentee before: CHINA MOBILE GROUP ZHEJIANG Co.,Ltd.

Patentee before: CHINA MOBILE COMMUNICATIONS Corp.

CP01 Change in the name or title of a patent holder
TR01 Transfer of patent right

Effective date of registration: 20231226

Address after: No. 19, Jiefang East Road, Hangzhou, Zhejiang Province, 310016

Patentee after: CHINA MOBILE GROUP ZHEJIANG Co.,Ltd.

Patentee after: China Mobile (Zhejiang) Innovation Research Institute Co.,Ltd.

Patentee after: CHINA MOBILE COMMUNICATIONS GROUP Co.,Ltd.

Address before: No. 19, Jiefang East Road, Hangzhou, Zhejiang Province, 310016

Patentee before: CHINA MOBILE GROUP ZHEJIANG Co.,Ltd.

Patentee before: CHINA MOBILE COMMUNICATIONS GROUP Co.,Ltd.

TR01 Transfer of patent right