Summary of the invention
In view of this, the application provides a kind of method and apparatus of supporting the expansion of Internet of things middleware cluster, can realize the expansion of Internet of things middleware, thereby guarantee carrying out smoothly of operation requests in Internet of things system, further can also make load balancing transponder really realize the function of load balancing.。
To achieve these goals, the existing scheme proposing is as follows:
A method of supporting the expansion of Internet of things middleware cluster, comprising:
Reception, for the control command of things-internet gateway, utilizes load balancing transponder described control command to be mail to the server of any one Internet of things middleware;
If store described Internet of things middleware in the long Connection Cache district building in advance, be not connected with the long of described things-internet gateway, and the long relevant information that stores described things-internet gateway in mapping table that connects building in advance,,
According to the IP information of carrying in described relevant information, set up and being connected of described things-internet gateway, and described control command is mail to described things-internet gateway.
Preferably, before the control command of described reception for things-internet gateway, also comprise:
The registration message sending according to the things-internet gateway receiving, sets up with the long of described things-internet gateway and is connected;
In the long Connection Cache district building in advance described in described long connection is deposited in, meanwhile, using the relevant information of the relevant information of described things-internet gateway and described Internet of things middleware as mapping relations, be stored in build in advance long and connect in mapping table.
Preferably, the relevant information of described things-internet gateway comprises: the IP information of the id information of things-internet gateway and things-internet gateway.
Preferably, the relevant information of described Internet of things middleware comprises: the IP information of the id information of Internet of things middleware and Internet of things middleware.
Preferably, described described control command is mail to described things-internet gateway after, also comprise:
The logout message sending according to the described things-internet gateway receiving is removed long connection of storing in described long Connection Cache district,, the described long mapping relations of storing in mapping table that connect is removed meanwhile.
A system of supporting the expansion of Internet of things middleware cluster, comprising: receiving element, construction unit, judging unit and transmitting element, wherein:
Described receiving element, for receiving the control command for things-internet gateway, utilizes load balancing transponder described control command to be mail to the server of any one Internet of things middleware;
Described construction unit, for building in advance long Connection Cache district and the long mapping table that connects;
The described judging unit being connected with described receiving element and described construction unit respectively, for judging whether the described long Connection Cache district of described construction unit structure stores described Internet of things middleware and be connected with the long of described things-internet gateway, and, the long relevant information that whether stores described things-internet gateway in mapping table that connects building in advance described in judgement;
The described transmitting element being connected with described judging unit, for the long Connection Cache district that ought build in advance, not storing described Internet of things middleware is connected with the long of described things-internet gateway, and while storing the relevant information of described things-internet gateway in the long connection mapping table building in advance, according to the IP information of carrying in described relevant information, set up and being connected of described things-internet gateway, and described control command is mail to described things-internet gateway.
Preferably, also comprise the registering unit being connected with described receiving element, wherein:
Described registering unit comprises sets up unit and memory cell;
The described unit of setting up, for the registration message sending according to the things-internet gateway receiving, sets up with the long of described things-internet gateway and is connected;
Described memory cell, be used for the long Connection Cache district building in advance described in described long connection is deposited in, meanwhile, using the relevant information of the relevant information of described things-internet gateway and described Internet of things middleware as mapping relations, being stored in build in advance long connects in mapping table.
Preferably, the relevant information of described things-internet gateway comprises: the IP information of the id information of things-internet gateway and things-internet gateway.
Preferably, the relevant information of described Internet of things middleware comprises: the IP information of the id information of Internet of things middleware and Internet of things middleware.
Preferably, also comprise the cancellation unit being connected with described transmitting element, the long connection of described long Connection Cache district being stored for the logout message sending according to the described things-internet gateway receiving removes, and, the described long mapping relations of storing in mapping table that connect removed meanwhile.
From above-mentioned technical scheme, can find out, the method and system of the disclosed support Internet of things middleware of the application cluster expansion, by the long Connection Cache district building in advance, storing Internet of things middleware is connected with growing of things-internet gateway and grows connection mapping table and store the expansion that the relevant information of things-internet gateway is supported Internet of things middleware cluster, once being forwarded to, the request of control do not set up on the long server connecting, can be from the long IP address information of obtaining things-internet gateway mapping table that connects, and set up being connected of Internet of things middleware server and things-internet gateway, rather than set up on the long server connecting before leaveing no choice but request to be forwarded to.The method has not only realized the expansion of Internet of things middleware cluster, and the function of load balancing that made the real realization of load balancing transponder.
Embodiment
Below in conjunction with the accompanying drawing in the embodiment of the present application, the technical scheme in the embodiment of the present application is clearly and completely described, obviously, described embodiment is only the application's part embodiment, rather than whole embodiment.Embodiment based in the application, those of ordinary skills are not paying all other embodiment that obtain under creative work prerequisite, all belong to the scope of the application's protection.
For solving in prior art, the agreement of existing load balancing transponder is not considered the long this situation connecting and is caused operation requests failure, simultaneously, make load balancing transponder can not really realize the such technical problem of function of load balancing, realize the expansion of Internet of things middleware cluster, further make the real function that realizes load balancing of load balancing transponder, the application provides following technical scheme:
Embodiment mono-
As shown in Figure 1, Fig. 1 is the disclosed a kind of flow chart of supporting the method for Internet of things middleware cluster expansion of the embodiment of the present application one.The method comprises:
S101: receive the control command for things-internet gateway, control command is mail to the server of any one Internet of things middleware.
Concrete, Internet of Things application program is sent control command to certain things-internet gateway, and Internet of things middleware cluster receives the control command for things-internet gateway, utilizes load balancing transponder control command to be mail to the server of any one Internet of things middleware.
Wherein, control command is sent by Internet of Things application program, for controlling its things-internet gateway that will control, carries out corresponding action.In wisdom road lamp system, control command can be instruction or the instruction of turning off the light of turning on light, and can certainly be other instructions, and this is not restricted.
S102: whether store Internet of things middleware in the long Connection Cache district that judgement builds in advance and be connected with the long of things-internet gateway, if so, connect and carry out step S105 by length, if not, carry out step S103.
Such as, in wisdom road lamp system, when the application program of the wisdom road lamp system Centralized Controller that is 0A0B5301 to ID sends while turning off the light order, Internet of things middleware load balancing transponder is forwarded to this control command on the Internet of things middleware that ID is 0102440A, this Internet of things middleware checks the long Connection Cache district that it builds in advance, find to have set up with ID the long of the Centralized Controller that is 0A0B5301 and be connected, directly send control command.
S103: the long relevant information that whether stores things-internet gateway in mapping table that connects that judgement builds in advance, if so, carry out step S104, if not, return to step S101.
In above-mentioned wisdom road lamp system, if Internet of things middleware load balancing transponder is forwarded to this control command on the Internet of things middleware that ID is 0102440B, in the long Connection Cache district that this Internet of things middleware builds in advance at it, cannot find with the long of things-internet gateway and be connected, so, this Internet of things middleware then build in advance long take in connecting mapping table " gateway ID=0A0B5301 " inquire about as querying condition, successfully find and record <0A0B5301,10.0.0.58,0102440A, 172.168.0.21>.
If the long relevant information of not storing things-internet gateway in mapping table that connects building in advance, Internet of things middleware is to Internet of Things application feeding back unsuccessful information, pointing out unsuccessfully, can be specifically that a miscue frame is ejected in Internet of Things application, so that re-start step S101.
S104: set up and being connected of things-internet gateway according to the IP information of carrying in relevant information.
Concrete, utilize web socket (socket) set up with IP address between be connected, make to communicate by network application-level protocols such as HTTP, thus being connected of foundation and things-internet gateway.
As mentioned above, the IP=10.0.0.58 of things-internet gateway is taken out, after connecting with things-internet gateway, can send control command.
S105: control command is mail to things-internet gateway.
Control command is mail to Internet of Things application program and want the things-internet gateway of controlling, realize the control to this things-internet gateway.
As from the foregoing, the embodiment of the present application one is openly supported the method for Internet of things middleware cluster expansion, by the long Connection Cache district building in advance, storing Internet of things middleware is connected with growing of things-internet gateway and grows connection mapping table and store the expansion that the relevant information of things-internet gateway is supported Internet of things middleware cluster, once being forwarded to, the request of control do not set up on the long server connecting, can be from the long IP address information of obtaining things-internet gateway mapping table that connects, and set up being connected of Internet of things middleware server and things-internet gateway, rather than set up on the long server connecting before leaveing no choice but request to be forwarded to.The method has not only realized the expansion of Internet of things middleware cluster, and the function of load balancing that made the real realization of load balancing transponder.
Embodiment bis-
The embodiment of the present application two discloses the method for another kind of support Internet of things middleware cluster expansion, and as shown in Figure 2, Fig. 2 is the disclosed a kind of flow chart of supporting the method for Internet of things middleware cluster expansion of the embodiment of the present application two.The method comprises:
S201: the registration message sending according to the things-internet gateway receiving, set up with the long of things-internet gateway and be connected.
After things-internet gateway access network, send message register to Internet of things middleware, Internet of things middleware receives registration message, sets up with the long of things-internet gateway and is connected.
S202: long connection deposited in the long Connection Cache district building in advance, meanwhile, be stored in build in advance long using the relevant information of the relevant information of things-internet gateway and Internet of things middleware as mapping relations and connect in mapping table.
Wherein, long Connection Cache district and long these two unit of mapping table that connect can be realized by modes such as building database, buffer memorys, at this, do not limit, and can select as the case may be.
The relevant information of things-internet gateway comprises: the IP information of the id information of things-internet gateway and things-internet gateway.The relevant information of Internet of things middleware comprises: the IP information of the id information of Internet of things middleware and Internet of things middleware.
Concrete, by depositing in being connected with things-internet gateway long of setting up in the long Connection Cache district that Internet of things middleware builds in advance, the id information of the id information of things-internet gateway, IP information and Internet of things middleware, IP information four-tuple are deposited in the length connection mapping table building in advance with mapping relations simultaneously.
Such as in wisdom road lamp system, when having accessed new Centralized Controller (being things-internet gateway), Centralized Controller can send registration message to Internet of things middleware, comprises ID (0A0B5301) and the IP (10.0.0.58) of this Centralized Controller in message.Internet of things middleware is set up with the long of Centralized Controller and is connected, and long connection deposited in the long Connection Cache district building in advance, obtain ID (0102440A) and the IP (172.168.0.21) of this Internet of things middleware simultaneously, ID and IP together with Centralized Controller generate four-tuple mapping relations <0A0B5301,10.0.0.58,0102440A, 172.168.0.21>, deposits the long mapping table that connects building in advance in.
S203: receive the control command for things-internet gateway, control command is mail to the server of any one Internet of things middleware.
Concrete, Internet of Things application program is sent control command to certain things-internet gateway, and Internet of things middleware cluster receives the control command for things-internet gateway, utilizes load balancing transponder control command to be mail to the server of any one Internet of things middleware.
S204: whether store Internet of things middleware in the long Connection Cache district that judgement builds in advance and be connected with the long of things-internet gateway, if so, connect and carry out step S207 by length, if not, carry out step S205.
Such as, in wisdom road lamp system, when the application program of the wisdom road lamp system Centralized Controller that is 0A0B5301 to ID sends while turning off the light order, Internet of things middleware load balancing transponder is forwarded to this control command on the Internet of things middleware that ID is 0102440A, this Internet of things middleware checks the long Connection Cache district that it builds in advance, find to have set up with ID the long of the Centralized Controller that is 0A0B5301 and be connected, directly send control command.
S205: the long relevant information that whether stores things-internet gateway in mapping table that connects that judgement builds in advance, if so, carry out step S206, if not, return to step S203.
In above-mentioned wisdom road lamp system, if Internet of things middleware load balancing transponder is forwarded to this control command on the Internet of things middleware that ID is 0102440B, in the long Connection Cache district that this Internet of things middleware builds in advance at it, cannot find with the long of things-internet gateway and be connected, so, this Internet of things middleware then build in advance long take in connecting mapping table " gateway ID=0A0B5301 " inquire about as querying condition, successfully find and record <0A0B5301,10.0.0.58,0102440A, 172.168.0.21>.
If the long relevant information of not storing things-internet gateway in mapping table that connects building in advance, returns and control failed information, proceed step S203.
S206: set up and being connected of things-internet gateway according to the IP information of carrying in relevant information.
Concrete, utilize web socket (socket) set up with IP address between be connected, make to communicate by network application-level protocols such as HTTP, thus being connected of foundation and things-internet gateway.
As mentioned above, the IP=10.0.0.58 of things-internet gateway is taken out, with the things-internet gateway transmission control command that connects.
S207: control command is mail to things-internet gateway.
Control command is mail to Internet of Things application program and want the things-internet gateway of controlling, realize the control to this things-internet gateway.
S208: the long connection of storing in the logout message Jiang Chang Connection Cache district sending according to the things-internet gateway receiving removes, removes the long mapping relations of storing in mapping table that connect meanwhile.
Things-internet gateway deviated from network, sends message to the built vertical long Internet of things middleware connecting and nullifies, and Internet of things middleware receives logout message, and long connection the in Jiang Chang Connection Cache district removes, and the long mapping relations that connect in mapping table removed simultaneously.
After things-internet gateway off-line, need to be by erasing of information, otherwise can there is " dirty data ".Such as Internet of things middleware A has set up long connection with things-internet gateway B, and information is stored in to " long Connection Cache district " with in " the long mapping table that is connected ", after things-internet gateway B battery exhausts, long Joint failure, things-internet gateway A cannot get in touch with things-internet gateway B again.And things-internet gateway A and the long link information of things-internet gateway B are also stored in long Connection Cache district and are connected in mapping table with long, so need to remove, avoid the idle work of again things-internet gateway B being asked.
In wisdom road lamp system, when the ID Centralized Controller that is 0A0B5301 is nullified, the Internet of things middleware that ID is 0102440A is received after message, and long connection the between them removed.Meanwhile, search the long mapping table that connects, by mapping relations <0A0B5301,10.0.0.58,0102440A, 172.168.0.21> deletes.
As from the foregoing, the embodiment of the present application two is openly supported the method for Internet of things middleware cluster expansion, by the long Connection Cache district building in advance, storing Internet of things middleware is connected with growing of things-internet gateway and grows connection mapping table and store the expansion that the relevant information of things-internet gateway is supported Internet of things middleware cluster, once being forwarded to, the request of control do not set up on the long server connecting, can be from the long IP address information of obtaining things-internet gateway mapping table that connects, and set up being connected of Internet of things middleware server and things-internet gateway, rather than set up on the long server connecting before leaveing no choice but request to be forwarded to.The method has not only realized the expansion of Internet of things middleware cluster, and the function of load balancing that made the real realization of load balancing transponder.
Embodiment tri-
In order to support the expansion of Internet of things middleware cluster, make load balancing transponder realize real load balancing simultaneously, and can realize the method that the disclosed support Internet of things middleware of the embodiment of the present application one cluster is expanded, the open following system of supporting the expansion of Internet of things middleware cluster of the embodiment of the present application three.As shown in Figure 3, Fig. 3 is the disclosed a kind of structural representation of supporting the system of Internet of things middleware cluster expansion of the embodiment of the present application three.
This system comprises: receiving element 301, construction unit 302, judging unit 303 and transmitting element 304, wherein:
Receiving element 301, for receiving the control command for things-internet gateway, utilizes load balancing transponder described control command to be mail to the server of any one Internet of things middleware.
Construction unit 302, for building in advance long Connection Cache district and the long mapping table that connects.
The judging unit 303 being connected with receiving element 301 and construction unit 302 respectively, for judging whether the long Connection Cache district of construction unit 302 structures stores Internet of things middleware and be connected with the long of things-internet gateway, and, the long relevant information that whether stores things-internet gateway in mapping table that connects that judgement builds in advance.
Such as, in wisdom road lamp system, when the application program of the wisdom road lamp system Centralized Controller that is 0A0B5301 to ID sends while turning off the light order, Internet of things middleware load balancing transponder is forwarded to this control command on the Internet of things middleware that ID is 0102440A, this Internet of things middleware checks the long Connection Cache district that it builds in advance, find to have set up with ID the long of the Centralized Controller that is 0A0B5301 and be connected, directly send control command.If Internet of things middleware load balancing transponder is forwarded to this control command on the Internet of things middleware that ID is 0102440B, in the long Connection Cache district that this Internet of things middleware builds in advance at it, cannot find with the long of things-internet gateway and be connected, so, this Internet of things middleware then build in advance long take in connecting mapping table " gateway ID=0A0B5301 " inquire about as querying condition, successfully find and record <0A0B5301,10.0.0.58,0102440A, 172.168.0.21>.If the long relevant information of not storing things-internet gateway in mapping table that connects that construction unit builds in advance, judging unit returns to receiving element the failed information of controlling.
The transmitting element 304 being connected with judging unit 303, for the long Connection Cache district that ought build in advance, not storing Internet of things middleware is connected with the long of things-internet gateway, and while storing the relevant information of things-internet gateway in the long connection mapping table building in advance, according to the IP information of carrying in relevant information, set up and being connected of described things-internet gateway, and control command is mail to described things-internet gateway.
Concrete, utilize web socket (socket) set up with IP address between be connected, make to communicate by network application-level protocols such as HTTP, thus being connected of foundation and things-internet gateway.The IP=10.0.0.58 of things-internet gateway is taken out, with the things-internet gateway transmission control command that connects, realize the control to this things-internet gateway.
As from the foregoing, the embodiment of the present application three is openly supported the system of Internet of things middleware cluster expansion, the long Connection Cache district building in advance by construction unit stores Internet of things middleware and is connected with growing of things-internet gateway and grows connection mapping table and store the expansion that the relevant information of things-internet gateway is supported Internet of things middleware cluster, once judging unit is found to control request and is forwarded on the long server connecting of not foundation, transmitting element can be from the long IP address information of obtaining things-internet gateway mapping table that connects, and set up being connected of Internet of things middleware server and things-internet gateway, rather than set up on the long server connecting before leaveing no choice but request to be forwarded to.The method has not only realized the expansion of Internet of things middleware cluster, and the function of load balancing that made the real realization of load balancing transponder.
Embodiment tetra-
The embodiment of the present application four discloses the system of another kind of support Internet of things middleware cluster expansion, and as shown in Figure 4, Fig. 4 is the disclosed a kind of structural representation of supporting the system of Internet of things middleware cluster expansion of the embodiment of the present application four.
This system comprises: registering unit 401, receiving element 402, construction unit 403, judging unit 404, transmitting element 405 and cancellation unit 406, wherein:
Registering unit 401 comprises: set up unit 4011 and memory cell 4012.
Set up unit 4011, for the registration message sending according to the things-internet gateway receiving, set up with the long of things-internet gateway and be connected.
The memory cell 4012 being connected with construction unit 403, for depositing long connection in build in advance long Connection Cache district, meanwhile, using the relevant information of the relevant information of things-internet gateway and Internet of things middleware as mapping relations, being stored in build in advance long connects in mapping table.
Wherein, the relevant information of things-internet gateway comprises: the IP information of the id information of things-internet gateway and things-internet gateway.The relevant information of Internet of things middleware comprises: the IP information of the id information of Internet of things middleware and Internet of things middleware.
Concrete, by depositing in being connected with things-internet gateway long of setting up in the long Connection Cache district that Internet of things middleware builds in advance, the id information of the id information of things-internet gateway, IP information and Internet of things middleware, IP information four-tuple are deposited in the length connection mapping table building in advance with mapping relations simultaneously.
Receiving element 402, for receiving the control command for things-internet gateway, utilizes load balancing transponder described control command to be mail to the server of any one Internet of things middleware.
Construction unit 403, for building in advance long Connection Cache district and the long mapping table that connects.
Wherein, long Connection Cache district and long these two unit of mapping table that connect can be realized by modes such as building database, buffer memorys, at this, do not limit, and can select as the case may be.
The judging unit 404 being connected with receiving element 402 and construction unit 403 respectively, for judging whether the long Connection Cache district of construction unit 403 structures stores Internet of things middleware and be connected with the long of things-internet gateway, and, the long relevant information that whether stores things-internet gateway in mapping table that connects that judgement builds in advance.
The transmitting element 405 being connected with judging unit 404, for the long Connection Cache district that ought build in advance, not storing Internet of things middleware is connected with the long of things-internet gateway, and while storing the relevant information of things-internet gateway in the long connection mapping table building in advance, according to the IP information of carrying in relevant information, set up and being connected of described things-internet gateway, and control command is mail to described things-internet gateway.
The cancellation unit 406 being connected with transmitting element 405, the long connection of storing for the logout message Jiang Chang Connection Cache district sending according to the things-internet gateway receiving removes, and, the long mapping relations of storing in mapping table that connect removed meanwhile.
Things-internet gateway deviated from network, sends message to the built vertical long Internet of things middleware connecting and nullifies, and Internet of things middleware receives logout message, and long connection the in Jiang Chang Connection Cache district removes, and the long mapping relations that connect in mapping table removed simultaneously.
As from the foregoing, the embodiment of the present application four is openly supported the system of Internet of things middleware cluster expansion, the long Connection Cache district building in advance by construction unit stores Internet of things middleware and is connected with growing of things-internet gateway and grows connection mapping table and store the expansion that the relevant information of things-internet gateway is supported Internet of things middleware cluster, once judging unit is found to control request and is forwarded on the long server connecting of not foundation, transmitting element can be from the long IP address information of obtaining things-internet gateway mapping table that connects, and set up being connected of Internet of things middleware server and things-internet gateway, rather than set up on the long server connecting before leaveing no choice but request to be forwarded to.The method has not only realized the expansion of Internet of things middleware cluster, and the function of load balancing that made the real realization of load balancing transponder.
Finally, also it should be noted that, in this article, relational terms such as the first and second grades is only used for an entity or operation to separate with another entity or operating space, and not necessarily requires or imply and between these entities or operation, have the relation of any this reality or sequentially.And, term " comprises ", " comprising " or its any other variant are intended to contain comprising of nonexcludability, thereby the process, method, article or the equipment that make to comprise a series of key elements not only comprise those key elements, but also comprise other key elements of clearly not listing, or be also included as the intrinsic key element of this process, method, article or equipment.The in the situation that of more restrictions not, the key element being limited by statement " comprising ... ", and be not precluded within process, method, article or the equipment that comprises described key element and also have other identical element.
In this specification, each embodiment adopts the mode of going forward one by one to describe, and each embodiment stresses is the difference with other embodiment, between each embodiment identical similar part mutually referring to.
Above-mentioned explanation to the disclosed embodiments, makes professional and technical personnel in the field can realize or use the application.To the multiple modification of these embodiment, will be apparent for those skilled in the art, General Principle as defined herein can be in the situation that do not depart from the application's spirit or scope, realization in other embodiments.Therefore, the application will can not be restricted to these embodiment shown in this article, but will meet the widest scope consistent with principle disclosed herein and features of novelty.