CN107368369B - Distributed container management method and system - Google Patents

Distributed container management method and system Download PDF

Info

Publication number
CN107368369B
CN107368369B CN201710502392.5A CN201710502392A CN107368369B CN 107368369 B CN107368369 B CN 107368369B CN 201710502392 A CN201710502392 A CN 201710502392A CN 107368369 B CN107368369 B CN 107368369B
Authority
CN
China
Prior art keywords
container
information
cassandra
module
host 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.)
Active
Application number
CN201710502392.5A
Other languages
Chinese (zh)
Other versions
CN107368369A (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 United Network Communications Group Co Ltd
Original Assignee
China United Network Communications Group 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 United Network Communications Group Co Ltd filed Critical China United Network Communications Group Co Ltd
Priority to CN201710502392.5A priority Critical patent/CN107368369B/en
Publication of CN107368369A publication Critical patent/CN107368369A/en
Application granted granted Critical
Publication of CN107368369B publication Critical patent/CN107368369B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5083Techniques for rebalancing the load in a distributed system
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/28Data switching networks characterised by path configuration, e.g. LAN [Local Area Networks] or WAN [Wide Area Networks]
    • H04L12/42Loop networks

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Databases & Information Systems (AREA)
  • Computing Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention provides a distributed container management method and a distributed container management system.A Cassandra ring network topology comprises a plurality of nodes and host nodes corresponding to the nodes, and the host nodes comprise a plurality of containers; the method comprises the following steps: the Cassandra component module sends container load request information to the container management module; the container management module acquires container resource information according to the container load request information and sends log request information to the log monitoring module; the log monitoring module acquires log monitoring information used for being sent to the container management module according to the log request information; the container management module receives the log monitoring information, and fuses the container resource information and the log monitoring information into container load information which is sent to the Cassandra component module; and the Cassandra component module receives the container load information and sends the container load information to other host nodes so as to realize the sharing of the container load information among the host nodes.

Description

分布式容器管理方法及系统Distributed container management method and system

技术领域technical field

本发明涉及通信技术领域,尤其涉及一种分布式容器管理方法及系统。The present invention relates to the field of communication technologies, and in particular, to a distributed container management method and system.

背景技术Background technique

随着容器技术的发展,容器技术和虚拟化技术已经成为一种被大家广泛认可的容器技术服务器资源共享方式,容器技术可以在按需构建容器技术操作系统实例的过程当中,为操作人员提供极大的灵活性。With the development of container technology, container technology and virtualization technology have become a widely recognized method of container technology server resource sharing. Container technology can provide operators with extreme great flexibility.

目前,现有技术中常常采用的容器技术为Docker技术,其容器管理主要是通过主从方式来实现的,具体的,通过一Master节点来管理整个容器集群。并且还可以通过容器编排工具的代理的方式来实现节点上容器的注册、创建管理等,例如,在每一个节点上需要部署Kuber-proxy来实现对节点的代理,通过Kuber-proxy来实现对该节点上的Pod容器的管理等。At present, the container technology often used in the prior art is the Docker technology, and the container management is mainly implemented in a master-slave manner. Specifically, a master node is used to manage the entire container cluster. In addition, the registration, creation and management of containers on the node can also be realized by the proxy of the container orchestration tool. For example, Kuber-proxy needs to be deployed on each node to realize the proxy of the node, and Kuber-proxy is used to realize the Management of Pod containers on nodes, etc.

然而,现有容器管理技术的主从方式约束了容器集群扁平化管理,从而约束了容器快速扩缩容的响应机制,具体的,若采用传统的主从模式,则需要事先决定宿主机的角色,从而在集群较少的情况下创建多个容器节点时需要留出一台或者多台机器作为主节点来统一管理容器集群的其他从节点上的容器,而主节点则不能部署容器,因此大大浪费了资源。另外,容器共享数据库集群位置比较集中,一般情况下,数据库集群主要集中在某几台节点上,而在其他节点上并没有数据备份,因此,当某一个节点上网络失效,则整个节点上的容器将会自动失败,需要在其他节点上在重新创建该节点上的所有容器,如果是核心业务的容器,势必会造成业务请求迟缓或者宕机等可能性。However, the master-slave mode of the existing container management technology constrains the flat management of container clusters, thereby constraining the response mechanism for rapid container expansion and contraction. Specifically, if the traditional master-slave mode is adopted, the role of the host needs to be determined in advance , so that when creating multiple container nodes with few clusters, one or more machines need to be set aside as the master node to manage the containers on other slave nodes of the container cluster in a unified manner, while the master node cannot deploy containers, so it greatly Resources are wasted. In addition, the location of the container shared database cluster is relatively concentrated. Generally, the database cluster is mainly concentrated on a few nodes, and there is no data backup on other nodes. Therefore, when the network on a node fails, the entire node The container will automatically fail, and all containers on the node need to be recreated on other nodes. If it is a container for the core business, it will inevitably cause the possibility of slow business requests or downtime.

发明内容SUMMARY OF THE INVENTION

本发明提供一种分布式容器管理系统及方法,用于解决现有技术存在的主节点不能部署容器,因此大大浪费了资源,容器共享数据库集群位置比较集中,从而容易造成业务请求迟缓或者宕机的问题。The present invention provides a distributed container management system and method, which is used to solve the problem that the main node in the prior art cannot deploy the container, so resources are greatly wasted, and the location of the container shared database cluster is relatively concentrated, which easily causes the service request to be slow or downtime. The problem.

本发明的一方面提供了一种基于Cassandra环网络拓扑的分布式容器管理方法,所述Cassandra环网络拓扑包括多个节点,每个节点上对应有一宿主机节点,所述宿主机节点中包括多个容器;所述宿主机节点中还包括Cassandra组件模块、容器管理模块以及日志监控模块,所述方法包括:One aspect of the present invention provides a distributed container management method based on a Cassandra ring network topology. The Cassandra ring network topology includes multiple nodes, each node corresponds to a host node, and the host node includes multiple nodes. A container; the host node also includes a Cassandra component module, a container management module and a log monitoring module, and the method includes:

所述Cassandra组件模块向所述容器管理模块发送容器负载请求信息;The Cassandra component module sends container load request information to the container management module;

所述容器管理模块根据所述容器负载请求信息获取自身存储的容器资源信息,并根据所述容器负载请求信息向所述日志监控模块发送日志请求信息;The container management module acquires container resource information stored by itself according to the container load request information, and sends log request information to the log monitoring module according to the container load request information;

所述日志监控模块根据日志请求信息获取到日志监控信息,并将所述日志监控信息发送至所述容器管理模块;The log monitoring module obtains log monitoring information according to the log request information, and sends the log monitoring information to the container management module;

所述容器管理模块接收所述日志监控信息,将所述容器资源信息和日志监控信息进行融合处理,获取到容器负载信息,并将所述容器负载信息发送至Cassandra组件模块;The container management module receives the log monitoring information, performs fusion processing on the container resource information and the log monitoring information, obtains the container load information, and sends the container load information to the Cassandra component module;

所述Cassandra组件模块接收所述容器负载信息,并将所述容器负载信息发送至其他宿主机节点,以实现宿主机节点之间容器负载信息的共享。The Cassandra component module receives the container load information, and sends the container load information to other host nodes, so as to realize the sharing of the container load information among the host nodes.

本发明的另一方面提供了一种基于Cassandra环网络拓扑的分布式容器管理系统,所述Cassandra环网络拓扑包括多个节点,每个节点上对应有一宿主机节点,所述宿主机节点中包括多个容器;所述系统包括:Another aspect of the present invention provides a distributed container management system based on a Cassandra ring network topology. The Cassandra ring network topology includes multiple nodes, each node corresponds to a host node, and the host node includes a plurality of containers; the system includes:

Cassandra组件模块,用于向容器管理模块发送容器负载请求信息;The Cassandra component module is used to send container load request information to the container management module;

所述容器管理模块,用于根据所述容器负载请求信息获取自身存储的容器资源信息,并根据所述容器负载请求信息向日志监控模块发送日志请求信息;The container management module is configured to acquire container resource information stored by itself according to the container load request information, and send log request information to the log monitoring module according to the container load request information;

所述日志监控模块,用于根据日志请求信息获取到日志监控信息,并将所述日志监控信息发送至所述容器管理模块;the log monitoring module, configured to obtain log monitoring information according to the log request information, and send the log monitoring information to the container management module;

所述容器管理模块,还用于接收所述日志监控信息,将所述容器资源信息和日志监控信息进行融合处理,获取到容器负载信息,并将所述容器负载信息发送至Cassandra组件模块;The container management module is further configured to receive the log monitoring information, perform fusion processing on the container resource information and the log monitoring information, obtain container load information, and send the container load information to the Cassandra component module;

所述Cassandra组件模块,还用于接收所述容器负载信息,并将所述容器负载信息发送至其他宿主机节点,以实现宿主机节点之间容器负载信息的共享。The Cassandra component module is further configured to receive the container load information, and send the container load information to other host nodes, so as to realize the sharing of the container load information among the host nodes.

本发明提供的分布式容器管理方法及系统,该管理方法基于Cassandra环网络拓扑实现,而Cassandra环网络拓扑中的每个宿主机节点中可以包括多个容器,从而有效地提高了资源的利用;同时,宿主机节点之间可以实现容器负载信息的共享,因此,有效地克服了现有技术中存在的容器共享数据库集群位置比较集中,从而容易造成业务请求迟缓或者宕机的缺陷,保证了该管理方法的实用性,有利于市场的推广与应用。The distributed container management method and system provided by the present invention are implemented based on the Cassandra ring network topology, and each host node in the Cassandra ring network topology may include multiple containers, thereby effectively improving the utilization of resources; At the same time, the container load information can be shared between the host nodes. Therefore, it effectively overcomes the problem that the container shared database cluster in the prior art is relatively centralized, which easily causes the service request to be slow or downtime. The practicality of the management method is conducive to the promotion and application of the market.

附图说明Description of drawings

图1为本发明实施例提供的一种基于Cassandra环网络拓扑的分布式容器管理方法的流程示意图;1 is a schematic flowchart of a distributed container management method based on a Cassandra ring network topology provided by an embodiment of the present invention;

图2为本发明实施例提供的一种Cassandra环网络拓扑的结构示意图;2 is a schematic structural diagram of a Cassandra ring network topology provided by an embodiment of the present invention;

图3为本发明实施例提供的Cassandra组件模块向所述容器管理模块发送容器负载请求信息的流程示意图;3 is a schematic flowchart of a Cassandra component module sending container load request information to the container management module according to an embodiment of the present invention;

图4为本发明实施例提供的另一种基于Cassandra环网络拓扑的分布式容器管理方法的流程示意图;4 is a schematic flowchart of another distributed container management method based on a Cassandra ring network topology provided by an embodiment of the present invention;

图5为本发明实施例提供的目标宿主机节点根据所述容器数据信息创建相应的容器的流程示意图;5 is a schematic flowchart of a target host node creating a corresponding container according to the container data information according to an embodiment of the present invention;

图6为本发明实施例提供的又一种基于Cassandra环网络拓扑的分布式容器管理方法的流程示意图;6 is a schematic flowchart of another distributed container management method based on Cassandra ring network topology provided by an embodiment of the present invention;

图7为本发明实施例提供的一种宿主机节点架构的结构示意图;7 is a schematic structural diagram of a host node architecture according to an embodiment of the present invention;

图8为本发明实施例提供的一种基于Cassandra环网络拓扑的分布式容器管理方法的具体应用时的流程示意图;8 is a schematic flowchart of a specific application of a distributed container management method based on a Cassandra ring network topology provided by an embodiment of the present invention;

图9为本发明实施例提供的另一种基于Cassandra环网络拓扑的分布式容器管理方法的具体应用时的流程示意图;9 is a schematic flowchart of another specific application of a distributed container management method based on a Cassandra ring network topology provided by an embodiment of the present invention;

图10为本发明实施例提供的一种基于Cassandra环网络拓扑的分布式容器管理系统的结构示意图。FIG. 10 is a schematic structural diagram of a distributed container management system based on a Cassandra ring network topology according to an embodiment of the present invention.

具体实施方式Detailed ways

下面结合附图和实施例,对本发明的具体实施方式作进一步详细描述。以下实例用于说明本发明,但不用来限制本发明的范围。The specific embodiments of the present invention will be described in further detail below with reference to the accompanying drawings and embodiments. The following examples are intended to illustrate the present invention, but not to limit the scope of the present invention.

Cassandra技术是一套开源分布式NoSQL数据库系统。它最初由Facebook开发,用于存储收件箱等简单格式数据,集Google Big Table的数据模型与Amazon Dynamo的完全分布式的架构于一身,Facebook于2008年将Cassandra开源,此后,由于Cassandra良好的可扩展性,被Digg、Twitter等知名Web2.0网站所采纳,成为了一种流行的分布式结构化数据存储方案。Cassandra technology is an open source distributed NoSQL database system. It was originally developed by Facebook to store data in simple formats such as inboxes. It integrates the data model of Google Big Table and the fully distributed architecture of Amazon Dynamo. Facebook opened Cassandra in 2008. Since then, due to the good quality of Cassandra Scalability, adopted by well-known Web2.0 websites such as Digg and Twitter, has become a popular distributed structured data storage solution.

Cassandra是一个混合型的非关系的数据库,类似于Google的Big Table。其主要功能比Dynamo(分布式的Key-Value存储系统)更丰富,但支持度却不如文档存储MangoDB(介于关系数据库和非关系数据之间的开源产品,是非关系数据库当中功能最丰富,最像关系数据库的。支持的数据结构非常松散,是类似json的bjson格式,因此可以存储比较复杂的数据类型)。Cassandra is a hybrid non-relational database, similar to Google's Big Table. Its main functions are richer than Dynamo (distributed Key-Value storage system), but its support is not as good as that of document storage MangoDB (an open source product between relational databases and non-relational data, which is the most feature-rich and most non-relational database among non-relational databases). Like relational databases. The supported data structure is very loose, and it is a bjson format similar to json, so it can store more complex data types).

Cassandra的主要特点是不一个完全意义上的数据库,而是由一堆数据库节点共同构成的一个分布式网络服务,对Cassandra的一个写操作,会被复制到其他节点上去,对Cassandra的读操作,也会被路由到某个节点上面去读取。对于一个Cassandra集群来说,扩展性能是比较简单的事情,只管在集群里面增加节点就可以了。The main feature of Cassandra is that it is not a database in the full sense, but a distributed network service composed of a bunch of database nodes. A write operation to Cassandra will be replicated to other nodes, and a read operation to Cassandra, It will also be routed to a node to read. For a Cassandra cluster, scaling performance is relatively simple, just add nodes to the cluster.

和其他数据库相比,Cassandra具备以下三种比较突出的特点:(1)模式灵活,使用Cassandra,像文档存储,用户不必提前解决记录中的字段。(2)可扩展性,从而在效率方面可以实现惊人的提升,尤其是在大规模部署方面。Cassandra是纯粹意义上的水平扩展。为给集群添加更多容量,可以指向另一个物理节点,在不必重新启动任何进程的条件下,改变应用查询或者通过手动方式迁移任何数据。(3)多数据中心,可以调整用户的节点布局来避免某一个数据中心起火,一个备用的数据中心将至少有每条记录的完全复制。Compared with other databases, Cassandra has the following three prominent features: (1) The schema is flexible. Using Cassandra, like document storage, users do not have to solve the fields in the record in advance. (2) Scalability, so that amazing improvements in efficiency can be achieved, especially in large-scale deployments. Cassandra is purely horizontal scaling. To add more capacity to the cluster, you can point to another physical node, change application queries, or manually migrate any data without having to restart any processes. (3) Multiple data centers, the user's node layout can be adjusted to avoid a fire in a data center, and a spare data center will have at least a full copy of each record.

图1为本发明实施例提供的一种基于Cassandra环网络拓扑的分布式容器管理方法的流程示意图,图2为本发明实施例提供的一种Cassandra环网络拓扑的结构示意图;基于上述Cassandra技术,参考附图1-2可知,本实施例提供了一种基于Cassandra环网络拓扑的分布式容器管理方法,其中,参考附图2可知,Cassandra环网络拓扑包括多个节点,每个节点上对应有一宿主机节点,宿主机节点中可以包括多个容器,其中,每个宿主机节点上的容器不要求都是某一个应用集群;另外,宿主机节点之间可以采用预设的协议方法(gossip协议方法)实现相互通信、状态监测、数据访问等应用,具体的,宿主机节点中还包括Cassandra组件模块、容器管理模块以及日志监控模块,方法包括:1 is a schematic flowchart of a distributed container management method based on a Cassandra ring network topology provided by an embodiment of the present invention, and FIG. 2 is a schematic structural diagram of a Cassandra ring network topology provided by an embodiment of the present invention; Based on the above Cassandra technology, Referring to Figures 1-2, this embodiment provides a distributed container management method based on the Cassandra ring network topology, wherein, referring to Figure 2, it can be seen that the Cassandra ring network topology includes multiple nodes, and each node corresponds to a The host node, the host node can include multiple containers, wherein, the containers on each host node are not required to be a certain application cluster; in addition, a preset protocol method (gossip protocol) can be used between the host nodes. method) to realize applications such as mutual communication, status monitoring, data access, etc. Specifically, the host node also includes a Cassandra component module, a container management module and a log monitoring module, and the method includes:

S101:Cassandra组件模块向容器管理模块发送容器负载请求信息;S101: The Cassandra component module sends container load request information to the container management module;

其中,Cassandra组件模块可以用于实现宿主机节点内部的管理、数据协调以及统一管理等;容器管理模块主要负责宿主机节点上创建的容器的管理等;当宿主机节点之间要实现相互通信或数据访问功能时,Cassandra组件模块会向容器管理模块发送容器负载请求信息,该容器负载请求信息用于获取该宿主机节点上的容器负载信息,以实现各个宿主机节点之间的容器负载信息的共享。Among them, the Cassandra component module can be used to realize the internal management, data coordination and unified management of the host node; the container management module is mainly responsible for the management of the containers created on the host node; when the host nodes need to communicate with each other or When the data access function is used, the Cassandra component module will send the container load request information to the container management module. The container load request information is used to obtain the container load information on the host node, so as to realize the container load information between each host node. shared.

S102:容器管理模块根据容器负载请求信息获取自身存储的容器资源信息,并根据容器负载请求信息向日志监控模块发送日志请求信息;S102: The container management module obtains the container resource information stored by itself according to the container load request information, and sends log request information to the log monitoring module according to the container load request information;

其中,日志监控模块主要负责收集容器运行和操作过程中的日志收集和监控情况,当容器管理模块接收到容器负载请求信息之后,可以根据该容器负载请求信息获取自身存储的容器资源信息,该容器资源信息为容器负载信息的一部分;为了获取到完整的容器负载信息,容器管理模块还可以根据容器负载请求信息向日志监控模块发送日志请求信息,该日志请求信息用于获取存储在日志监控模块中的日志监控信息,其中,日志监控信息也为容器负载信息的一部分。Among them, the log monitoring module is mainly responsible for collecting and monitoring logs during the container operation and operation. When the container management module receives the container load request information, it can obtain the container resource information stored by itself according to the container load request information. The resource information is part of the container load information; in order to obtain the complete container load information, the container management module can also send log request information to the log monitoring module according to the container load request information, and the log request information is used to obtain the log request information stored in the log monitoring module. The log monitoring information, where the log monitoring information is also part of the container load information.

S103:日志监控模块根据日志请求信息获取到日志监控信息,并将日志监控信息发送至容器管理模块;S103: The log monitoring module obtains the log monitoring information according to the log request information, and sends the log monitoring information to the container management module;

当日志监控模块接收到日志请求信息之后,可以根据该日志请求信息查询自身存储的日志监控信息,由于该日志监控信息为容器负载信息的一部分,因此,日志监控模块会将所获取到的日志监控信息发送至容器管理模块,以使得容器管理模块根据容器资源信息和日志监控信息获取到容器负载信息。After the log monitoring module receives the log request information, it can query the log monitoring information stored by itself according to the log request information. Since the log monitoring information is part of the container load information, the log monitoring module will monitor the obtained logs. The information is sent to the container management module, so that the container management module obtains the container load information according to the container resource information and the log monitoring information.

S104:容器管理模块接收日志监控信息,将容器资源信息和日志监控信息进行融合处理,获取到容器负载信息,并将容器负载信息发送至Cassandra组件模块;S104: The container management module receives the log monitoring information, integrates the container resource information and the log monitoring information, obtains the container load information, and sends the container load information to the Cassandra component module;

当容器管理模块接收日志监控信息之后,可以按照预设的算法将容器资源信息和日志监控信息进行融合处理(其中,具体的融合算法,本领域技术人员可以根据具体的设计需求进行设置),从而可以获取到容器负载信息,该容器负载信息即为各个宿主机节点之间所需要共享的数据信息,因此,需要将该容器负载信息发送至Cassandra组件模块处,以使得Cassandra组件模块实现各个宿主机节点之间的数据共享。After the container management module receives the log monitoring information, it can perform fusion processing on the container resource information and the log monitoring information according to a preset algorithm (the specific fusion algorithm can be set by those skilled in the art according to specific design requirements), thereby The container load information can be obtained. The container load information is the data information that needs to be shared between each host node. Therefore, the container load information needs to be sent to the Cassandra component module, so that the Cassandra component module can implement each host. Data sharing between nodes.

S105:Cassandra组件模块接收容器负载信息,并将容器负载信息发送至其他宿主机节点,以实现宿主机节点之间容器负载信息的共享。S105: The Cassandra component module receives the container load information, and sends the container load information to other host nodes, so as to realize the sharing of the container load information among the host nodes.

在Cassandra组件模块收到容器负载信息之后,可以采用广播或者其他形式将该容器负载信息发送至其他宿主机节点,从而使得其他宿主机节点可以获取到该宿主机节点上的容器负载信息,实现了宿主机节点之间信息的共享,从而实现了,如果是核心业务的宿主机节点的网络出现异常,由于其他宿主机节点上存储有该宿主机节点的容器负载信息,因此,可以立刻根据该容器负载信息创建相应的容器,从而有效地保证了业务请求的及时响应效率。After the Cassandra component module receives the container load information, it can send the container load information to other host nodes by broadcasting or other forms, so that other host nodes can obtain the container load information on the host node, realizing The sharing of information between the host nodes realizes that if the network of the host node of the core business is abnormal, since the container load information of the host node is stored on other host nodes, the container load information of the host node can be stored immediately. Load information creates corresponding containers, thereby effectively ensuring the timely response efficiency of business requests.

本实施例所提供的分布式容器管理方法,该管理方法基于Cassandra环网络拓扑实现,而Cassandra环网络拓扑中的每个宿主机节点中可以包括多个容器,从而有效地提高了资源的利用;同时,宿主机节点之间可以实现容器负载信息的共享,因此,有效地克服了现有技术中存在的容器共享数据库集群位置比较集中,从而容易造成业务请求迟缓或者宕机的缺陷,保证了该管理方法的实用性,有利于市场的推广与应用。The distributed container management method provided by this embodiment is implemented based on the Cassandra ring network topology, and each host node in the Cassandra ring network topology may include multiple containers, thereby effectively improving resource utilization; At the same time, the container load information can be shared between the host nodes. Therefore, it effectively overcomes the problem that the container shared database cluster in the prior art is relatively centralized, which easily causes the service request to be slow or downtime. The practicality of the management method is conducive to the promotion and application of the market.

图3为本发明实施例提供的Cassandra组件模块向容器管理模块发送容器负载请求信息的流程示意图,在上述实施例的基础上,继续参考附图3可知,本实施例中的宿主机节点中还包括协议解析模块,该协议解析模块用于对接预设的操作协议(Gossip操作协议)和对容器操作指令之间的解析和操作等等;进一步的,本实施例对于Cassandra组件模块向容器管理模块发送容器负载请求信息的具体实现过程不做限定,本领域技术人员可以根据具体的设计需求采用不同的实现方式,例如:Cassandra组件模块可以直接利用有线或者无线通信通道向容器管理模块发送容器负载请求信息;较为优选的,Cassandra组件模块向容器管理模块发送容器负载请求信息可以包括:FIG. 3 is a schematic flowchart of a Cassandra component module sending container load request information to a container management module according to an embodiment of the present invention. On the basis of the foregoing embodiment, it can be seen with continued reference to FIG. 3 that the host node in this embodiment also includes Including a protocol analysis module, the protocol analysis module is used for docking the preset operation protocol (Gossip operation protocol) and the analysis and operation between the container operation instructions, etc.; further, in this embodiment, the Cassandra component module to the container management module The specific implementation process for sending the container load request information is not limited, and those skilled in the art can adopt different implementation methods according to specific design requirements. For example, the Cassandra component module can directly use a wired or wireless communication channel to send a container load request to the container management module. information; preferably, the container load request information sent by the Cassandra component module to the container management module may include:

S1011:Cassandra组件模块向协议解析模块发送协议方法调用请求;S1011: The Cassandra component module sends a protocol method call request to the protocol parsing module;

其中,协议方法调用请求用于调用与Cassandra组件模块相对应的协议方法,常见的,该协议方法为gossip操作协议,各宿主机节点之间的Cassandra组件模块通过gossip操作协议实现相互协调和通信,可以有效地保证通信的质量和效率。Among them, the protocol method call request is used to call the protocol method corresponding to the Cassandra component module. Commonly, the protocol method is the gossip operation protocol. The Cassandra component modules between the host nodes realize mutual coordination and communication through the gossip operation protocol. It can effectively guarantee the quality and efficiency of communication.

S1012:协议解析模块根据协议方法调用请求确定所调用的协议方法,并将所确定调用的协议方法发送至Cassandra组件模块;S1012: The protocol analysis module determines the called protocol method according to the protocol method calling request, and sends the determined called protocol method to the Cassandra component module;

在协议解析模块接收到协议方法调用请求之后,可以根据该协议方法调用请求在预先设置的多个协议方法中查找所需要调用的协议方法,其中,协议方法调用请求中可以包含所需要调用的协议方法的标识信息,根据上述标识信息在多个协议方法中确定所需要调用的协议方法,进而确定了需要发送给Cassandra组件模块的协议方法。After the protocol parsing module receives the protocol method invocation request, it can search for the protocol method to be invoked among the preset multiple protocol methods according to the protocol method invocation request, wherein the protocol method invocation request may include the protocol to be invoked The identification information of the method is used to determine the protocol method to be called among the plurality of protocol methods according to the identification information, and further determines the protocol method to be sent to the Cassandra component module.

S1013:Cassandra组件模块利用所确定调用的协议方法向容器管理模块发送容器负载请求信息。S1013: The Cassandra component module sends the container load request information to the container management module by using the determined calling protocol method.

在Cassandra组件模块获取到调用的协议方法之后,可以利用该协议方法向容器管理模块发送容器负载请求信息,从而有效地保证了容器负载请求信息发送的可靠性,进一步提高了该管理方法使用的稳定可靠性。After the Cassandra component module obtains the called protocol method, the protocol method can be used to send the container load request information to the container management module, thereby effectively ensuring the reliability of the container load request information sending and further improving the stability of the management method. reliability.

图4为本发明实施例提供的另一种基于Cassandra环网络拓扑的分布式容器管理方法的流程示意图;图5为本发明实施例提供的目标宿主机节点根据容器数据信息创建相应的容器的流程示意图;在上述实施例的基础上,继续参考附图4-5可知,本实施例中的宿主机节点中还可以包括数据存储模块,该数据存储模块用于对宿主机节点上的运行数据进行存储,以方便对运行数据的调取与查看;为了进一步提高该管理方法的实用性,将该方法设置为还包括:4 is a schematic flowchart of another distributed container management method based on Cassandra ring network topology provided by an embodiment of the present invention; FIG. 5 is a process by which a target host node according to an embodiment of the present invention creates a corresponding container according to container data information Schematic diagram; on the basis of the above-mentioned embodiment, it can be seen that with reference to the accompanying drawings 4-5, the host node in this embodiment may further include a data storage module, and the data storage module is used to perform operation data on the host node. storage to facilitate the retrieval and viewing of operating data; in order to further improve the practicability of the management method, the method is set to further include:

S201:日志监控模块根据日志监控信息监控宿主机节点中容器的运行情况,若宿主机节点中存在容器运行异常情况,则向Cassandra组件模块发送异常提示信息;S201: The log monitoring module monitors the running status of the container in the host node according to the log monitoring information, and if there is an abnormal running condition of the container in the host node, it sends abnormal prompt information to the Cassandra component module;

宿主机节点中的日志监控模块可以实时采集宿主机节点中容器运行所生成的日志监控信息,该日志监控信息可以包括容器运行的时间、容器运行的状态或者容器运行的动作等等;在采集到日志监控信息之后,日志监控模块可以对该日志监控信息进行分析处理,从而可以实现监控宿主机节点中容器的运行情况的功能;在对日志监控信息进行分析处理时,可以将日志监控信息与预先设置的标准信息进行分析比较,当日志监控信息与标准信息不符合时,则可以确定宿主机节点中的容器运行异常;当日志监控信息与标准信息相符合时,则可以确定宿主机节点中的容器运行正常;其中,宿主机节点中包括多个容器,每个容器之间独立运行,因此,宿主机节点中可能会出现某一个或某几个容器出现运行异常、而其他容器运行正常的情况;当日志监控模块发现宿主机节点中存在容器运行异常情况,为了保证该宿主机节点业务请求的处理质量和效率,向Cassandra组件模块发送异常提示信息,其中,该异常提示信息中可以包括该运行异常的容器标识和/或运行异常的程度信息等等。The log monitoring module in the host node can collect the log monitoring information generated by the container running in the host node in real time. After the log monitoring information, the log monitoring module can analyze and process the log monitoring information, so as to realize the function of monitoring the running status of the container in the host node; when analyzing and processing the log monitoring information, the log monitoring information can be compared with the pre-processing information. The set standard information is analyzed and compared. When the log monitoring information does not meet the standard information, it can be determined that the container in the host node is running abnormally; when the log monitoring information is consistent with the standard information, it can be determined that the host node is running. The containers are running normally; among them, the host node includes multiple containers, and each container runs independently. Therefore, one or several containers may run abnormally in the host node, while other containers are running normally. ; When the log monitoring module finds that there is an abnormal container operation in the host node, in order to ensure the processing quality and efficiency of the service request of the host node, it sends the exception prompt information to the Cassandra component module, wherein the abnormal prompt information can include the operation The abnormal container identification and/or the degree of abnormal operation information, etc.

S202:Cassandra组件模块根据异常提示信息判断是否将该宿主机节点中运行异常的容器迁移至预设的目标宿主机节点上;若需要将容器迁移至目标宿主机节点上,则向数据存储模块发送数据请求信息;S202: The Cassandra component module judges whether to migrate the abnormally running container in the host node to the preset target host node according to the abnormal prompt information; if the container needs to be migrated to the target host node, send a message to the data storage module data request information;

在Cassandra组件模块获取到异常提示信息之后,可以对该异常提示信息进行分析判断,具体可以判断是否需要将该宿主机节点中运行异常的容器迁移至预设的目标宿主机节点上,例如:当对异常提示信息进行分析判断后,确定该宿主机节点中运行异常的容器异常程度较轻,该容器还可以处理相应的业务请求,此时,则可以确定该宿主机节点中运行异常的容器不需要迁移至目标宿主机节点上;而当对异常提示信息进行分析判断后,确定该宿主机节点中运行异常的容器异常程度较严重,即该容器无法处理相应的业务请求,此时,则可以确定该宿主机节点中运行异常的容器需要迁移至目标宿主机节点上,其中,目标宿主机节点为预先设置的,其可以为除了该宿主机节点以外的其他任意一个宿主机节点;当确认需要将容器迁移至目标宿主机节点上,则Cassandra组件模块可以向数据存储模块发送数据请求信息,该数据请求信息用于获取到与该宿主机节点上运行异常容器相对应的容器数据信息。After the Cassandra component module obtains the abnormal prompt information, it can analyze and judge the abnormal prompt information. Specifically, it can judge whether it is necessary to migrate the abnormally running container in the host node to the preset target host node, for example: when After analyzing and judging the abnormal prompt information, it is determined that the abnormality of the container running abnormally in the host node is relatively light, and the container can also process the corresponding service request. At this time, it can be determined that the abnormal container running in the host node is not abnormal. It needs to be migrated to the target host node; after analyzing and judging the abnormal prompt information, it is determined that the abnormality of the container running abnormally in the host node is more serious, that is, the container cannot process the corresponding business request. It is determined that the abnormally running container in the host node needs to be migrated to the target host node, where the target host node is preset, which can be any other host node except the host node; After migrating the container to the target host node, the Cassandra component module can send data request information to the data storage module, where the data request information is used to obtain container data information corresponding to the abnormal container running on the host node.

S203:数据存储模块根据数据请求信息查询与容器相对应的容器数据信息,并将容器数据信息发送至Cassandra组件模块;S203: The data storage module queries the container data information corresponding to the container according to the data request information, and sends the container data information to the Cassandra component module;

数据请求信息中可以包括容器标识信息,在数据存储模块接收到数据请求信息之后,可以根据上述的容器标识信息查询与该容器相对应的容器数据信息,查询到与运行异常容器相对应的容器数据信息之后,可以将该容器数据信息发送到Cassandra组件模块,以使得Cassandra组件模块可以将该容器数据信息转发至目标宿主机节点上。The data request information may include container identification information. After the data storage module receives the data request information, it can query the container data information corresponding to the container according to the above container identification information, and query the container data corresponding to the abnormal running container. After the information, the container data information can be sent to the Cassandra component module, so that the Cassandra component module can forward the container data information to the target host node.

S204:Cassandra组件模块将容器数据信息发送至目标宿主机节点上,以使得目标宿主机节点根据容器数据信息创建相应的容器。S204: The Cassandra component module sends the container data information to the target host node, so that the target host node creates a corresponding container according to the container data information.

在Cassandra组件模块获取到容器数据信息之后,为了便于将运行异常的容器迁移至目标宿主机节点上,需要将该容器数据信息发送至目标宿主机节点上,在目标宿主机节点接收到容器数据信息之后,可以根据该容器数据信息创建相应的容器,具体的,目标宿主机节点根据容器数据信息创建相应的容器可以包括:After the Cassandra component module obtains the container data information, in order to facilitate the migration of the abnormally running container to the target host node, the container data information needs to be sent to the target host node, and the container data information is received on the target host node. After that, a corresponding container can be created according to the container data information. Specifically, the target host node creating a corresponding container according to the container data information can include:

S2041:目标宿主机节点中的目标Cassandra组件模块接收容器数据信息,并将容器数据信息发送至目标宿主机节点中的目标容器管理模块;S2041: The target Cassandra component module in the target host node receives the container data information, and sends the container data information to the target container management module in the target host node;

在Cassandra组件模块将容器数据信息发送至目标宿主机节点上之后,目标宿主机节点中包括目标Cassandra组件模块、目标容器管理模块以及目标数据存储模块等,其中,目标Cassandra组件模块可以接收容器数据信息,在接收到该容器数据信息之后,可以将该容器数据信息发送至目标容器管理模块,以使得目标容器管理模块可以根据该容器数据信息创建相应的容器。After the Cassandra component module sends the container data information to the target host node, the target host node includes the target Cassandra component module, the target container management module, and the target data storage module, etc. The target Cassandra component module can receive the container data information. , after receiving the container data information, the container data information can be sent to the target container management module, so that the target container management module can create a corresponding container according to the container data information.

S2042:目标容器管理模块根据容器数据信息对容器进行创建,并将创建结果发送至目标Cassandra组件模块;S2042: The target container management module creates the container according to the container data information, and sends the creation result to the target Cassandra component module;

在目标容器管理模块接收到容器数据信息之后,可以根据该容器数据信息创建相应的容器,在容器创建完毕之后,可以将创建结果发送至目标Cassandra组件模块,以使得目标Cassandra组件模块可以及时了解到容器的创建运行情况。After the target container management module receives the container data information, it can create a corresponding container according to the container data information, and after the container is created, it can send the creation result to the target Cassandra component module, so that the target Cassandra component module can learn about it in time The creation and operation of the container.

S2043:目标Cassandra组件模块根据创建结果将容器数据信息发送至目标宿主机节点中的目标数据存储模块进行存储;并将创建结果发送至Cassandra组件模块。S2043: The target Cassandra component module sends the container data information to the target data storage module in the target host node for storage according to the creation result; and sends the creation result to the Cassandra component module.

当确定容器创建完毕之后,目标Cassandra组件模块可以将容器数据信息发送至目标宿主机节点中的目标数据存储模块进行存储,以方便后期对容器数据信息进行调取与查看。When it is determined that the container is created, the target Cassandra component module can send the container data information to the target data storage module in the target host node for storage, so as to facilitate later retrieval and viewing of the container data information.

本实施例通过日志监控模块对宿主机节点中容器的运行情况进行监控,在宿主机节点中存在容器运行异常情况时,则通过Cassandra组件模块将该运行异常的容器迁移至目标宿主机节点上,具体的,目标宿主机节点可以获取到Cassandra组件模块发送的与运行异常容器相对应的容器数据信息,并可以根据该容器数据信息创建相应的容器,从而实现了容器迁移的过程,从而保证了容器对业务请求处理的及时可靠性,进一步提高了该管理方法使用的稳定可靠性。In this embodiment, the log monitoring module is used to monitor the running status of the container in the host node. When there is an abnormal operation of the container in the host node, the abnormal running container is migrated to the target host node through the Cassandra component module. Specifically, the target host node can obtain the container data information corresponding to the abnormal running container sent by the Cassandra component module, and can create a corresponding container according to the container data information, thereby realizing the process of container migration and ensuring the container The timely reliability of business request processing further improves the stability and reliability of the management method.

图6为本发明实施例提供的又一种基于Cassandra环网络拓扑的分布式容器管理方法的流程示意图,在上述实施例的基础上,继续参考附图6可知,为了进一步提高该管理方法使用的稳定可靠性,在将创建结果发送至Cassandra组件模块之后,将该方法设置为还包括:FIG. 6 is a schematic flowchart of another distributed container management method based on the Cassandra ring network topology provided by an embodiment of the present invention. On the basis of the above embodiment, referring to FIG. Stable reliability, after sending the creation result to the Cassandra component module, set the method to also include:

S301:Cassandra组件模块向容器管理模块发送容器清除请求;S301: The Cassandra component module sends a container removal request to the container management module;

在将运行异常的容器成功迁移至目标宿主机节点之后,为了保证原宿主机节点工作的质量和效率,Cassandra组件模块可以向容器管理模块发送容器清除请求,该容器清除请求中包括运行异常容器的标识信息,用于将运行异常的容器在宿主机节点上删除,以保证宿主机节点的内存空间,提高宿主机节点对业务请求处理的质量和效率。After the abnormally running container is successfully migrated to the target host node, in order to ensure the work quality and efficiency of the original host node, the Cassandra component module can send a container removal request to the container management module. The container removal request includes the identifier of the abnormally running container. The information is used to delete the abnormally running container on the host node, so as to ensure the memory space of the host node and improve the quality and efficiency of the service request processing by the host node.

S302:容器管理模块根据容器清除请求将宿主机节点中运行异常的容器清除,并将清除结果发送至Cassandra组件模块。S302: The container management module clears the abnormally running container in the host node according to the container clearing request, and sends the clearing result to the Cassandra component module.

在容器管理模块接收到容器清除请求之后,可以根据该容器清除请求中所包括的容器标识信息查找到相应的容器数据,该容器数据为运行异常容器所对应的数据信息,可以将该容器数据进行清除,并将清除结果告知Cassandra组件模块,以使得Cassandra组件模块获取到宿主机节点中容器的状态信息。After the container management module receives the container removal request, it can find the corresponding container data according to the container identification information included in the container removal request. The container data is the data information corresponding to the abnormally running container. Clear, and notify the Cassandra component module of the clearing result, so that the Cassandra component module can obtain the status information of the container in the host node.

在将运行异常的容器成功迁移至目标宿主机节点之后,通过Cassandra组件模块向容器管理模块发送容器清除请求,容器管理模块可以根据容器清除请求将运行异常的容器删除,从而有效地保证了宿主机节点的内存空间,提高宿主机节点对业务请求处理的质量和效率。After the abnormally running container is successfully migrated to the target host node, a container removal request is sent to the container management module through the Cassandra component module, and the container management module can delete the abnormally running container according to the container removal request, thus effectively ensuring the host The memory space of the node improves the quality and efficiency of the service request processing by the host node.

具体应用时,在每一个宿主机节点上,主要是基于Cassandra技术实现对内的容器管理和对外网络协调的管理,从而实现整个容器集群的协调工作,该宿主机节点的架构如图7所示,该宿主机节点主要是基于Cassandra组件模块实现各个节点之间的通信以及对节点上的容器的管理等,节点之间通过Cassandra组件模块之间的Gossip通信协议实现节点之间的互相协调和通信机制。宿主机节点主要包括:Cassandra组件模块、协议解析模块、容器管理模块、数据存储模块、日志监控模块等,其中,协议解析模块、容器管理模块、数据存储模块、日志监控模块均与Cassandra组件模块通信连接;In specific applications, on each host node, the internal container management and external network coordination management are mainly based on Cassandra technology, so as to realize the coordination of the entire container cluster. The architecture of the host node is shown in Figure 7. , the host node is mainly based on the Cassandra component module to realize the communication between each node and the management of the container on the node, etc. The nodes realize the mutual coordination and communication between the nodes through the Gossip communication protocol between the Cassandra component modules mechanism. The host node mainly includes: Cassandra component module, protocol analysis module, container management module, data storage module, log monitoring module, etc. Among them, the protocol analysis module, container management module, data storage module, and log monitoring module all communicate with the Cassandra component module connect;

Cassandra组件模块:用于完成节点内部的管理和数据协调以及统一管理等;Cassandra component module: used to complete the internal management and data coordination and unified management of nodes;

容器网络:负责容器和宿主机节点之间的网络协议;网络路由:负责节点对外的网络路由和通信;Cassandra数据:负责整个节点的数据以及整个容器集群的数据备份等,其备份和读写机制主要基于Cassndra技术的相关机制来实现;Container network: responsible for the network protocol between the container and the host node; network routing: responsible for the external network routing and communication of the node; Cassandra data: responsible for the data of the entire node and the data backup of the entire container cluster, etc., its backup and read-write mechanism It is mainly implemented based on the related mechanism of Cassndra technology;

协议解析模块:用于对接Gossip操作协议和对容器操作指令之间的解析和操作等等;Protocol parsing module: used to connect the Gossip operation protocol and the parsing and operation between the container operation instructions, etc.;

容器管理模块:主要负责宿主机节点上创建的容器的管理等;Container management module: mainly responsible for the management of containers created on the host node;

数据存储模块:主要负责容器管理部分数据的保存等;Data storage module: mainly responsible for the storage of part of the container management data;

日志监控模块,主要负责收集容器运行和操作过程中的日志收集和监控情况;The log monitoring module is mainly responsible for collecting and monitoring logs during container operation and operation;

除此之外,该宿主机节点上还可以包括健康检查模块:该健康检查模块用于主要负责容器状态的检查等。In addition, the host node may also include a health check module: the health check module is mainly responsible for checking the container status, etc.

另外,参考附图2可知,宿主机节点之间的网络采用Cassandra组件模块、且利用点对点的gossip信息交换协议来实现。通过点对点的gossip协议来协调节点的信息以及容器之间协调的信息等。其中,Gossip协议实现节点之间信息的一致性,从而让各个节点的地位完全相同,没有中信节点一说。在gossip通信中的每个节点维护一组状态,用于实现节点状态和其他节点的信息保持一致。In addition, referring to FIG. 2 , it can be known that the network between the host nodes adopts the Cassandra component module, and uses the point-to-point gossip information exchange protocol to realize. Through the point-to-point gossip protocol, the information of the nodes and the information coordinated between the containers are coordinated. Among them, the Gossip protocol realizes the consistency of information between nodes, so that the status of each node is exactly the same, and there is no CITIC node. Each node in gossip communication maintains a set of states, which are used to keep the state of the node consistent with the information of other nodes.

基于Gossip的通信机制,在宿主机节点之间的通信状态主要有Cassandra数据中进行保存,而上层数据信息通过数据存储以及日志监控等来进行保存。依据宿主机节点以及宿主容器状态的信息等。Based on the communication mechanism of Gossip, the communication state between the host nodes is mainly stored in Cassandra data, and the upper-layer data information is stored through data storage and log monitoring. According to the information of the host node and the state of the host container, etc.

其中,本实施例提供的管理方法可以基于宿主机节点运行负载情况的机制实现负载信息机制在节点之间的同步,以便将节点负载过高的容器迁移到负载较少的宿主机节点上去,具体的,通过Cassandra技术中的gossip协议的负载信息同步机制,实现宿主机节点之间的负载信息共享,其具体交互过程参考附图8所示,包括:Among them, the management method provided in this embodiment can realize the synchronization of the load information mechanism between nodes based on the mechanism of the running load of the host node, so as to migrate the container with excessive node load to the host node with less load. Specifically, Through the load information synchronization mechanism of the gossip protocol in the Cassandra technology, the load information sharing between the host nodes is realized. The specific interaction process is shown in Figure 8, including:

步骤1:Cassandra组件模块在调用gossip协议方法向其他节点发送自身容器负载情况信息之前需要调用本节点的容器状态,通过协议解析翻译成内部调用方法;Step 1: The Cassandra component module needs to call the container state of the node before calling the gossip protocol method to send its own container load information to other nodes, and translate it into an internal calling method through protocol analysis;

步骤2:协议解析模块接受到协议调用,进行内部处理和方法调用;Step 2: The protocol parsing module receives the protocol call and performs internal processing and method call;

步骤3:通过方法调用向容器管理模块获取相关信息;Step 3: Obtain relevant information from the container management module through a method call;

步骤4:容器管理模块接收到方法调用,查询内部的容器资源运行情况等信息;Step 4: The container management module receives the method call, and queries the internal container resource operation status and other information;

步骤5:容器管理模块向日志监控模块发送其他信息查询请求;Step 5: The container management module sends other information query requests to the log monitoring module;

步骤6:日志监控模块根据容器管理模块发送的查询请求,调取相关信息进行处理;Step 6: The log monitoring module retrieves relevant information for processing according to the query request sent by the container management module;

步骤7:日志监控模块将相关信息反馈给容器管理;Step 7: The log monitoring module feeds back relevant information to the container management;

步骤8:容器管理模块将日志监控模块反馈的信息和本身的信息进行融合处理;Step 8: The container management module integrates the information fed back by the log monitoring module and its own information;

步骤9:容器管理模块将容器信息反馈至协议解析模块;Step 9: The container management module feeds back the container information to the protocol analysis module;

步骤10:协议解析模块组织成gossip协议接口信息;Step 10: The protocol parsing module is organized into gossip protocol interface information;

步骤11:协议解析模块反馈gossip协议信息至Cassandra组件模块。Step 11: The protocol parsing module feeds back the gossip protocol information to the Cassandra component module.

根据上述的负载信息同步的机制,在整个宿主机节点的集群中通过Cassandra技术中的gossip协议中的负载同步机制除了实现原有的Cassandra集群节点的负载信息同步之外,同时备份负载宿主机节点之上的容器负载运行情况的同步,从而在后续的容器运行与销毁、容器的迁移以及注册等等都实现了无主化的负载均衡分布方式,从而保证了容器的稳定运行以及资源的均衡分布,进一步提高了该管理方法使用的稳定可靠性。According to the above load information synchronization mechanism, the load synchronization mechanism in the gossip protocol in the Cassandra technology in the entire host node cluster not only realizes the load information synchronization of the original Cassandra cluster nodes, but also backs up the load host nodes. The above container load operation is synchronized, so that the subsequent container operation and destruction, container migration and registration, etc. are all implemented without master load balancing distribution mode, thus ensuring the stable operation of the container and the balanced distribution of resources. , which further improves the stability and reliability of the management method.

另外,依据上述的容器负载通信机制,当出现某一个宿主机节点的资源出现紧缺或者宿主机节点本身出现挂起等状况时,需要将节点之上的容器迁移到其他节点上,那么在保证容器能够顺利迁移以及迁移之后其他节点上的容器能够顺利访问,在迁移信息机制中需要保证上述两方面的迁移机制和消息同步。In addition, according to the above-mentioned container load communication mechanism, when there is a shortage of resources on a host node or the host node itself hangs, it is necessary to migrate the container on the node to other nodes. The migration information mechanism needs to ensure the above two aspects of the migration mechanism and message synchronization in order to be able to migrate smoothly and to be able to access containers on other nodes after the migration.

对于容器迁移资源请求机制而言,如上,当某一个宿主机节点的资源不够需要将容器迁移到其他节点时,需要向其他节点发出资源请求要求,查看其它节点中的资源比较充足的节点,具体可以按照网络路由路径和资源空闲数来得出一个最优解,从而作为容器迁移到该节点上的依据,此节点即为目标宿主机节点,其中,目标宿主机节点的最优解算法如下所示:For the container migration resource request mechanism, as above, when the resources of a host node are insufficient and the container needs to be migrated to other nodes, it is necessary to send resource requests to other nodes, and check the nodes with sufficient resources in other nodes. An optimal solution can be obtained according to the network routing path and the number of idle resources, which can be used as the basis for the container to migrate to this node. This node is the target host node. The optimal solution algorithm of the target host node is as follows :

Figure BDA0001333983620000131
Figure BDA0001333983620000131

其中(式1-1)的参数说明如下:The parameters of (Formula 1-1) are described as follows:

i:表示宿主机节点的个数,代表在出本身节点之外的所有其他集群节点的取值;C:表示宿主机节点本身的计算资源;M:表示宿主机节点本身的内存资源;T:表示从本节点出发到某宿主机节点的路由时间;而其他参数代表调整参数或者加权值。i: Represents the number of host nodes, and represents the value of all other cluster nodes except its own node; C: Represents the computing resources of the host node itself; M: Represents the memory resources of the host node itself; T: Indicates the routing time from this node to a host node; other parameters represent adjustment parameters or weighted values.

在该最优解算法中,取得最大值的宿主机节点认为是容器迁移最佳的节点,即为目标宿主机节点,并且将容器迁移到该目标宿主机节点上进行拉起。其实现流程如图9所示:将容器从一个宿主机节点中的容器迁移到另外一个目标宿主机节点上,其大致的流程如下:In this optimal solution algorithm, the host node with the maximum value is considered to be the node with the best container migration, that is, the target host node, and the container is migrated to the target host node to be pulled up. The implementation process is shown in Figure 9: Migrating a container from a container in one host node to another target host node, the general process is as follows:

步骤1:日志监控模块发现容器运行存在资源抢占异常的情况,向Cassandra组件模块进行报告;Step 1: The log monitoring module finds that there is abnormal resource preemption in the container operation, and reports to the Cassandra component module;

步骤2:Cassandra组件模块根据日志监控模块提交的异常情况进行决策后决定将指定容器迁移到目标宿主机节点(或者也可以为其他节点)上,并且开始向数据存储模块调取相关的信息;Step 2: The Cassandra component module makes a decision based on the abnormal situation submitted by the log monitoring module and decides to migrate the specified container to the target host node (or other nodes), and starts to retrieve relevant information from the data storage module;

步骤3:数据存储模块根据Cassandra组件模块的请求,将指定容器的参数和信息反馈至Cassandra组件模块;Step 3: The data storage module feeds back the parameters and information of the specified container to the Cassandra component module according to the request of the Cassandra component module;

步骤4:Cassandra组件模块将请求容器前期的请求发送至目标宿主机节点,其选择决策的算法参考上述的公式1-1;Step 4: The Cassandra component module sends the request in the early stage of the request container to the target host node, and the algorithm for its selection decision refers to the above formula 1-1;

步骤5:目标宿主机节点的目标Cassandra组件模块将迁移容器的参数发送给目标容器管理模块;Step 5: The target Cassandra component module of the target host node sends the parameters of the migration container to the target container management module;

步骤6:目标容器管理模块根据发来的容器参数进行容器创建,并将创建结果反馈至目标Cassandra组件模块;Step 6: The target container management module creates the container according to the sent container parameters, and feeds back the creation result to the target Cassandra component module;

步骤7:目标Cassandra组件模块根据创建的结果,将容器参数和数据保存在目标数据存储模块中;Step 7: The target Cassandra component module saves the container parameters and data in the target data storage module according to the created result;

步骤8:目标数据存储模块将保存完的结果反馈至目标Cassandra组件模块;Step 8: The target data storage module feeds back the saved result to the target Cassandra component module;

步骤9:目标宿主机节点将创建完成的结果反馈至原宿主机节点;Step 9: The target host node feeds back the created result to the original host node;

步骤10:原宿主机节点根据目标节点创建的结果开始消除容器;Step 10: The original host node starts to eliminate the container according to the result created by the target node;

步骤11:容器管理模块将消除容器的操作结果反馈至Cassandra组件模块;Step 11: The container management module feeds back the operation result of eliminating the container to the Cassandra component module;

步骤12:原宿主机节点清除数据,并将迁移消息通过Gossip在集群中进行广播;Step 12: The original host node clears the data and broadcasts the migration message in the cluster through Gossip;

步骤13:目标宿主机节点完成数据迁移后,将生效消息通过Gossip在集群中进行广播。Step 13: After the target host node completes the data migration, it broadcasts the effective message in the cluster through Gossip.

通过上述整个迁移机制,从而实现了一个完整的容器迁移过程。因此当由容器组成的数据集群中的其他容器在进行数据访问时,可以及时知道在目标宿主机节点上进行数据访问。Through the above-mentioned entire migration mechanism, a complete container migration process is realized. Therefore, when other containers in the data cluster composed of containers are accessing data, they can know in time that data access is performed on the target host node.

进一步的,该管理方法还可以包括容器迁移广播机制,该容器迁移广播机制是在容器迁移操作完成之后需要在整个集群中广播消息,告知集群中的所有节点原有的容器迁移到目标宿主机节点上,当有相关的容器或者数据服务需要访问该容器时,能够通过Cassandra集群网络访问指定的目标宿主机节点的位置。依据上述的迁移机制过程,在完成容器迁移之后,需要原宿主机节点广播申明容器已经迁移,同时在目标宿主机节点上广播申明指定的容器已经创建成功,从而集群中的所有节点都完成容器信息的更新。Further, the management method may further include a container migration broadcast mechanism, and the container migration broadcast mechanism needs to broadcast a message in the entire cluster after the container migration operation is completed, informing all nodes in the cluster that the original container is migrated to the target host node. Above, when a related container or data service needs to access the container, the location of the specified target host node can be accessed through the Cassandra cluster network. According to the above migration mechanism process, after the container migration is completed, the original host node needs to broadcast to declare that the container has been migrated, and at the same time broadcast to the target host node to declare that the specified container has been created successfully, so that all nodes in the cluster complete the container information. renew.

此外,本申请所提供的基于Cassandra的容器无主集群管理方法在没有主节点的情况下,主要采用Gossip协议实现节点状态的实时同步,其主要包括:节点启动、节点正常运行、Leaving(准备退出)以及节点退出等状态。In addition, the Cassandra-based container masterless cluster management method provided by this application mainly adopts the Gossip protocol to realize real-time synchronization of node status in the absence of a master node, which mainly includes: node startup, node normal operation, Leaving (ready to exit) ) and status such as node exit.

(1)对于节点启动机制而言,当新接入集群的宿主机节点启动时,通过Gossip通信协议在集群网络中进行广播,通知集群上面的所有其他节点已经有新的节点加入到该集群中,为后续的资源共享和容器迁移进行信息注册。(1) For the node startup mechanism, when the host node newly connected to the cluster starts up, it broadcasts in the cluster network through the Gossip communication protocol to notify all other nodes on the cluster that a new node has joined the cluster. , to register information for subsequent resource sharing and container migration.

(2)对于正常运行机制而言,为了保证节点的正常运行,需要在集群节点之间建立长效的健康检查通信机制。通过心跳方式实现各节点状态正常运行信息的实时同步。(2) For the normal operation mechanism, in order to ensure the normal operation of the nodes, a long-term health check communication mechanism needs to be established between the cluster nodes. Real-time synchronization of the normal operation information of the status of each node is realized by heartbeat mode.

(3)对于Leaving机制而言,对于计划下架的集群节点,有一个预先准备阶段。通过告知该节点将会从集群中下架,同时需要将节点上的宿主容器能够提前迁移到其他节点上去。容器迁移的机制则采用迁移机制来实现。(3) For the Leaving mechanism, there is a pre-preparation stage for the cluster nodes that are planned to be taken off the shelf. By informing that the node will be removed from the cluster, and the host container on the node needs to be migrated to other nodes in advance. The mechanism of container migration is implemented by the migration mechanism.

(4)对于退出机制而言,当完成预先准备阶段的Leaving机制,将宿主机节点上的容器迁移到其他节点之后,广播集群中的所有其他节点通知该节点已经完成下架准备。则其他节点在本身维护的数据信息中清除掉该节点的信息,完成该节点的下架处理。(4) For the exit mechanism, when the Leaving mechanism in the pre-preparation phase is completed and the container on the host node is migrated to other nodes, all other nodes in the broadcast cluster notify the node that the preparation for de-listing has been completed. Then other nodes clear the information of the node in the data information maintained by themselves, and complete the delisting process of the node.

除了上述集群节点的状态机制之外,同时维护容器状态的信息同步等。其过程如节点状态机制,和节点状态机制不相同之处在于,容器的具体状态信息维护在宿主机节点上,其他节点保存注册信息。In addition to the state mechanism of the above cluster nodes, it also maintains the synchronization of container state information. The process, such as the node state mechanism, is different from the node state mechanism in that the specific state information of the container is maintained on the host node, and other nodes save the registration information.

此外,该管理方法还可以利用预先设置的容器备份机制对节点集群进行容器备份,该容器的容灾备份机制(容器备份机制)是根据基于Cassandra的宿主机节点的容灾备份机制来实现的,根据Cassandra的副本备份机制,主要是通过虚拟节点以及Hash环来选择数据容灾备份的节点,一般一个节点选择两个节点作为数据备份和容器备份的节点,从而形成1:2的安全处理机制来实现。In addition, the management method can also use the preset container backup mechanism to perform container backup on the node cluster. The container disaster recovery backup mechanism (container backup mechanism) is implemented according to the disaster recovery backup mechanism of the Cassandra-based host node, According to Cassandra's copy backup mechanism, the nodes for data disaster recovery backup are mainly selected through virtual nodes and Hash rings. Generally, one node selects two nodes as nodes for data backup and container backup, thus forming a 1:2 security processing mechanism to accomplish.

在容器和数据访问方面,采用令牌的方式来实现。即在访问某一个指定的容器或者数据时,可以随机在某一个节点上进行访问。为了避免访问冲突,则采用令牌的方式进行唯一性确认,从而避免资源冲突。另外,在不同的节点上可以选择不同的节点作为备份节点。自身节点也可以作为其他节点的备份节点来实现。In terms of container and data access, it is implemented in the form of tokens. That is, when accessing a specified container or data, it can be accessed on a random node. In order to avoid access conflicts, uniqueness is confirmed by means of tokens, thereby avoiding resource conflicts. In addition, different nodes can be selected as backup nodes on different nodes. The own node can also be implemented as a backup node for other nodes.

图10为本发明实施例提供的一种基于Cassandra环网络拓扑的分布式容器管理系统的结构示意图,参考附图10所示,本实施例提供了一种基于Cassandra环网络拓扑的分布式容器管理系统,Cassandra环网络拓扑包括多个节点,每个节点上对应有一宿主机节点,宿主机节点中包括多个容器;系统包括:FIG. 10 is a schematic structural diagram of a distributed container management system based on a Cassandra ring network topology provided by an embodiment of the present invention. Referring to FIG. 10 , this embodiment provides a distributed container management system based on a Cassandra ring network topology The system, the Cassandra ring network topology includes multiple nodes, each node corresponds to a host node, and the host node includes multiple containers; the system includes:

Cassandra组件模块1,用于向容器管理模块2发送容器负载请求信息;Cassandra component module 1 is used to send container load request information to container management module 2;

容器管理模块2,用于根据容器负载请求信息获取自身存储的容器资源信息,并根据容器负载请求信息向日志监控模块3发送日志请求信息;The container management module 2 is used to obtain the container resource information stored by itself according to the container load request information, and send log request information to the log monitoring module 3 according to the container load request information;

日志监控模块3,用于根据日志请求信息获取到日志监控信息,并将日志监控信息发送至容器管理模块2;The log monitoring module 3 is used to obtain the log monitoring information according to the log request information, and send the log monitoring information to the container management module 2;

容器管理模块2,还用于接收日志监控信息,将容器资源信息和日志监控信息进行融合处理,获取到容器负载信息,并将容器负载信息发送至Cassandra组件模块1;The container management module 2 is also used to receive log monitoring information, integrate the container resource information and the log monitoring information, obtain the container load information, and send the container load information to the Cassandra component module 1;

Cassandra组件模块1,还用于接收容器负载信息,并将容器负载信息发送至其他宿主机节点,以实现宿主机节点之间容器负载信息的共享。The Cassandra component module 1 is also used to receive container load information, and send the container load information to other host nodes, so as to realize the sharing of container load information among the host nodes.

其中,对于Cassandra组件模块1、容器管理模块2以及日志监控模块3的具体形状结构不做限定,本领域技术人员可以根据其实现的功能对其进行任意设置;另外,本实施例中Cassandra组件模块1、容器管理模块2以及日志监控模块3所实现操作步骤的具体实现过程以及实现效果与上述实施例中步骤S101-S105的实现过程以及实现效果相同,具体可参考上述陈述内容,在此不再赘述。The specific shapes and structures of the Cassandra component module 1, the container management module 2, and the log monitoring module 3 are not limited, and those skilled in the art can arbitrarily set them according to their functions; in addition, in this embodiment, the Cassandra component module 1. The specific implementation process and implementation effect of the operation steps implemented by the container management module 2 and the log monitoring module 3 are the same as the implementation process and implementation effect of steps S101-S105 in the above-mentioned embodiment. Repeat.

本实施例所提供的分布式容器管理系统,该管理系统基于Cassandra环网络拓扑实现,而Cassandra环网络拓扑中的每个宿主机节点中可以包括多个容器,从而有效地提高了资源的利用;同时,利用Cassandra组件模块1可以实现宿主机节点之间容器负载信息的共享,因此,有效地克服了现有技术中存在的容器共享数据库集群位置比较集中,从而容易造成业务请求迟缓或者宕机的缺陷,保证了该管理系统的实用性,有利于市场的推广与应用。The distributed container management system provided by this embodiment is implemented based on the Cassandra ring network topology, and each host node in the Cassandra ring network topology may include multiple containers, thereby effectively improving resource utilization; At the same time, the use of Cassandra component module 1 can realize the sharing of container load information between host nodes. Therefore, it effectively overcomes the centralized location of container sharing database clusters in the prior art, which easily causes service requests to be slow or downtime. The defect ensures the practicability of the management system and is beneficial to the promotion and application of the market.

在上述实施例的基础上,继续参考附图10所示,该系统还可以包括:协议解析模块4;并且,本实施例对于Cassandra组件模块1向容器管理模块发送容器负载请求信息的具体实现过程不做限定,较为优选的:On the basis of the above-mentioned embodiment, and continuing to refer to FIG. 10, the system may further include: a protocol parsing module 4; and, in this embodiment, the specific implementation process of the Cassandra component module 1 sending the container load request information to the container management module Without limitation, the more preferred:

Cassandra组件模块1,还用于向协议解析模块4发送协议方法调用请求;The Cassandra component module 1 is also used to send a protocol method invocation request to the protocol parsing module 4;

协议解析模块4,用于根据协议方法调用请求确定所调用的协议方法,并将所确定调用的协议方法发送至Cassandra组件模块1;Protocol parsing module 4, for determining the called protocol method according to the protocol method calling request, and sending the determined calling protocol method to the Cassandra component module 1;

Cassandra组件模块1,还用于利用所确定调用的协议方法向容器管理模块2发送容器负载请求信息。The Cassandra component module 1 is further configured to send container load request information to the container management module 2 by using the determined calling protocol method.

其中,对于协议解析模块4的具体形状结构不做限定,本领域技术人员可以根据其实现的功能对其进行任意设置;另外,本实施例中Cassandra组件模块1、协议解析模块4所实现操作步骤的具体实现过程以及实现效果与上述实施例中步骤S1011-S1013的实现过程以及实现效果相同,具体可参考上述陈述内容,在此不再赘述。The specific shape and structure of the protocol analysis module 4 is not limited, and those skilled in the art can arbitrarily set it according to the functions it realizes; in addition, the operation steps implemented by the Cassandra component module 1 and the protocol analysis module 4 in this embodiment The specific implementation process and implementation effect are the same as the implementation process and implementation effect of steps S1011-S1013 in the above-mentioned embodiment. For details, please refer to the above-mentioned statement content, which will not be repeated here.

在Cassandra组件模块1获取到调用的协议方法之后,可以利用该协议方法向容器管理模块发送容器负载请求信息,从而有效地保证了容器负载请求信息发送的可靠性,进一步提高了该管理系统使用的稳定可靠性。After the Cassandra component module 1 obtains the called protocol method, the protocol method can be used to send the container load request information to the container management module, thereby effectively ensuring the reliability of the sending of the container load request information, and further improving the use of the management system. Stable reliability.

进一步的,继续参考附图10所示,该系统还可以包括:数据存储模块5;为了进一步提高该管理系统的实用性,日志监控模块3,还用于根据日志监控信息监控宿主机节点中容器的运行情况,若宿主机节点中存在容器运行异常情况,则向Cassandra组件模块1发送异常提示信息;Further, as shown in FIG. 10, the system may further include: a data storage module 5; in order to further improve the practicability of the management system, the log monitoring module 3 is also used to monitor the containers in the host node according to the log monitoring information If there is an abnormal operation of the container in the host node, it will send abnormal notification information to Cassandra component module 1;

Cassandra组件模块1,还用于根据异常提示信息判断是否将该宿主机节点中运行异常的容器迁移至预设的目标宿主机节点上;若需要将容器迁移至目标宿主机节点上,则向数据存储模块5发送数据请求信息;The Cassandra component module 1 is also used to judge whether to migrate the abnormally running container in the host node to the preset target host node according to the abnormal prompt information; if the container needs to be migrated to the target host node, the data The storage module 5 sends data request information;

数据存储模块5,还用于根据数据请求信息查询与容器相对应的容器数据信息,并将容器数据信息发送至Cassandra组件模块1;The data storage module 5 is also used to query the container data information corresponding to the container according to the data request information, and send the container data information to the Cassandra component module 1;

Cassandra组件模块1,还用于将容器数据信息发送至目标宿主机节点上,以使得目标宿主机节点根据容器数据信息创建相应的容器。The Cassandra component module 1 is further configured to send the container data information to the target host node, so that the target host node creates a corresponding container according to the container data information.

具体的,在Cassandra组件模块1获取到容器数据信息之后,为了便于将运行异常的容器迁移至目标宿主机节点上,需要将该容器数据信息发送至目标宿主机节点上,在目标宿主机节点接收到容器数据信息之后,可以根据该容器数据信息创建相应的容器,具体的,目标宿主机节点可以包括:目标Cassandra组件模块、目标容器管理模块和目标数据存储模块,从而,目标Cassandra组件模块,用于接收容器数据信息,并将容器数据信息发送至目标容器管理模块;目标容器管理模块,用于根据容器数据信息对容器进行创建,并将创建结果发送至目标Cassandra组件模块;目标Cassandra组件模块,还用于根据创建结果将容器数据信息发送至目标数据存储模块进行存储;并将创建结果发送至Cassandra组件模块。Specifically, after the Cassandra component module 1 obtains the container data information, in order to facilitate the migration of the abnormally running container to the target host node, the container data information needs to be sent to the target host node, and received on the target host node. After the container data information is obtained, a corresponding container can be created according to the container data information. Specifically, the target host node may include: a target Cassandra component module, a target container management module, and a target data storage module, so that the target Cassandra component module, using It is used to receive container data information and send the container data information to the target container management module; the target container management module is used to create the container according to the container data information, and send the creation result to the target Cassandra component module; the target Cassandra component module, It is also used to send the container data information to the target data storage module for storage according to the creation result; and send the creation result to the Cassandra component module.

本实施例中Cassandra组件模块1、容器管理模块2、日志监控模块3以及数据存储模块5所实现操作步骤的具体实现过程以及实现效果与上述实施例中步骤S201-S204、S2041-S2043的实现过程以及实现效果相同,具体可参考上述陈述内容,在此不再赘述。The specific implementation process and implementation effect of the operation steps implemented by the Cassandra component module 1, the container management module 2, the log monitoring module 3, and the data storage module 5 in this embodiment are the same as the implementation processes of steps S201-S204 and S2041-S2043 in the above embodiment And the implementation effect is the same, for details, reference can be made to the above statement, which will not be repeated here.

本实施例通过日志监控模块3对宿主机节点中容器的运行情况进行监控,在宿主机节点中存在容器运行异常情况时,则通过Cassandra组件模块1将该运行异常的容器迁移至目标宿主机节点上,具体的,目标宿主机节点可以获取到Cassandra组件模块1发送的与运行异常容器相对应的容器数据信息,并可以根据该容器数据信息创建相应的容器,从而实现了容器迁移的过程,从而保证了容器对业务请求处理的及时可靠性,进一步提高了该管理系统使用的稳定可靠性。In this embodiment, the log monitoring module 3 monitors the running status of the container in the host node. When there is an abnormal operation of the container in the host node, the Cassandra component module 1 migrates the abnormally running container to the target host node. Specifically, the target host node can obtain the container data information corresponding to the abnormal running container sent by the Cassandra component module 1, and can create a corresponding container according to the container data information, thereby realizing the process of container migration, thereby This ensures the timely reliability of the processing of business requests by the container, and further improves the stability and reliability of the management system.

在上述实施例的基础上,继续参考附图10所示,为了进一步提高该管理系统使用的稳定可靠性,Cassandra组件模块1,还用于在将创建结果发送至Cassandra组件模块1之后,向容器管理模块2发送容器清除请求;On the basis of the above-mentioned embodiment, and continuing to refer to FIG. 10, in order to further improve the stability and reliability of the management system, the Cassandra component module 1 is also used to send the creation result to the Cassandra component module 1 to send the The management module 2 sends a container removal request;

容器管理模块2,用于根据容器清除请求将宿主机节点中运行异常的容器清除,并将清除结果发送至Cassandra组件模块1。The container management module 2 is used for clearing the abnormally running containers in the host node according to the container clearing request, and sending the clearing result to the Cassandra component module 1 .

本实施例中Cassandra组件模块1、容器管理模块2所实现操作步骤的具体实现过程以及实现效果与上述实施例中步骤S301-S302的实现过程以及实现效果相同,具体可参考上述陈述内容,在此不再赘述。The specific implementation process and implementation effect of the operation steps implemented by the Cassandra component module 1 and the container management module 2 in this embodiment are the same as the implementation process and implementation effect of steps S301-S302 in the above-mentioned embodiment. No longer.

在将运行异常的容器成功迁移至目标宿主机节点之后,通过Cassandra组件模块1向容器管理模块2发送容器清除请求,容器管理模块2可以根据容器清除请求将运行异常的容器删除,从而有效地保证了宿主机节点的内存空间,提高宿主机节点对业务请求处理的质量和效率。After the abnormally running container is successfully migrated to the target host node, a container removal request is sent to the container management module 2 through the Cassandra component module 1, and the container management module 2 can delete the abnormally running container according to the container removal request, thereby effectively guaranteeing The memory space of the host node is increased, and the quality and efficiency of the host node's processing of business requests are improved.

在本发明所提供的几个实施例中,应该理解到,所揭露的装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。In the several embodiments provided by the present invention, it should be understood that the disclosed apparatus and method may be implemented in other manners. For example, the apparatus embodiments described above are only illustrative. For example, the division of units is only a logical function division. In actual implementation, there may be other division methods, for example, multiple units or components may be combined or integrated. to another system, or some features can be ignored, or not implemented. On the other hand, the shown or discussed mutual coupling or direct coupling or communication connection may be through some interfaces, indirect coupling or communication connection of devices or units, and may be in electrical, mechanical or other forms.

作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。Units described as separate components may or may not be physically separated, and components shown as units may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution in this embodiment.

另外,在本发明各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用硬件加软件功能单元的形式实现。In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically alone, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware, or may be implemented in the form of hardware plus software functional units.

上述以软件功能单元的形式实现的集成的单元,可以存储在一个计算机可读取存储介质中。上述软件功能单元存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)或处理器(processor)执行本发明各个实施例方法的部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(Read-OnlyMemory,ROM)、随机存取存储器(Random Access Memory,RAM)、磁碟或者光盘等各种可以存储程序代码的介质。The above-mentioned integrated units implemented in the form of software functional units can be stored in a computer-readable storage medium. The above-mentioned software functional unit is stored in a storage medium, and includes several instructions to cause a computer device (which may be a personal computer, a server, or a network device, etc.) or a processor (processor) to execute some steps of the methods in the various embodiments of the present invention. . The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), magnetic disk or optical disk and other media that can store program codes.

本领域技术人员可以清楚地了解到,为描述的方便和简洁,仅以上述各功能模块的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的功能模块完成,即将装置的内部结构划分成不同的功能模块,以完成以上描述的全部或者部分功能。上述描述的装置的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。Those skilled in the art can clearly understand that, for the convenience and brevity of the description, only the division of the above functional modules is used for illustration. The internal structure is divided into different functional modules to complete all or part of the functions described above. For the specific working process of the apparatus described above, reference may be made to the corresponding process in the foregoing method embodiments, and details are not described herein again.

最后应说明的是:以上各实施例仅用以说明本发明的技术方案,而非对其限制;尽管参照前述各实施例对本发明进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分或者全部技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本发明各实施例技术方案的范围。Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, but not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that: The technical solutions described in the foregoing embodiments can still be modified, or some or all of the technical features thereof can be equivalently replaced; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the technical solutions of the embodiments of the present invention. scope.

Claims (10)

1. A distributed container management method based on a Cassandra ring network topology is characterized in that the Cassandra ring network topology comprises a plurality of nodes, each node is correspondingly provided with a host node, and the host node comprises a plurality of containers; the host node further comprises a Cassandra component module, a container management module and a log monitoring module, and the method comprises the following steps:
the Cassandra component module sends container load request information to the container management module;
the container management module acquires container resource information stored by the container management module according to the container load request information and sends log request information to the log monitoring module according to the container load request information;
the log monitoring module acquires log monitoring information according to the log request information and sends the log monitoring information to the container management module;
the container management module receives the log monitoring information, performs fusion processing on the container resource information and the log monitoring information to obtain container load information, and sends the container load information to the Cassandra component module, wherein the container load information is data information which needs to be shared among all host nodes;
and the Cassandra component module receives the container load information and sends the container load information to other host nodes so as to realize the sharing of the container load information among the host nodes.
2. The method of claim 1, wherein the host node further comprises a protocol parsing module, and wherein the Cassandra component module sends container load request information to the container management module, comprising:
the Cassandra component module sends a protocol method calling request to the protocol analysis module;
the protocol analysis module determines the called protocol method according to the protocol method calling request and sends the determined called protocol method to the Cassandra component module;
the Cassandra component module sends container load request information to the container management module using the determined invoked protocol method.
3. The method according to claim 1 or 2, wherein the host node further comprises a data storage module, the method further comprising:
the log monitoring module monitors the operation condition of a container in the host node according to the log monitoring information, and if the container operation abnormal condition exists in the host node, the log monitoring module sends abnormal prompt information to the Cassandra component module;
the Cassandra component module judges whether a container with abnormal operation in the host node is migrated to a preset target host node or not according to the abnormal prompt information; if the container needs to be migrated to the target host node, sending data request information to the data storage module;
the data storage module inquires container data information corresponding to the container according to the data request information and sends the container data information to the Cassandra component module;
and the Cassandra component module sends the container data information to the target host node, so that the target host node creates a corresponding container according to the container data information.
4. The method of claim 3, wherein the target host node creates a corresponding container according to the container data information, comprising:
a target Cassandra component module in the target host node receives the container data information and sends the container data information to a target container management module in the target host node;
the target container management module creates a container according to the container data information and sends a creation result to the target Cassandra component module;
the target Cassandra component module sends the container data information to a target data storage module in a target host node for storage according to a creation result; and sending the creation result to the Cassandra component module.
5. The method of claim 4, wherein after sending the created result to the Cassandra component module, the method further comprises:
the Cassandra component module sending a container clear request to the container management module;
and the container management module clears the container which runs abnormally in the host node according to the container clearing request and sends a clearing result to the Cassandra component module.
6. A distributed container management system based on a Cassandra ring network topology is characterized in that the Cassandra ring network topology comprises a plurality of nodes, each node is correspondingly provided with a host node, and the host node comprises a plurality of containers; the system comprises:
the Cassandra component module is used for sending container load request information to the container management module;
the container management module is used for acquiring self-stored container resource information according to the container load request information and sending log request information to the log monitoring module according to the container load request information;
the log monitoring module is used for acquiring log monitoring information according to the log request information and sending the log monitoring information to the container management module;
the container management module is further configured to receive the log monitoring information, perform fusion processing on the container resource information and the log monitoring information, acquire container load information, and send the container load information to the Cassandra component module, where the container load information is data information that needs to be shared among all host nodes;
the Cassandra component module is further configured to receive the container load information and send the container load information to other host nodes, so as to implement sharing of the container load information between the host nodes.
7. The system of claim 6, further comprising: a protocol analysis module;
the Cassandra component module is also used for sending a protocol method calling request to the protocol analysis module;
the protocol analysis module is used for determining the called protocol method according to the protocol method calling request and sending the determined called protocol method to the Cassandra component module;
the Cassandra component module is further configured to send container load request information to the container management module using the determined invoked protocol method.
8. The system according to claim 6 or 7, characterized in that it further comprises: a data storage module;
the log monitoring module is further configured to monitor an operation condition of a container in the host node according to the log monitoring information, and send an abnormal prompt message to the Cassandra component module if the abnormal operation condition of the container exists in the host node;
the Cassandra component module is further used for judging whether to migrate a container with abnormal operation in the host node to a preset target host node according to the abnormal prompt information; if the container needs to be migrated to the target host node, sending data request information to the data storage module;
the data storage module is further configured to query container data information corresponding to the container according to the data request information, and send the container data information to the Cassandra component module;
the Cassandra component module is further configured to send the container data information to the target host node, so that the target host node creates a corresponding container according to the container data information.
9. The system of claim 8, wherein the target host node comprises: the system comprises a target Cassandra component module, a target container management module and a target data storage module;
the target Cassandra component module is used for receiving the container data information and sending the container data information to the target container management module;
the target container management module is used for creating a container according to the container data information and sending a creation result to the target Cassandra component module;
the target Cassandra component module is also used for sending the container data information to the target data storage module for storage according to a creation result; and sending the creation result to the Cassandra component module.
10. The system of claim 9,
the Cassandra component module is further used for sending a container clearing request to the container management module after sending a creating result to the Cassandra component module;
and the container management module is used for clearing the container which runs abnormally in the host node according to the container clearing request and sending a clearing result to the Cassandra component module.
CN201710502392.5A 2017-06-27 2017-06-27 Distributed container management method and system Active CN107368369B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710502392.5A CN107368369B (en) 2017-06-27 2017-06-27 Distributed container management method and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710502392.5A CN107368369B (en) 2017-06-27 2017-06-27 Distributed container management method and system

Publications (2)

Publication Number Publication Date
CN107368369A CN107368369A (en) 2017-11-21
CN107368369B true CN107368369B (en) 2020-07-28

Family

ID=60306504

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710502392.5A Active CN107368369B (en) 2017-06-27 2017-06-27 Distributed container management method and system

Country Status (1)

Country Link
CN (1) CN107368369B (en)

Families Citing this family (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109101342B (en) * 2018-07-20 2020-07-10 北京百度网讯科技有限公司 Distributed job coordination control method, device, computer equipment and storage medium
CN110837407B (en) * 2018-08-15 2023-04-28 阿里巴巴集团控股有限公司 Server-free cloud service system, resource management method thereof and electronic equipment
CN112084795A (en) * 2019-06-12 2020-12-15 阿里巴巴集团控股有限公司 Translation system and translation service calling method and device
CN110351149A (en) * 2019-07-26 2019-10-18 北京神州绿盟信息安全科技股份有限公司 A kind of method and device for safeguarding network data Forwarding plane
CN112540844A (en) * 2019-09-20 2021-03-23 北京京东尚科信息技术有限公司 Container scheduling method and device in cluster, storage medium and electronic equipment
CN111209083B (en) * 2020-01-08 2023-05-09 中国联合网络通信集团有限公司 Container scheduling method, device and storage medium
CN111580927B (en) * 2020-04-02 2024-03-19 武汉旷视金智科技有限公司 Communication method and container communication system
CN114185641B (en) * 2021-11-11 2024-02-27 北京百度网讯科技有限公司 Virtual machine cold migration method and device, electronic equipment and storage medium
CN114138561B (en) * 2021-12-02 2025-08-22 上海沄熹科技有限公司 System and method for accelerating copy balancing of distributed database
CN114416111B (en) * 2021-12-29 2025-01-03 北京航天测控技术有限公司 A non-intrusive equipment health management algorithm library construction method
CN114760323B (en) * 2022-03-02 2024-08-20 浙江吉利控股集团有限公司 Vehicle position information processing method, processing system and storage medium

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9967318B2 (en) * 2011-02-09 2018-05-08 Cisco Technology, Inc. Apparatus, systems, and methods for cloud agnostic multi-tier application modeling and deployment
CN102737130A (en) * 2012-06-21 2012-10-17 广州从兴电子开发有限公司 Method and system for processing metadata of hadoop distributed file system (HDFS)
CN105704217B (en) * 2016-01-15 2018-09-25 中国人民解放军国防科学技术大学 It is a kind of transparent based on event driven symbiosis virtual machine Dynamic Discovery method
CN106020930B (en) * 2016-05-13 2019-07-23 深圳市中润四方信息技术有限公司 A kind of application management method and system based on application container
CN105979009B (en) * 2016-07-06 2019-05-17 乾云数创(山东)信息技术研究院有限公司 A kind of increase load automatic balancing method for cloud application container

Also Published As

Publication number Publication date
CN107368369A (en) 2017-11-21

Similar Documents

Publication Publication Date Title
CN107368369B (en) Distributed container management method and system
CN1996847B (en) Image and Multimedia Data Communication and Storage System Based on Collaborative Grid
US9906598B1 (en) Distributed data storage controller
JP6317856B2 (en) Smooth controller change in redundant configuration between clusters
US8918392B1 (en) Data storage mapping and management
US8930364B1 (en) Intelligent data integration
CN112099918A (en) Live migration of clusters in containerized environments
US11314444B1 (en) Environment-sensitive distributed data management
US8856091B2 (en) Method and apparatus for sequencing transactions globally in distributed database cluster
CN102904949B (en) Replica-based dynamic metadata cluster system
US20120180070A1 (en) Single point, scalable data synchronization for management of a virtual input/output server cluster
US20070061379A1 (en) Method and apparatus for sequencing transactions globally in a distributed database cluster
JP2016517124A (en) Efficient read replica
CN103763155A (en) Multi-service heartbeat monitoring method for distributed type cloud storage system
CN102012944B (en) Distributed NOSQL (not only structured query language) database capable of providing replication property
CN103428288B (en) Based on the copies synchronized method of subregion state table and coordinator node
US20140297834A1 (en) Management of a plurality of system control networks
CN106547790B (en) A relational database service system
CN106790403B (en) Method for realizing mobile cloud computing intermediate platform and method for realizing distribution
CN114253929A (en) Network disk system architecture based on distributed file storage
CN103500126A (en) Automated fault-tolerant configuration method for cloud computing platform
CN118643102A (en) Data sending method, device, computer equipment and medium
CN117056303B (en) Data storage method and device suitable for military operation big data
CN111597157A (en) Method for improving log processing system architecture
CN113360319B (en) Data backup method and device

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