A kind of intelligent use gateway realization method based on container cloud
Technical field
The present invention relates to gateway technique field, more particularly to a kind of intelligent use gateway realization side of mouth based on container cloud
Method.
Background technology
With the popularization of network, cloud computing and container technique, cloud application is presented the growth of explosion type, public network IP resource it is short
Lack and increasingly show, although IPv6 technologies have occurred for many years, being limited to hardware and limitation of the technology, data center still uses mostly at present
Public network IP v4 schemes, application and the man-to-man binding in port are realized by NAT.Although existing scheme can improve IP utilization rates,
Port still be present and can not be multiplexed, complex management, availability are low etc.,
For application at present, an outer net IP port can only point to an intranet server, and overwhelming majority application needs logical
80,443 ports of http or https standards are crossed, as that can not be multiplexed, the wasting of resources can be produced, utilization rate is low, in addition, whole
Individual data export centrally through a gateway, as gateway without intelligent trouble recover, automatic load balancing mechanism, then to service provide
Produce considerable influence to produce, gateway availability issue:And NAT needs to do and map by hand, for keeper, not only maintenance workers
Work amount is huge, while it is possible error to be also present.Especially in container platform, container IP address can more increase dimension with needing to change
Protect workload.
The content of the invention
It is an object of the invention to overcome the above-mentioned problems in the prior art, there is provided the present invention provide it is a kind of efficiently,
Simply, the intelligent use gateway of High Availabitity, solves the outer net outlet problem of cloud service.
To realize above-mentioned technical purpose and the technique effect, the present invention is to be achieved through the following technical solutions:
A kind of intelligent use gateway realization method based on container cloud, including Distributed Storage and high-availability cluster
(etcd), dns server (skyDNS), configuration maker (confd), label getter (tagCollector), policy selection
Device (policySelector), task performer (taskExecutor), the intelligent use gateway realization method are as follows:
1)The service such as etcd, confd, tagCollector, taskExecutor, skyDNS are being disposed at least on a server
Service is affixed one's name on unexpected network server in office;
2)Into etcd /the new outer net IP the Resources lists of etcd/docker/publicIP additions.
3)The NAMESERVER of domain name is changed to cloud platform outer net dns address in domain name setting;
4)Each server judges whether oneself is etcd leader, if it is, starting by obtaining etcd states
TagCollector, in the metadata information by regular pull containers cloud platform, obtain all containers labels data
taglist.json;
5)TaskExecutor parses taglist.json, and with being contrasted (before in/etc/docker/allocator
Distributor), if it find that be newly-increased domain name, to policySelector acquisition request outer nets address of service,
PolicySelector configures according to strategy, an IP address in return/etcd/docker/publicIP;
6)TaskExecutor calls the confd for returning to IP places main frame, and the configuration that nginx is regenerated by main frame template is gone forward side by side
The reload of row example, after success by etcd /etc/docker/allocator is updated, in final updating skyDNS
The sensing of domain name and IP;
7)TaskExecutor periodically by cloud platform etcd /etc/docker/allocator is scanned, to protect
The resource recorded in card allocator is consistent with reality, and by calling the performance API on nginx, carries out performance statistics.
Preferably, policySelector methods, the load-balancing method selected when being service routing, the load balancing
Method passes through every server load condition of network measure (system load/TCP collection), preferential distribution to load
Minimum main frame.
Preferably, the policySelector methods, selected when being service routing based on weight method, it is described to be based on
Weight method is to be distributed by the weight setting in specified IP address by hand, and weight represents that numeral is bigger with 1-100 numerals
It is bigger to represent weight.
Preferably, the policySelector methods, what is selected when being service routing is main based on close master scheduling method, parent
Dispatching method is that identical rhizosphere name is preferentially dispatched to identical server.
Preferably, the policySelector methods, selected when being service routing based on stamp methods, based on label
Method is that user directly specifies on the main frame being dispatched to where specific IP in the label.
The beneficial effects of the invention are as follows:
Application gateway cluster can expand according to scale dynamic, and each port can multiplex, and the use of IP resources is greatly improved
Rate;The load balancing and dynamic adaptation of outlet can be realized by customized dispatching algorithm, improves cloud platform overall usability
With performance.
Certainly, any product for implementing the present invention it is not absolutely required to reach all the above advantage simultaneously.
Brief description of the drawings
In order to illustrate the technical solution of the embodiments of the present invention more clearly, used required for being described below to embodiment
Accompanying drawing is briefly described, it should be apparent that, drawings in the following description are only some embodiments of the present invention, for ability
For the those of ordinary skill of domain, on the premise of not paying creative work, it can also be obtained according to these accompanying drawings other attached
Figure.
Fig. 1 is present system architecture design block diagram.
Embodiment
Below in conjunction with the accompanying drawing in the embodiment of the present invention, the technical scheme in the embodiment of the present invention is carried out clear, complete
Site preparation describes, it is clear that described embodiment is only part of the embodiment of the present invention, rather than whole embodiments.It is based on
Embodiment in the present invention, those of ordinary skill in the art are obtained all other under the premise of creative work is not made
Embodiment, belong to the scope of protection of the invention.
Referring to shown in Fig. 1, the present embodiment is a kind of intelligent use gateway realization method based on container cloud, including
Distributed Storage and high-availability cluster (etcd), dns server (skyDNS), configuration maker (confd), label obtain
Device (tagCollector), strategy selector (policySelector), task performer (taskExecutor), the intelligence
Energy application gateway implementation method is as follows:
1)The service such as etcd, confd, tagCollector, taskExecutor, skyDNS are being disposed at least on a server
Service is affixed one's name on unexpected network server in office;
2)Into etcd /the new outer net IP the Resources lists of etcd/docker/publicIP additions.
3)The NAMESERVER of domain name is changed to cloud platform outer net dns address in domain name setting;
4)Each server judges whether oneself is etcd leader, if it is, starting by obtaining etcd states
TagCollector, in the metadata information by regular pull containers cloud platform, obtain all containers labels data
taglist.json;
5)TaskExecutor parses taglist.json, and with being contrasted (before in/etc/docker/allocator
Distributor), if it find that be newly-increased domain name, to policySelector acquisition request outer nets address of service,
PolicySelector configures according to strategy, an IP address in return/etcd/docker/publicIP;
6)TaskExecutor calls the confd for returning to IP places main frame, and the configuration that nginx is regenerated by main frame template is gone forward side by side
The reload of row example, after success by etcd /etc/docker/allocator is updated, in final updating skyDNS
The sensing of domain name and IP;
7)TaskExecutor periodically by cloud platform etcd /etc/docker/allocator is scanned, to protect
The resource recorded in card allocator is consistent with reality, and by calling the performance API on nginx, carries out performance statistics.
It is foregoing, policySelector methods, the load-balancing method selected when being service routing, the load balancing side
Method is by every server load condition of network measure (system load/TCP collection), and preferential distribution to load is most
Low main frame.
It is foregoing, the policySelector methods, selected when being service routing based on weight method, it is described based on power
Weighing method is to be distributed by the weight setting in specified IP address by hand, and weight is represented with 1-100 numerals, numeral bigger generation
Table weight is bigger.
It is foregoing, the policySelector methods, selected when being service routing based on close master scheduling method, close homophony
Degree method is that identical rhizosphere name is preferentially dispatched to identical server.
It is foregoing, the policySelector methods, selected when being service routing based on stamp methods, based on label side
Method is that user directly specifies on the main frame being dispatched to where specific IP in the label.
In the description of this specification, the description of reference term " one embodiment ", " example ", " specific example " etc. means
At least one implementation of the present invention is contained in reference to specific features, structure, material or the feature that the embodiment or example describe
In example or example.In this manual, identical embodiment or example are not necessarily referring to the schematic representation of above-mentioned term.
Moreover, specific features, structure, material or the feature of description can close in any one or more embodiments or example
Suitable mode combines.
Present invention disclosed above preferred embodiment is only intended to help and illustrates the present invention.Preferred embodiment is not detailed
All details are described, it is only described embodiment also not limit the invention.Obviously, according to the content of this specification,
It can make many modifications and variations.This specification is chosen and specifically describes these embodiments, is to preferably explain the present invention
Principle and practical application so that skilled artisan can be best understood by and utilize the present invention.The present invention is only
Limited by claims and its four corner and equivalent.