CN111031129B - Access request processing method, processing device, electronic equipment and storage medium - Google Patents

Access request processing method, processing device, electronic equipment and storage medium Download PDF

Info

Publication number
CN111031129B
CN111031129B CN201911275734.XA CN201911275734A CN111031129B CN 111031129 B CN111031129 B CN 111031129B CN 201911275734 A CN201911275734 A CN 201911275734A CN 111031129 B CN111031129 B CN 111031129B
Authority
CN
China
Prior art keywords
access request
mongodb server
local area
mongodb
network
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
CN201911275734.XA
Other languages
Chinese (zh)
Other versions
CN111031129A (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.)
Beijing Kingsoft Cloud Network Technology Co Ltd
Original Assignee
Beijing Kingsoft Cloud Network Technology 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 Beijing Kingsoft Cloud Network Technology Co Ltd filed Critical Beijing Kingsoft Cloud Network Technology Co Ltd
Priority to CN201911275734.XA priority Critical patent/CN111031129B/en
Publication of CN111031129A publication Critical patent/CN111031129A/en
Application granted granted Critical
Publication of CN111031129B publication Critical patent/CN111031129B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1001Protocols in which an application is distributed across nodes in the network for accessing one among a plurality of replicated servers
    • H04L67/1004Server selection for load balancing
    • H04L67/1023Server selection for load balancing based on a hash applied to IP addresses or costs
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/50Address allocation
    • H04L61/5007Internet protocol [IP] addresses
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/50Address allocation
    • H04L61/5038Address allocation for local use, e.g. in LAN or USB networks, or in a controller area network [CAN]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/60Scheduling or organising the servicing of application requests, e.g. requests for application data transmissions using the analysis and optimisation of the required network resources
    • H04L67/63Routing a service request depending on the request content or context
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L2101/00Indexing scheme associated with group H04L61/00
    • H04L2101/60Types of network addresses
    • H04L2101/618Details of network addresses
    • H04L2101/663Transport layer addresses, e.g. aspects of transmission control protocol [TCP] or user datagram protocol [UDP] ports

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The embodiment of the invention provides an access request processing method, a processing device, electronic equipment and a storage medium, wherein the method comprises the following steps: receiving a current access request; determining the network type of the object initiating the current access request according to the corresponding relation between the preset access object identification and the network type of the object initiating the access request; and returning response content to different target nodes according to the determined network type of the current access request. The embodiment of the invention can enable the MongoDB server cluster to have the capability of communicating with the external network, thereby improving the convenience degree of the MongoDB server cluster communicating with the external network.

Description

Access request processing method, processing device, electronic equipment and storage medium
Technical Field
The present invention relates to the field of computer technologies, and in particular, to an access request processing method, a processing apparatus, an electronic device, and a storage medium.
Background
The MongoDB is a database based on distributed file storage, a server running the MongoDB can be called a MongoDB server, a plurality of MongoDB servers can form a MongoDB server cluster, and each MongoDB server in the server cluster shares a local area network, so that the MongoDB servers in the local area network can communicate with each other.
In the prior art, when a MongoDB server cluster is built, if only the communication in a local area network is considered in the early stage, the MongoDB server cluster can receive an access request, but in the response content returned by the MongoDB server cluster, a routing address is set for the local area network, so that an external network device cannot be connected to the MongoDB server in the MongoDB server cluster.
Therefore, a need exists for a MongoDB server that can communicate with an external network.
Disclosure of Invention
Embodiments of the present invention provide an access request processing method, an access request processing apparatus, an electronic device, and a storage medium, so as to implement that a MongoDB server cluster has a capability of communicating with an external network. The specific technical scheme is as follows:
in a first aspect, an embodiment of the present invention provides an access request processing method, including:
receiving a current access request, wherein the current access request carries an access object identifier, and the access object identifier is an IP address or a port number of a target MongoDB server;
determining the network type of the object initiating the current access request according to the corresponding relation between the preset access object identification and the network type of the object initiating the access request, wherein the network type comprises: the initiating object of the access request is positioned in the MongoDB server cluster local area network, or the initiating object of the access request is positioned outside the MongoDB server cluster local area network;
returning response content to a different target node according to the determined network type of the current access request, wherein the target node comprises: a MongoDB server in a MongoDB server cluster, or a transit routing device.
Optionally, before receiving the current access request, the method further includes:
and establishing a corresponding relation between the access object identification and the access request initiating object network type.
Optionally, the step of establishing a correspondence between the access object identifier and the access request initiating object network type includes:
establishing corresponding relations between different IP addresses and access request initiating object network types;
or establishing the corresponding relation between different port numbers and the network types of the access request initiating objects.
Optionally, the step of establishing a correspondence between different IP addresses and access request initiating object network types includes:
and aiming at each MongoDB server in the MongoDB server cluster, allocating a plurality of IP addresses for the MongoDB server, wherein different IP addresses are used for accessing the MongoDB server by access request initiating objects of different network types.
Optionally, the step of allocating a plurality of IP addresses to the MongoDB server includes:
and allocating a first IP address, a second IP address and a third IP address to the MongoDB server, wherein the first IP address is used for equipment in a first local area network to access the MongoDB server, the second IP address is used for equipment in a second local area network to access the MongoDB server, the third IP address is used for external network equipment to access the MongoDB server, the first local area network is a local area network where the MongoDB server cluster is located, and the second local area network is other local area networks in a previous-level network of the first local area network.
Optionally, the step of establishing a correspondence between different port numbers and access request initiating object network types includes:
and aiming at each MongoDB server in the MongoDB server cluster, allocating a plurality of port numbers for the MongoDB server, wherein different port numbers are used for accessing the MongoDB server by access request initiating objects of different network types.
Optionally, the step of allocating a plurality of port numbers to the MongoDB server includes:
and allocating a first port, a second port and a third port to the MongoDB server, wherein the first port is used for equipment in a first local area network to access the MongoDB server, the second port is used for equipment in a second local area network to access the MongoDB server, the third port is used for external network equipment to access the MongoDB server, the first local area network is a local area network where the MongoDB server cluster is located, and the second local area network is other local area networks in a previous-level network of the first local area network.
Optionally, the step of returning response content to a different target node according to the determined network type of the current access request includes:
when the initiating object of the current access request is positioned in a MongoDB server cluster local area network, determining that the initiating object is a MongoDB server in the MongoDB server cluster;
returning the response content to a MongoDB server in the MongoDB server cluster;
when the initiating object of the current access request is positioned outside the MongoDB server cluster local area network, determining a target IP address and a target port number of a routing device for forwarding the current access request;
returning the response content to a routing device corresponding to the destination IP address and the destination port number, the routing device including: a router or a bridge.
In a second aspect, an embodiment of the present invention provides an access request processing apparatus, including:
the receiving module is used for receiving a current access request, wherein the current access request carries an access object identifier, and the access object identifier is an IP address or a port number of a target MongoDB server;
a determining module, configured to determine, according to a correspondence between a preset access object identifier and a network type of an access request initiating object, a network type of an initiating object of the current access request, where the network type includes: the initiating object of the access request is positioned in the MongoDB server cluster local area network, or the initiating object of the access request is positioned outside the MongoDB server cluster local area network;
a returning module, configured to return response content to different target nodes according to the determined network type of the current access request, where the target nodes include: a MongoDB server in a MongoDB server cluster, or a transit routing device.
Optionally, the apparatus further comprises:
and the establishing module is used for establishing the corresponding relation between the access object identification and the access request initiating object network type.
Optionally, the establishing module is specifically configured to:
establishing corresponding relations between different IP addresses and access request initiating object network types;
or establishing the corresponding relation between different port numbers and the network types of the access request initiating objects.
Optionally, the establishing module is specifically configured to:
and aiming at each MongoDB server in the MongoDB server cluster, allocating a plurality of IP addresses for the MongoDB server, wherein different IP addresses are used for accessing the MongoDB server by access request initiating objects of different network types.
Optionally, the establishing module is specifically configured to:
and allocating a first IP address, a second IP address and a third IP address to the MongoDB server, wherein the first IP address is used for equipment in a first local area network to access the MongoDB server, the second IP address is used for equipment in a second local area network to access the MongoDB server, the third IP address is used for external network equipment to access the MongoDB server, the first local area network is a local area network where the MongoDB server cluster is located, and the second local area network is other local area networks in a previous-level network of the first local area network.
Optionally, the establishing module is specifically configured to:
and aiming at each MongoDB server in the MongoDB server cluster, allocating a plurality of port numbers for the MongoDB server, wherein different port numbers are used for accessing the MongoDB server by access request initiating objects of different network types.
Optionally, the establishing module is specifically configured to:
and allocating a first port, a second port and a third port to the MongoDB server, wherein the first port is used for equipment in a first local area network to access the MongoDB server, the second port is used for equipment in a second local area network to access the MongoDB server, the third port is used for external network equipment to access the MongoDB server, the first local area network is a local area network where the MongoDB server cluster is located, and the second local area network is other local area networks in a previous-level network of the first local area network.
Optionally, the return module includes:
a first determining submodule, configured to determine that an initiating object of the current access request is a MongoDB server in a MongoDB server cluster when the initiating object is located in a MongoDB server cluster lan;
a first return submodule for returning the response content to a MongoDB server in the MongoDB server cluster;
a second determining submodule, configured to determine a target IP address and a target port number of a routing device that forwards the current access request, when an initiation object of the current access request is located outside the MongoDB server cluster lan;
a second returning submodule, configured to return the response content to a routing device corresponding to the destination IP address and the destination port number, where the routing device includes: a router or a bridge.
In a third aspect, an embodiment of the present invention provides an electronic device, which includes a processor and a machine-readable storage medium, where the machine-readable storage medium stores machine-executable instructions capable of being executed by the processor, and the processor executes the machine-executable instructions to implement the method steps of the access request processing method provided in the first aspect.
In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, where a computer program is stored in the computer-readable storage medium, and when the computer program is executed by a processor, the method steps of the access request processing method provided in the first aspect are implemented.
In a fifth aspect, an embodiment of the present invention further provides a computer program product containing instructions, which when run on a computer, causes the computer to execute the method steps of the access request processing method provided in the first aspect.
In a sixth aspect, an embodiment of the present invention further provides a computer program, which, when running on a computer, causes the computer to execute the method steps of the access request processing method provided in the first aspect.
In the access request processing method, processing apparatus, electronic device and storage medium provided by the embodiments of the present invention, after the controller receives the current access request, can determine the network type of the object for initiating the current access request according to the corresponding relationship between the preset access object identification and the network type of the object for initiating the access request, i.e. determining whether the originating object of the access request is located within the MongoDB server cluster LAN or outside the MongoDB server cluster LAN, so as to return the response content to different target nodes according to the determined network type of the current access request, compared with the prior art, the MongoDB server cluster can have the capability of communicating with the outer network, so that the convenience degree of the communication between the MongoDB server cluster and the outer network is improved. Of course, it is not necessary for any product or method of practicing the invention to achieve all of the above-described advantages at the same time.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a schematic flowchart of an access request processing method according to an embodiment of the present invention;
fig. 2 is another schematic flow chart of an access request processing method according to an embodiment of the present invention;
fig. 3 is a schematic flowchart of step S103 in the access request processing method according to the embodiment of the present invention;
fig. 4 is a schematic structural diagram of an access request processing apparatus according to an embodiment of the present invention;
fig. 5 is a schematic structural diagram of an access request processing apparatus according to an embodiment of the present invention;
fig. 6 is a schematic structural diagram of a return module in an access request processing apparatus according to an embodiment of the present invention;
fig. 7 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
In the prior art, some services use objects, such as various Web (World Wide Web) programs that rely on the storage of the MongoDB server, some of these Web programs are not in the local area network where the MongoDB server is located, but in other local area networks, such as the subnet of a company, and some are not in the subnet of a company, and it is necessary to set up the function of accessing other local area networks and even the function of accessing the outer network for the MongoDB server, but the Web program still cannot successfully access the MongoDB server, because the Web program connects the controller of the MongoDB server cluster through a driver or a shell command and establishes a long connection, the controller sends an IsMasterCMD RPC (Remote Procedure Call) request to the inside of the MongoDB server cluster, and the MongoDB server cluster returns corresponding response content for the PRC request, for example, an IP (Internet Protocol, internet protocol) address and port number, but the IP address and port number are internal to the MongoDB server cluster, so the Web program cannot connect to the MongoDB server that wants to access through the IP address and port number.
Referring to this, as shown in fig. 1, an embodiment of the present invention provides an access request processing method, which may include the following steps:
s101, receiving a current access request.
The current access request in the embodiment of the present invention may be a request sent by a Web program to access a MongoDB server in a MongoDB server cluster, for example, the request is used to read data from the MongoDB server or write data into the MongoDB server, the access request may be transferred to a local area network where the MongoDB server cluster is located through a routing device such as a router, and specifically, the access request may be received by a controller of the MongoDB server cluster and a dematercmd remote call request may be sent to the MongoDB server to be accessed. Of course, the current access request can also be sent by one MongoDB server in the MongoDB server cluster to another MongoDB server. The controller may be a module in a montodb server cluster for handling access requests.
The current access request may carry an access object identifier, and it can be understood that different MongoDB servers may have different IP addresses and port numbers, and therefore, the access object identifier may specifically be an IP address or port number of a target MongoDB server, and the target MongoDB server is the MongoDB server to be accessed.
Multiple MongoDB servers in a MongoDB server cluster can store multiple copies of data, called a MongoDB copy set, where there are multiple MongoDB services at the same time, each with one complete copy backup.
S102, according to the corresponding relation between the preset access object identification and the access request initiating object network type, determining the network type of the initiating object of the current access request.
The embodiment of the invention can pre-establish the corresponding relation between the access object identification and the access request initiating object network type, that is, different access object identifications correspond to different access request initiating object network types, and the network types comprise: the initiating object of the access request is positioned in the MongoDB server cluster local area network, or the initiating object of the access request is positioned outside the MongoDB server cluster local area network.
For example, when the initiation object of the access request is located in the MongoDB server cluster lan, the access request of the initiation object of the access request may carry a first identifier, and the controller may determine that the initiation object of the access request is located in the MongoDB server cluster lan through the first identifier.
For example, when the initiation object of the access request is located outside the MongoDB server cluster lan, the access request of the initiation object of the access request may carry a second identifier, and the controller may determine that the initiation object of the access request is located outside the MongoDB server cluster lan through the second identifier. Of course, the above examples are provided to facilitate a better understanding of the embodiments of the present invention, and are not intended to limit the embodiments of the present invention.
S103, according to the determined network type of the current access request, returning the response content to different target nodes.
After the controller determines the network type of the current access request, it can determine whether the access request initiating object is inside or outside the local area network, so that the response content can be returned to different target nodes, where the target node may be a mongoDB server in a mongoDB server cluster, or may be a transit routing device, and the transit routing device is a routing device for transferring the external network access request to the local area network.
As an optional implementation manner of the embodiment of the present invention, on the basis of the flow shown in fig. 1, as shown in fig. 2, the access request processing method according to the embodiment of the present invention may further include:
s201, establishing a corresponding relation between the access object identification and the access request initiating object network type.
The embodiment of the present invention may pre-establish the corresponding relationship between the access object identifier and the access request initiating object network type, that is, different access object identifiers correspond to different access request initiating object network types, and the specific establishing process thereof will be shown in the following embodiments.
As an optional implementation manner of the embodiment of the present invention, a corresponding relationship between different IP addresses and network types of an access request initiation object may be established, or a corresponding relationship between different port numbers and network types of an access request initiation object may be established, so that after receiving a current access request, a controller may determine a network type of the access request initiation object by using an IP address or a port number accessed by the access request initiation object, thereby returning response content to different target nodes.
As an optional implementation manner in this embodiment of the present invention, the specific process of establishing the correspondence between different IP addresses and access request initiation object network types may be:
for each MongoDB server in the MongoDB server cluster, a plurality of IP addresses are distributed to the MongoDB server, and different IP addresses in the plurality of IP addresses can be used for access requests of different network types to access the MongoDB server.
In the embodiment of the present invention, a plurality of IP addresses can be allocated to each MongoDB server in a MongoDB server cluster, for example, one of the MongoDB servers (hereinafter referred to as the current MongoDB server) is taken as an example, two IP addresses, which are respectively denoted as IP address a and IP address B and are preset, can be allocated to the current MongoDB server, where the IP address a is used for serving a local area network and the IP address B is used for serving an external network, so that when an access request initiating object accesses the IP address a, the controller can determine that the access request initiating object is located inside the local area network, and when the access request initiating object accesses the IP address B, the controller can determine that the access request initiating object is located outside the local area network, thereby accurately distinguishing the source of the access request initiating object. It can be seen that the different IP addresses can be used for access requests originating from different network types to the MongoDB server.
The upper level network of the local area network in which the MongoDB server cluster is located may be a larger local area network, in other words, the larger local area network may include other local area networks in addition to the local area network in which the MongoDB server cluster is located, for example, a large local area network composed of companies includes a plurality of local area networks, one of which is the local area network in which the MongoDB server cluster is located, so that, in order to distinguish a network inside a company from a network outside the company, in allocating a plurality of IP addresses to the MongoDB server, it is necessary to consider not only whether the access request initiation object is located in the local area network in which the MongoDB server cluster is located, but also whether the access request initiation object is located in another sub-network or an external network.
Therefore, as an alternative implementation manner of the embodiment of the present invention, three IP addresses, which are respectively represented as a first IP address, a second IP address and a third IP address, may be allocated to the MongoDB server, where the first IP address is used for the devices in the first local area network to access the MongoDB server, the second IP address is used for the devices in the second local area network to access the MongoDB server, and the third IP address is used for the devices in the external network to access the MongoDB server, where the first local area network is a local area network where the MongoDB server cluster is located, and the second local area network is another local area network in the previous level network of the first local area network, that is, a local area network in the company internal network except the local area network where the MongoDB server cluster is located.
For example, the first IP address may be a primary IP address, and the primary IP address and the port number of the MongoDB server are expressed as: the MongoDB servers use the main IP address for internal communication, so the MongoDB servers have low communication cost and less routing times.
The second IP address may be an auxiliary IP address, and the IP address and Port number of the MongoDB server are denoted as auxiliary IP1+ Port for providing services to the second lan, however, when a routing device or bridge is required, the IP address and Port number of the routing device or bridge may be denoted as IP1 '+ Port 1' to support devices in the second lan to be able to access the auxiliary IP1+ Port of the MongoDB server through the routing device.
The third IP address can be another auxiliary IP address, and the IP address and Port number of the MongoDB server are denoted as auxiliary IP2+ Port for providing services to the extranet (i.e. network outside the company) devices, however, when a firewall or gateway is needed, the IP address and Port number of the firewall or gateway can be denoted as IP2 '+ Port 2' to support the extranet devices to access the auxiliary IP2+ Port of the MongoDB server through the firewall or gateway.
As another optional implementation manner of the embodiment of the present invention, a specific process of establishing a correspondence between different IP addresses and network types of an access request initiating object may be:
for each MongoDB server in the MongoDB server cluster, a plurality of port numbers are distributed to the MongoDB server, and different port numbers in the plurality of port numbers can be used for access requests of different network types to access the MongoDB server.
In the embodiment of the present invention, a plurality of port numbers can be allocated to each MongoDB server in a MongoDB server cluster, and exemplarily, one of the MongoDB servers (hereinafter referred to as a current MongoDB server) is taken as an example, two port numbers, which are respectively represented as a port number a and a port number B, can be allocated to the current MongoDB server, and are preset, where the port number a is used for serving a local area network, and the port number B is used for serving an external network, so that when an access request initiating object accesses the port number a, a controller can determine that the access request initiating object is located inside the local area network, and when the access request initiating object accesses the port number B, the controller can determine that the access request initiating object is located outside the local area network, thereby accurately distinguishing a source of the access request initiating object. It can be seen that the different port numbers can be used for the access request initiating objects with different network types to access the MongoDB server.
The upper level network of the local area network where the MongoDB server cluster is located may be a larger local area network, in other words, the larger local area network may include other local area networks besides the local area network where the MongoDB server cluster is located, for example, a large local area network composed of companies includes a plurality of local area networks, one of which is the local area network where the MongoDB server cluster is located, so that, in order to distinguish the network inside the company from the network outside the company, in the process of allocating a plurality of port numbers to the MongoDB server, it is necessary to consider not only whether the access request initiation object is located in the local area network where the MongoDB server cluster is located, but also whether the access request initiation object is located in other sub-networks or an external network.
Therefore, as an alternative implementation manner of the embodiment of the present invention, three port numbers, which are respectively represented as a first port number, a second port number, and a third port number, may be allocated to the MongoDB server, where the first port number is used for a device in the first local area network to access the MongoDB server, the second port number is used for a device in the second local area network to access the MongoDB server, and the third port number is used for an external network device to access the MongoDB server, where the first local area network is a local area network where the MongoDB server cluster is located, and the second local area network is another local area network in the previous level network of the first local area network, that is, a local area network in the company internal network except the local area network where the MongoDB server cluster is located.
For example, the first port number may be a master port number, and the master port number and the IP address of the MongoDB server are expressed as: IP + main Port, the internal communication between MongoDB servers uses the IP address bound by the main Port, which has the advantages of low communication cost and less routing times between the MongoDB servers.
The second Port number may be an auxiliary Port number, and the IP address and Port number of the mongoDB server are denoted as IP + auxiliary Port1 for providing services to the second LAN, however, the IP address and Port number bound by the routing device or bridge, which may be denoted as IP1 '+ Port 1', is needed at this time to support the IP + auxiliary Port1 of the mongoDB server that the device in the second LAN can access through the routing device.
The third Port number can be another auxiliary Port number, and the IP address and Port number of the mongoDB server are denoted as IP + auxiliary Port2 for providing services to extranet (i.e. network outside the company) devices, however, when a firewall or gateway is needed, the IP address and Port number of the firewall or gateway can be denoted as IP2 '+ Port 2' to support the extranet devices to access the IP + auxiliary Port2 of the MongoDB server through the firewall or gateway.
As an optional implementation manner of the embodiment of the present invention, as shown in fig. 3, the step S103 may include:
and S1031, when the initiating object of the current access request is positioned in the MongoDB server cluster local area network, determining that the initiating object is the MongoDB server in the MongoDB server cluster.
S1032 returns the response content to the MongoDB server in the MongoDB server cluster.
It is understood that when the initiating object of the current access request is located within the MongoDB server cluster lan, then the controller may determine that the initiating object is a MongoDB server in the MongoDB server cluster, then may determine that the initiating object is a MongoDB server in the MongoDB server cluster.
S1031', when the initiating object of the current access request is located outside the MongoDB server cluster local area network, determining the target IP address and the target port number of the routing device for forwarding the current access request.
S1032', return the response content to the routing device corresponding to the destination IP address and the destination port number.
It can be understood that, when the initiation object of the current access request is located outside the MongoDB server cluster lan, the controller may determine the target IP address and the target port number of the routing device forwarding the current access request, and then return the response content to the routing device forwarding the response content corresponding to the target IP address and the target port number, so that the routing device forwards the response content to the initiation object of the access request. The routing device may be: a router or a bridge.
In the access request processing method provided by the embodiment of the invention, after receiving the current access request, the controller can determine the network type of the initiating object of the current access request according to the corresponding relationship between the preset access object identifier and the network type of the initiating object of the access request, namely, the initiating object of the access request is determined to be positioned in the MongoDB server cluster local area network or the initiating object of the access request is determined to be positioned outside the MongoDB server cluster local area network, so that the response content is returned to different target nodes according to the determined network type of the current access request, namely, the response content is sent to the MongoDB server in the MongoDB server cluster or a transit routing device.
Corresponding to the above method embodiment, the embodiment of the present invention also provides a corresponding device embodiment.
As shown in fig. 4, an embodiment of the present invention provides an access request processing apparatus, including:
the receiving module 401 is configured to receive a current access request, where the current access request carries an access object identifier, and the access object identifier is an IP address or a port number of a target MongoDB server.
A determining module 402, configured to determine a network type of an object initiating a current access request according to a correspondence between a preset access object identifier and a network type of an object initiating the access request, where the network type includes: the initiating object of the access request is positioned in the MongoDB server cluster local area network, or the initiating object of the access request is positioned outside the MongoDB server cluster local area network.
A returning module 403, configured to return response content to a different target node according to the determined network type of the current access request, where the node includes: a MongoDB server in a MongoDB server cluster, or a transit routing device.
On the basis of the apparatus structure shown in fig. 4, as shown in fig. 5, the access request processing apparatus according to the embodiment of the present invention may further include:
the establishing module 501 is configured to establish a corresponding relationship between an access object identifier and an access request initiating object network type.
Wherein, the establishing module is specifically configured to:
establishing corresponding relations between different IP addresses and access request initiating object network types;
or establishing the corresponding relation between different port numbers and the network types of the access request initiating objects.
Wherein, the establishing module is specifically configured to:
and aiming at each MongoDB server in the MongoDB server cluster, distributing a plurality of IP addresses for the MongoDB server, wherein different IP addresses are used for access request initiating objects of different network types to access the MongoDB server.
Wherein, the establishing module is specifically configured to:
and allocating a first IP address, a second IP address and a third IP address for the MongoDB server, wherein the first IP address is used for equipment in the first local area network to access the MongoDB server, the second IP address is used for equipment in the second local area network to access the MongoDB server, the third IP address is used for external network equipment to access the MongoDB server, the first local area network is a local area network where the MongoDB server cluster is located, and the second local area network is other local area networks in the upper-level network of the first local area network.
Wherein, the establishing module is specifically configured to:
and aiming at each MongoDB server in the MongoDB server cluster, distributing a plurality of port numbers for the MongoDB server, wherein different port numbers are used for access requests of different network types to access the MongoDB server.
Wherein, the establishing module is specifically configured to:
and distributing a first port, a second port and a third port for the MongoDB server, wherein the first port is used for equipment in the first local area network to access the MongoDB server, the second port is used for equipment in the second local area network to access the MongoDB server, the third port is used for external network equipment to access the MongoDB server, the first local area network is a local area network where the MongoDB server cluster is located, and the second local area network is other local area networks in the upper-level network of the first local area network.
As shown in fig. 6, the returning module 403 includes:
a first determining submodule 4031, configured to determine, when an initiating object of the current access request is located in the MongoDB server cluster local area network, that the initiating object is a MongoDB server in the MongoDB server cluster.
A first return sub-module 4032 for returning the response content to the MongoDB servers in the MongoDB server cluster.
A second determining submodule 4033, configured to determine, when an originating object of the current access request is located outside the MongoDB server cluster lan, a target IP address and a target port number of the routing device that forwards the current access request.
A second returning sub-module 4034, configured to return the response content to the routing device corresponding to the destination IP address and the destination port number, where the routing device includes: a router or a bridge.
In the access request processing apparatus provided in the embodiment of the present invention, after receiving the current access request, the controller may determine, according to a correspondence between a preset access object identifier and a network type of an access request initiation object, a network type of an initiation object of the current access request, that is, determine whether the initiation object of the access request is located within the MongoDB server cluster lan or outside the MongoDB server cluster lan, so as to return response contents to different target nodes, that is, send the response contents to the MongoDB server in the MongoDB server cluster or a transit routing device, according to the determined network type of the current access request.
An embodiment of the present invention further provides an electronic device, which may be specifically a server, as shown in fig. 7, where the device 700 includes a processor 701 and a machine-readable storage medium 702, where the machine-readable storage medium stores machine-executable instructions that can be executed by the processor, and the processor executes the machine-executable instructions to implement the following steps:
receiving a current access request, wherein the current access request carries an access object identifier which is an IP address or a port number of a target MongoDB server;
determining the network type of the object initiating the current access request according to the corresponding relation between the preset access object identification and the network type of the object initiating the access request, wherein the network type comprises: the initiating object of the access request is positioned in the MongoDB server cluster local area network, or the initiating object of the access request is positioned outside the MongoDB server cluster local area network;
according to the determined network type of the current access request, returning response content to different target nodes, wherein the nodes comprise: a MongoDB server in a MongoDB server cluster, or a transit routing device.
The machine-readable storage medium may include a Random Access Memory (RAM) or a non-volatile Memory (non-volatile Memory), such as at least one disk Memory. Optionally, the memory may also be at least one memory device located remotely from the processor.
The Processor may be a general-purpose Processor, and includes a Central Processing Unit (CPU), a Network Processor (NP), and the like; the Integrated Circuit may also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, a discrete Gate or transistor logic device, or a discrete hardware component.
In the electronic device provided in the embodiment of the present invention, after receiving the current access request, the controller may determine the network type of the initiator of the current access request according to a correspondence between a preset access object identifier and the network type of the initiator of the access request, that is, determine whether the initiator of the access request is located inside the MongoDB server cluster lan or outside the MongoDB server cluster lan, so as to return the response content to different target nodes according to the determined network type of the current access request, that is, send the response content to the MongoDB server in the MongoDB server cluster or transfer the routing device.
An embodiment of the present invention further provides a computer-readable storage medium, in which a computer program is stored, and when the computer program is executed by a processor, the computer program is configured to perform the following steps:
receiving a current access request, wherein the current access request carries an access object identifier which is an IP address or a port number of a target MongoDB server;
determining the network type of the object initiating the current access request according to the corresponding relation between the preset access object identification and the network type of the object initiating the access request, wherein the network type comprises: the initiating object of the access request is positioned in the MongoDB server cluster local area network, or the initiating object of the access request is positioned outside the MongoDB server cluster local area network;
according to the determined network type of the current access request, returning response content to different target nodes, wherein the nodes comprise: a MongoDB server in a MongoDB server cluster, or a transit routing device.
In the computer-readable storage medium provided in the embodiment of the present invention, after receiving the current access request, the controller can determine the network type of the initiator of the current access request according to the correspondence between the preset identifier of the access object and the network type of the initiator of the access request, that is, determine whether the initiator of the access request is located inside the MongoDB server cluster lan or outside the MongoDB server cluster lan, so as to return the response content to different target nodes, that is, send the response content to the MongoDB server in the MongoDB server cluster or a transit routing device, according to the determined network type of the current access request.
Embodiments of the present invention also provide a computer program product comprising instructions which, when run on a computer, cause the computer to perform the steps of:
receiving a current access request, wherein the current access request carries an access object identifier which is an IP address or a port number of a target MongoDB server;
determining the network type of the object initiating the current access request according to the corresponding relation between the preset access object identification and the network type of the object initiating the access request, wherein the network type comprises: the initiating object of the access request is positioned in the MongoDB server cluster local area network, or the initiating object of the access request is positioned outside the MongoDB server cluster local area network;
according to the determined network type of the current access request, returning response content to different target nodes, wherein the nodes comprise: a MongoDB server in a MongoDB server cluster, or a transit routing device.
In the computer program product including instructions provided by an embodiment of the present invention, after the controller receives the current access request, can determine the network type of the object for initiating the current access request according to the corresponding relationship between the preset access object identification and the network type of the object for initiating the access request, i.e. determining whether the originating object of the access request is located within the MongoDB server cluster LAN or outside the MongoDB server cluster LAN, so as to return the response content to different target nodes according to the determined network type of the current access request, compared with the prior art, the MongoDB server cluster can have the capability of communicating with the outer network, so that the convenience degree of the communication between the MongoDB server cluster and the outer network is improved.
Embodiments of the present invention further provide a computer program, which when running on a computer, causes the computer to execute the following steps:
receiving a current access request, wherein the current access request carries an access object identifier which is an IP address or a port number of a target MongoDB server;
determining the network type of the object initiating the current access request according to the corresponding relation between the preset access object identification and the network type of the object initiating the access request, wherein the network type comprises: the initiating object of the access request is positioned in the MongoDB server cluster local area network, or the initiating object of the access request is positioned outside the MongoDB server cluster local area network;
according to the determined network type of the current access request, returning response content to different target nodes, wherein the nodes comprise: a MongoDB server in a MongoDB server cluster, or a transit routing device.
In the computer program including instructions provided in the embodiments of the present invention, after receiving the current access request, the controller can determine the network type of the initiator of the current access request according to the correspondence between the preset identifier of the access object and the network type of the initiator of the access request, that is, determine whether the initiator of the access request is located inside the MongoDB server cluster lan or outside the MongoDB server cluster lan, so as to return the response content to different target nodes according to the determined network type of the current access request, that is, send the response content to the MongoDB server in the MongoDB server cluster or transfer routing equipment.
For the apparatus/electronic device/storage medium embodiment, since it is substantially similar to the method embodiment, the description is relatively simple, and for the relevant points, reference may be made to part of the description of the method embodiment.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
All the embodiments in the present specification are described in a related manner, and the same and similar parts among the embodiments may be referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the system embodiment, since it is substantially similar to the method embodiment, the description is simple, and for the relevant points, reference may be made to the partial description of the method embodiment.
The above description is only for the preferred embodiment of the present invention, and is not intended to limit the scope of the present invention. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention shall fall within the protection scope of the present invention.

Claims (16)

1. An access request processing method, the method comprising:
receiving a current access request, wherein the current access request carries an access object identifier, and the access object identifier is an IP address or a port number of a target MongoDB server;
determining the network type of the object initiating the current access request according to the corresponding relation between the preset access object identification and the network type of the object initiating the access request, wherein the network type comprises: the initiating object of the access request is positioned in the MongoDB server cluster local area network, or the initiating object of the access request is positioned outside the MongoDB server cluster local area network;
returning response content to a different target node according to the determined network type of the current access request, wherein the target node comprises: a MongoDB server in the MongoDB server cluster or a transit routing device;
the step of returning the response content to a different target node according to the determined network type of the current access request includes:
when the initiating object of the current access request is positioned in a MongoDB server cluster local area network, determining that the initiating object is a MongoDB server in the MongoDB server cluster;
returning the response content to a MongoDB server in the MongoDB server cluster;
when the initiating object of the current access request is positioned outside the MongoDB server cluster local area network, determining a target IP address and a target port number of a routing device for forwarding the current access request;
returning the response content to a routing device corresponding to the destination IP address and the destination port number, the routing device including: a router or a bridge.
2. The method of claim 1, wherein prior to receiving the current access request, the method further comprises:
and establishing a corresponding relation between the access object identification and the access request initiating object network type.
3. The method of claim 2, wherein the step of establishing a correspondence between the access object identifier and the access request initiating object network type comprises:
establishing corresponding relations between different IP addresses and access request initiating object network types;
or establishing the corresponding relation between different port numbers and the network types of the access request initiating objects.
4. The method of claim 3, wherein the step of establishing correspondence between different IP addresses and access request initiating object network types comprises:
and aiming at each MongoDB server in the MongoDB server cluster, allocating a plurality of IP addresses for the MongoDB server, wherein different IP addresses are used for accessing the MongoDB server by access request initiating objects of different network types.
5. The method of claim 4, wherein the step of assigning a plurality of IP addresses to the MongoDB server comprises:
and allocating a first IP address, a second IP address and a third IP address to the MongoDB server, wherein the first IP address is used for equipment in a first local area network to access the MongoDB server, the second IP address is used for equipment in a second local area network to access the MongoDB server, the third IP address is used for external network equipment to access the MongoDB server, the first local area network is a local area network where the MongoDB server cluster is located, and the second local area network is other local area networks in a previous-level network of the first local area network.
6. The method according to claim 3, wherein the step of establishing correspondence between different port numbers and the network types of the access request initiator comprises:
and aiming at each MongoDB server in the MongoDB server cluster, allocating a plurality of port numbers for the MongoDB server, wherein different port numbers are used for accessing the MongoDB server by access request initiating objects of different network types.
7. The method of claim 6, wherein the step of assigning a plurality of port numbers to the MongoDB server comprises:
and allocating a first port, a second port and a third port to the MongoDB server, wherein the first port is used for equipment in a first local area network to access the MongoDB server, the second port is used for equipment in a second local area network to access the MongoDB server, the third port is used for external network equipment to access the MongoDB server, the first local area network is a local area network where the MongoDB server cluster is located, and the second local area network is other local area networks in a previous-level network of the first local area network.
8. An access request processing apparatus, characterized in that the apparatus comprises:
the receiving module is used for receiving a current access request, wherein the current access request carries an access object identifier, and the access object identifier is an IP address or a port number of a target MongoDB server;
a determining module, configured to determine, according to a correspondence between a preset access object identifier and a network type of an access request initiating object, a network type of an initiating object of the current access request, where the network type includes: the initiating object of the access request is positioned in the MongoDB server cluster local area network, or the initiating object of the access request is positioned outside the MongoDB server cluster local area network;
a returning module, configured to return response content to different target nodes according to the determined network type of the current access request, where the target nodes include: a MongoDB server in the MongoDB server cluster or a transit routing device;
the return module includes:
a first determining submodule, configured to determine that an initiating object of the current access request is a MongoDB server in a MongoDB server cluster when the initiating object is located in a MongoDB server cluster lan;
a first return submodule for returning the response content to a MongoDB server in the MongoDB server cluster;
a second determining submodule, configured to determine a target IP address and a target port number of a routing device that forwards the current access request, when an initiation object of the current access request is located outside the MongoDB server cluster lan;
a second returning submodule, configured to return the response content to a routing device corresponding to the destination IP address and the destination port number, where the routing device includes: a router or a bridge.
9. The apparatus of claim 8, further comprising:
and the establishing module is used for establishing the corresponding relation between the access object identification and the access request initiating object network type.
10. The apparatus of claim 9, wherein the establishing module is specifically configured to:
establishing corresponding relations between different IP addresses and access request initiating object network types;
or establishing the corresponding relation between different port numbers and the network types of the access request initiating objects.
11. The apparatus of claim 10, wherein the establishing module is specifically configured to:
and aiming at each MongoDB server in the MongoDB server cluster, allocating a plurality of IP addresses for the MongoDB server, wherein different IP addresses are used for accessing the MongoDB server by access request initiating objects of different network types.
12. The apparatus of claim 11, wherein the establishing module is specifically configured to:
and allocating a first IP address, a second IP address and a third IP address to the MongoDB server, wherein the first IP address is used for equipment in a first local area network to access the MongoDB server, the second IP address is used for equipment in a second local area network to access the MongoDB server, the third IP address is used for external network equipment to access the MongoDB server, the first local area network is a local area network where the MongoDB server cluster is located, and the second local area network is other local area networks in a previous-level network of the first local area network.
13. The apparatus of claim 10, wherein the establishing module is specifically configured to:
and aiming at each MongoDB server in the MongoDB server cluster, allocating a plurality of port numbers for the MongoDB server, wherein different port numbers are used for accessing the MongoDB server by access request initiating objects of different network types.
14. The apparatus of claim 13, wherein the establishing module is specifically configured to:
and allocating a first port, a second port and a third port to the MongoDB server, wherein the first port is used for equipment in a first local area network to access the MongoDB server, the second port is used for equipment in a second local area network to access the MongoDB server, the third port is used for external network equipment to access the MongoDB server, the first local area network is a local area network where the MongoDB server cluster is located, and the second local area network is other local area networks in a previous-level network of the first local area network.
15. An electronic device comprising a processor and a machine-readable storage medium storing machine-executable instructions executable by the processor to perform method steps of the access request processing method of any one of claims 1 to 7.
16. A computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, carries out the method steps of the access request processing method according to any one of claims 1 to 7.
CN201911275734.XA 2019-12-12 2019-12-12 Access request processing method, processing device, electronic equipment and storage medium Active CN111031129B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911275734.XA CN111031129B (en) 2019-12-12 2019-12-12 Access request processing method, processing device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911275734.XA CN111031129B (en) 2019-12-12 2019-12-12 Access request processing method, processing device, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN111031129A CN111031129A (en) 2020-04-17
CN111031129B true CN111031129B (en) 2022-04-05

Family

ID=70206429

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911275734.XA Active CN111031129B (en) 2019-12-12 2019-12-12 Access request processing method, processing device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN111031129B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112286851B (en) * 2020-11-06 2023-06-23 百度在线网络技术(北京)有限公司 Server main board, server, control method, electronic device and readable medium
CN114745228B (en) * 2022-04-11 2023-11-03 中国南方电网有限责任公司 Gateway request processing method, device, computer equipment and storage medium
US11914637B2 (en) * 2022-07-25 2024-02-27 Sap Se Image scaling cloud database

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108762917A (en) * 2018-05-04 2018-11-06 平安科技(深圳)有限公司 Access request processing method, device, system, computer equipment and storage medium
CN109587239A (en) * 2018-12-03 2019-04-05 群蜂信息技术(上海)有限公司 A kind of processing method of access request, server and storage medium

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10587592B2 (en) * 2017-05-04 2020-03-10 Servicenow, Inc. Efficient centralized credential storage for remotely managed networks

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108762917A (en) * 2018-05-04 2018-11-06 平安科技(深圳)有限公司 Access request processing method, device, system, computer equipment and storage medium
CN109587239A (en) * 2018-12-03 2019-04-05 群蜂信息技术(上海)有限公司 A kind of processing method of access request, server and storage medium

Also Published As

Publication number Publication date
CN111031129A (en) 2020-04-17

Similar Documents

Publication Publication Date Title
CN107690800B (en) Managing dynamic IP address allocation
CN111460460B (en) Task access method, device, proxy server and machine-readable storage medium
CN111031129B (en) Access request processing method, processing device, electronic equipment and storage medium
WO2016029821A1 (en) Method and device for creating virtual network instance
CN111212134A (en) Request message processing method and device, edge computing system and electronic equipment
US10574570B2 (en) Communication processing method and apparatus
CN114095430B (en) Access message processing method, system and working node
CN112333017B (en) Service configuration method, device, equipment and storage medium
US20110153826A1 (en) Fault tolerant and scalable load distribution of resources
KR20110063328A (en) Remote procedure call(rpc) bind service with physical interface query and selection
US10243920B1 (en) Internet protocol address reassignment between virtual machine instances
CN111614792B (en) Transparent transmission method, system, server, electronic device and storage medium
US8972604B1 (en) Network address retention and assignment
CN116248595B (en) Method, device, equipment and medium for communication between cloud intranet and physical network
CN116016448A (en) Service network access method, device, equipment and storage medium
CN110636149A (en) Remote access method, device, router and storage medium
CN112019641B (en) Data transmission method and device
CN110636146B (en) User address allocation method and device
CN111614790B (en) Virtual machine address configuration system, method and device
CN111935336A (en) IPv 6-based network management method and system
KR102481623B1 (en) address management method and system for applications in LISP-based distributed container virtualization environment
CN111835876B (en) Network address configuration method, device, server cluster and storage medium
CN107547679B (en) Address acquisition method and device
CN116886701A (en) Container service access method, device, equipment and storage medium
CN117675902A (en) Registration and service discovery method, system, device, electronic equipment and storage medium

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