CN104320344A - Dynamic application cluster implement method based on Nginx - Google Patents

Dynamic application cluster implement method based on Nginx Download PDF

Info

Publication number
CN104320344A
CN104320344A CN201410584206.3A CN201410584206A CN104320344A CN 104320344 A CN104320344 A CN 104320344A CN 201410584206 A CN201410584206 A CN 201410584206A CN 104320344 A CN104320344 A CN 104320344A
Authority
CN
China
Prior art keywords
nginx
application
routing table
dynamic
port
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.)
Pending
Application number
CN201410584206.3A
Other languages
Chinese (zh)
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.)
IEIT Systems Co Ltd
Original Assignee
Langchao Electronic Information Industry 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 Langchao Electronic Information Industry Co Ltd filed Critical Langchao Electronic Information Industry Co Ltd
Priority to CN201410584206.3A priority Critical patent/CN104320344A/en
Publication of CN104320344A publication Critical patent/CN104320344A/en
Pending legal-status Critical Current

Links

Landscapes

  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

本发明提供了一种基于Nginx实现动态应用集群的方法,向系统提供被应用的相关信息,所述相关信息包括应用的IP、端口和域名;系统将应用的IP、端口和域名信息在内存中进行维护,形成动态路由表;访问应用时通过Nginx根据维护的动态路由表进行转发;动态路由表中增加或者减少应用信息,Nginx不用重启便可进行动态转发。

The present invention provides a kind of method based on Nginx to realize the dynamic application cluster, provides relevant information to be applied to the system, and described relevant information includes the IP of application, port and domain name; Perform maintenance to form a dynamic routing table; Nginx forwards according to the maintained dynamic routing table when accessing the application; add or reduce application information in the dynamic routing table, and Nginx can perform dynamic forwarding without restarting.

Description

一种基于Nginx实现动态应用集群的方法A method of implementing dynamic application cluster based on Nginx

技术领域 technical field

本发明涉及计算机应用技术领域,特别涉及一种基于Nginx实现动态应用集群的方法。 The invention relates to the technical field of computer applications, in particular to a method for realizing dynamic application clusters based on Nginx.

背景技术 Background technique

随着信息技术的发展,信息化程度的不断提高,开发出一个新系统的受众用户越来越多,信息化系统向集群化和集中化管理发展。在传统集群管理中修改集群中的成员会造成请求中断,为了解决这一问题发明了这种方法。 With the development of information technology and the continuous improvement of the degree of informatization, more and more audience users have developed a new system, and the information system is developing towards clustering and centralized management. In traditional cluster management, modifying members in the cluster will cause request interruption, and this method was invented to solve this problem.

发明内容 Contents of the invention

本发明的目的是提供一种基于Nginx实现动态应用集群的方法。 The purpose of the present invention is to provide a method for realizing dynamic application cluster based on Nginx.

本发明的目的是按以下方式实现的,具体步骤如下: The object of the present invention is achieved in the following manner, and concrete steps are as follows:

a)向本装置提供被应用的相关信息,所述相关信息包括应用的IP、端口和域名; a) Provide relevant information of the application to the device, and the relevant information includes the IP, port and domain name of the application;

b)本装置将应用的IP、端口和域名信息在内存中进行维护,形成动态路由表; b) The device maintains the applied IP, port and domain name information in memory to form a dynamic routing table;

c)访问应用时通过Nginx根据维护的动态路由表进行转发;d)动态路由表中增加或者减少应用信息,Nginx不用重启便可进行动态转发。 c) When accessing the application, Nginx forwards according to the maintained dynamic routing table; d) Add or reduce application information in the dynamic routing table, and Nginx can perform dynamic forwarding without restarting.

所述应用为web应用程序,在步骤a)中,应用需要的状态需要是启动的。 The application is a web application, and in step a), the state required by the application needs to be started.

所述动态路由表一种key-value格式的数据结构,数据结构中域名作为key的方式存在,value是IP和端口的组合。 The dynamic routing table is a data structure in key-value format, in which the domain name exists as a key, and the value is a combination of IP and port.

附图说明 Description of drawings

图1是根据本发明的对系统进程进行监控并自管理的流程图。 Fig. 1 is a flow chart of monitoring and self-managing system processes according to the present invention.

具体实施方式 Detailed ways

为使本发明的目的、技术方案和优点更加清楚,下面将结合附图对本发明的实施例作详细描述。 In order to make the object, technical solution and advantages of the present invention clearer, the embodiments of the present invention will be described in detail below with reference to the accompanying drawings.

一般情况下系统的物理架构分为三层,第一层为物理的负载均衡器(F5);第二层为软件的负载均衡器(Apache或者Nginx);第三层为运行系统的应用服务器。本方法解决的是第二层到第三层动态负载的问题。传统上第二层到第三层的负载转发是通过修改第二层负载均衡器的配置文件实现的,修改完配置文件需要进程重启负载均衡器,会导致请求中断,这样使用起来非常不便。 Generally, the physical structure of the system is divided into three layers. The first layer is the physical load balancer (F5); the second layer is the software load balancer (Apache or Nginx); the third layer is the application server running the system. This method solves the problem of dynamic load from the second layer to the third layer. Traditionally, the load forwarding from the second layer to the third layer is realized by modifying the configuration file of the second layer load balancer. After modifying the configuration file, the process needs to restart the load balancer, which will cause request interruption, which is very inconvenient to use.

下面参照图1描述本发明的方法的实现步骤。 The implementation steps of the method of the present invention are described below with reference to FIG. 1 .

在步骤S101中,提供被应用的相关信息,所述相关信息包括应用的IP、端口和域名; In step S101, relevant information of the application is provided, and the relevant information includes the IP, port and domain name of the application;

在步骤S102中,本装置将应用的IP、端口和域名信息在内存中进行维护,形成动态路由表。数据举例如下: In step S102, the device maintains the IP, port and domain name information of the application in memory to form a dynamic routing table. Examples of data are as follows:

名称:           状态 Name: Status

app1           192.168.1.1:8080 app1 192.168.1.1:8080

在步骤S103中,访问应用时通过Nginx根据维护的动态路由表进行转发。如Nginx的ip和端口为192.168.1.0:80,在配置好Nginx和应用app1之间的转发后,访问app1可以通过192.168.1.0:80/app1进行访问。 In step S103, Nginx forwards according to the maintained dynamic routing table when accessing the application. For example, the ip and port of Nginx are 192.168.1.0:80. After the forwarding between Nginx and application app1 is configured, access to app1 can be accessed through 192.168.1.0:80/app1.

在步骤S104中,动态路由表中增加或者减少应用信息,Nginx不用重启便可进行动态转发。在S102中的app1增加节点,如下: In step S104, the application information is increased or decreased in the dynamic routing table, and Nginx can perform dynamic forwarding without restarting. Add nodes to app1 in S102, as follows:

名称:           状态 Name: Status

app1           192.168.1.1:8080 app1 192.168.1.1:8080

app1           192.168.1.2:8080 app1 192.168.1.2:8080

app1           192.168.1.3:8080 app1 192.168.1.3:8080

通过192.168.1.0:80/app1访问app1是在不中断请求的情况下增加了处理能力。 Accessing app1 via 192.168.1.0:80/app1 adds processing power without interrupting requests.

除说明书所述的技术特征外,均为本专业技术人员的已知技术。 Except for the technical features described in the instructions, all are known technologies by those skilled in the art.

Claims (2)

1. realize a method for dynamic application cluster based on Nginx, it is characterized in that concrete steps comprise:
A) provide the relevant information be employed to this device, described relevant information comprises the IP of application, port and domain name;
B) IP of application, port and domain-name information are safeguarded by this device in internal memory, formative dynamics routing table;
C) forwarded according to the dynamic routing table safeguarded by Nginx during access application;
D) increase in dynamic routing table or reduce application message, Nginx need not be restarted and just can dynamically be forwarded.
2. method according to claim 1, it is characterized in that dynamic routing table is a kind of data structure of key-value form, in data structure, domain name exists as the mode of key, and value is the combination of IP and port.
CN201410584206.3A 2014-10-28 2014-10-28 Dynamic application cluster implement method based on Nginx Pending CN104320344A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201410584206.3A CN104320344A (en) 2014-10-28 2014-10-28 Dynamic application cluster implement method based on Nginx

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201410584206.3A CN104320344A (en) 2014-10-28 2014-10-28 Dynamic application cluster implement method based on Nginx

Publications (1)

Publication Number Publication Date
CN104320344A true CN104320344A (en) 2015-01-28

Family

ID=52375518

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201410584206.3A Pending CN104320344A (en) 2014-10-28 2014-10-28 Dynamic application cluster implement method based on Nginx

Country Status (1)

Country Link
CN (1) CN104320344A (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106844201A (en) * 2016-12-30 2017-06-13 北京五八信息技术有限公司 Test environment dispositions method and system
CN106959870A (en) * 2017-02-20 2017-07-18 北京数字联盟网络科技有限公司 Nginx dynamic module loading method and device
CN106961469A (en) * 2017-02-28 2017-07-18 北京致远互联软件股份有限公司 Unaware orientation Proxy Method and system based on http proxy servers
CN108418764A (en) * 2018-02-07 2018-08-17 深圳壹账通智能科技有限公司 Current-limiting method, device, computer equipment and storage medium
CN110580173A (en) * 2019-09-16 2019-12-17 山东浪潮通软信息科技有限公司 configuration-based dynamic route registration method and system
CN119537345A (en) * 2024-11-07 2025-02-28 北京原点数安科技有限公司 Database proxy method, device and electronic equipment

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102426742A (en) * 2011-09-21 2012-04-25 太仓市同维电子有限公司 Security protection system and method based on wireless router
CN103078827A (en) * 2011-10-25 2013-05-01 腾讯数码(天津)有限公司 Open platform system called by third-party applications and implementation method for open platform system
US20130163731A1 (en) * 2011-09-11 2013-06-27 Steven Kai-Man Yan Techniques for Customer Relationship Management
US20140173039A1 (en) * 2012-12-13 2014-06-19 Level 3 Communications, Llc Framework Supporting Content Delivery With Reducer Services Network

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130163731A1 (en) * 2011-09-11 2013-06-27 Steven Kai-Man Yan Techniques for Customer Relationship Management
CN102426742A (en) * 2011-09-21 2012-04-25 太仓市同维电子有限公司 Security protection system and method based on wireless router
CN103078827A (en) * 2011-10-25 2013-05-01 腾讯数码(天津)有限公司 Open platform system called by third-party applications and implementation method for open platform system
US20140173039A1 (en) * 2012-12-13 2014-06-19 Level 3 Communications, Llc Framework Supporting Content Delivery With Reducer Services Network

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
凉白开: "nginx修改upstream不重启的方法(ngx_http_dyups_module模块)", 《HTTP://WWW.TTLSA.COM/NGINX/NGINX-MODULES-NGX_HTTP_DYUPS_MODULE /》 *
罗嵘等: "一种构件级动态集群管理系统的设计与实现", 《计算机应用研究》 *

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106844201A (en) * 2016-12-30 2017-06-13 北京五八信息技术有限公司 Test environment dispositions method and system
CN106959870A (en) * 2017-02-20 2017-07-18 北京数字联盟网络科技有限公司 Nginx dynamic module loading method and device
CN106959870B (en) * 2017-02-20 2020-09-29 北京数字联盟网络科技有限公司 Nginx dynamic module loading method and device
CN106961469A (en) * 2017-02-28 2017-07-18 北京致远互联软件股份有限公司 Unaware orientation Proxy Method and system based on http proxy servers
CN108418764A (en) * 2018-02-07 2018-08-17 深圳壹账通智能科技有限公司 Current-limiting method, device, computer equipment and storage medium
CN110580173A (en) * 2019-09-16 2019-12-17 山东浪潮通软信息科技有限公司 configuration-based dynamic route registration method and system
CN119537345A (en) * 2024-11-07 2025-02-28 北京原点数安科技有限公司 Database proxy method, device and electronic equipment

Similar Documents

Publication Publication Date Title
CN104320344A (en) Dynamic application cluster implement method based on Nginx
US9548897B2 (en) Network entity registry for network entity handles included in network traffic policies enforced for a provider network
US9094364B2 (en) Methods to manage services over a service gateway
CN102821000B (en) Improve the method for usability of PaaS platform
US10826812B2 (en) Multiple quorum witness
CN104899106B (en) Treating method and apparatus when interface service is abnormal
WO2018006676A1 (en) Acceleration resource processing method and apparatus and network function virtualization system
CN105794182B (en) Method and system for handling lock server failure in distributed system
CN106464674A (en) Managing NIC-encrypted flows for migrating guests or tasks
CN105893133A (en) Application service seamless migration method and system based on container technology
CN107391033B (en) Data migration method and device, computing equipment and computer storage medium
CN110968356B (en) Method and device for acquiring configuration information
US9716768B2 (en) Cache system and method for providing caching service
CN103986789A (en) Method for realizing dual redundant of NFS (network file system) nodes in HADOOP HA (home address) cluster based on NFS
WO2015109950A1 (en) Service resource group implementation method and apparatus
CN106375425A (en) Distributed cache processing method and device
WO2019001021A1 (en) Data processing method, apparatus and system, server, and computer storage medium
CN112307013A (en) Method, apparatus and computer program product for managing application systems
US20150312322A1 (en) Distributed high availability processing methods for service sessions
CN106230992A (en) A kind of load-balancing method and load balancing node
US10924452B1 (en) Auditing IP address assignments
WO2024021471A1 (en) Service updating method, apparatus and system, and storage medium
WO2015062390A1 (en) Virtual machine migration method, device and system
CN104580098B (en) A kind of service sharing method and device
WO2014110916A1 (en) New service processing method and service server

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
WD01 Invention patent application deemed withdrawn after publication
WD01 Invention patent application deemed withdrawn after publication

Application publication date: 20150128