CN111131497A - File transmission method and device, electronic equipment and storage medium - Google Patents

File transmission method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN111131497A
CN111131497A CN201911410348.7A CN201911410348A CN111131497A CN 111131497 A CN111131497 A CN 111131497A CN 201911410348 A CN201911410348 A CN 201911410348A CN 111131497 A CN111131497 A CN 111131497A
Authority
CN
China
Prior art keywords
file
target
source machine
target file
current
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.)
Granted
Application number
CN201911410348.7A
Other languages
Chinese (zh)
Other versions
CN111131497B (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.)
Wuba Co Ltd
Original Assignee
Wuba 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 Wuba Co Ltd filed Critical Wuba Co Ltd
Priority to CN201911410348.7A priority Critical patent/CN111131497B/en
Publication of CN111131497A publication Critical patent/CN111131497A/en
Application granted granted Critical
Publication of CN111131497B publication Critical patent/CN111131497B/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/06Protocols specially adapted for file transfer, e.g. file transfer protocol [FTP]
    • 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/1095Replication or mirroring of data, e.g. scheduling or transport for data synchronisation between network nodes

Abstract

The invention discloses a file transmission method, a file transmission device, electronic equipment and a storage medium, which can directly acquire a target file from a source machine stored with the target file by utilizing file transmission information pre-stored in a database, and store the target file in a target position of a target container so that the target container can start service by utilizing the target file. If the content of the target file depended on by the service is changed, only the target file needs to be modified in the source machine stored in the target file, so that the technical scheme of the invention can avoid using the mirror image to start the service, and further solve the problem of mirror image storage cost increase caused by the change of the content of the file.

Description

File transmission method and device, electronic equipment and storage medium
Technical Field
The present invention relates to the field of software development technologies, and in particular, to a file transmission method and apparatus, an electronic device, and a storage medium.
Background
Today, many enterprises provide information technology related services that can be implemented based on cloud computing. The cloud computing can collect a plurality of computing resources, automatic management is realized through software, the resources can be rapidly provided only by the participation of few people, and strong network support is provided for the realization of services.
At present, most of ways for starting the service depend on a container and an image, wherein the container is a control for realizing the service function, and the image is generated according to a file on which the service is started. When the service is started, a container corresponding to the service is usually found first, and then a container engine of the container is used for pulling an image corresponding to the service from an image library, so that files depended on by the service are ensured in the container when the service is started.
However, if the content of the file on which the service depends is always changed, the versions of the image generated by the file are increased, and the addition of the multi-version image causes the image library to occupy more space and increases the storage cost of the image.
Disclosure of Invention
The invention provides a file transmission method, a file transmission device, electronic equipment and a storage medium, and aims to solve the problem that the storage cost of a mirror image is increased easily caused by the fact that a file which is relied on by the existing container starting service is stored in the mirror image.
In a first aspect, the present invention provides a file transmission method, including:
acquiring file transmission information of a target file corresponding to a service from a database according to the service realized by a target container, wherein the target file is a file on which the service is started by the target container, the file transmission information carries current position information and target position information of the target file, and the current position information is used for representing a source machine address for storing the target file and a storage path of the target file in a source machine;
acquiring the target file from a source machine storing the target file according to the current position information in the file transmission information, wherein the source machine is a computer or a computer cluster storing the target file;
and transmitting the target file to the position indicated by the target position information in the target container for storage according to the target position information in the file transmission information.
With reference to the first aspect, in an implementable manner of the first aspect, the step of obtaining the target file from a source machine that stores the target file according to the current location information in the file transfer information includes:
according to the file transmission information, determining the address of a source machine for storing the target file and the current storage path of the target file in the source machine;
determining a source machine for storing the target file according to the address of the source machine;
determining the current storage position of the target file in the source machine according to the current storage path;
and acquiring the target file from the current storage position.
With reference to the first aspect, in an implementable manner of the first aspect, the step of transferring the target file to the target container for saving at the location indicated by the target location information according to the target location information in the file transfer information includes:
determining a target saving path of the target file to be in the target container according to the file transmission information;
and transmitting the target file to a target position in the target container for storage according to the target storage path.
With reference to the first aspect, in an implementable manner of the first aspect, the step of obtaining the target file from the current saving location includes:
sending a connection request to the source machine, wherein the connection request is used for indicating the source machine to determine a port number of file transmission;
acquiring a port number returned by the source machine;
and acquiring the target file from the current storage position according to the port number.
With reference to the first aspect, in an implementation manner of the first aspect, the determining an address of a source machine that stores the target file, and the current saving path of the target file in the source machine includes:
if the file transmission information indicates that the target file is stored in a plurality of source machine nodes of a source machine cluster, acquiring all source machine nodes in which the target file is stored;
randomly selecting a source machine node from all source machine nodes;
and determining the address of the source machine node and the current saving path of the target file in the source machine node.
With reference to the first aspect, in an implementation manner of the first aspect, the determining an address of a source machine that stores the target file, and the current saving path of the target file in the source machine includes:
if the file transmission information indicates that the target file is stored in a plurality of source machine nodes of a source machine cluster, acquiring all source machine nodes in which the target file is stored;
selecting a source machine node which should be used in the current file transmission process in a polling mode;
and determining the address of the source machine node and the current saving path of the target file in the source machine node.
In a second aspect, the present invention provides a file transfer apparatus, comprising:
an information obtaining module, configured to obtain, from a database, file transfer information of a target file corresponding to a service according to the service implemented by a target container, where the target file is a file on which the target container starts the service, and the file transfer information carries current location information and target location information of the target file, and the current location information is used to indicate a source machine address where the target file is stored and a storage path of the target file in a source machine;
a file obtaining module, configured to obtain the target file from a source machine storing the target file according to the current location information in the file transmission information, where the source machine is a computer or a computer cluster storing the target file;
and the file transmission module is used for transmitting the target file to the position indicated by the target position information in the target container for storage according to the target position information in the file transmission information.
With reference to the second aspect, in an implementation manner of the second aspect, the file obtaining module includes:
the address acquisition unit is used for determining the address of a source machine for storing the target file and the current storage path of the target file in the source machine according to the file transmission information;
a source machine determining unit, configured to determine, according to an address of the source machine, a source machine that stores the target file;
a storage location determining unit, configured to determine, according to the current storage path, a current storage location of the target file in the source machine;
and the file acquisition unit is used for acquiring the target file from the current storage position.
With reference to the second aspect, in an implementation manner of the second aspect, the file transfer module includes:
a saving path determining unit, configured to determine, according to the file transmission information, a target saving path of the target file to be in the target container;
and the file storage unit is used for transmitting the target file to a target position in the target container for storage according to the target storage path.
With reference to the second aspect, in an implementable manner of the second aspect, the file obtaining unit is further configured to: sending a connection request to the source machine, wherein the connection request is used for indicating the source machine to determine a port number of file transmission; acquiring a port number returned by the source machine; and acquiring the target file from the current storage position according to the port number.
With reference to the second aspect, in an implementable manner of the second aspect, the address obtaining unit is further configured to: if the file transmission information indicates that the target file is stored in a plurality of source machine nodes of a source machine cluster, acquiring all source machine nodes in which the target file is stored; randomly selecting a source machine node from all source machine nodes; and determining the address of the source machine node and the current saving path of the target file in the source machine node.
With reference to the second aspect, in an implementable manner of the second aspect, the address obtaining unit is further configured to: if the file transmission information indicates that the target file is stored in a plurality of source machine nodes of a source machine cluster, acquiring all source machine nodes in which the target file is stored; selecting a source machine node which should be used in the current file transmission process in a polling mode; and determining the address of the source machine node and the current saving path of the target file in the source machine node.
In a third aspect, the present invention provides an electronic device, comprising:
a memory for storing program instructions;
and the processor is used for calling and executing the program instructions in the memory so as to realize the file transmission method of the first aspect.
In a fourth aspect, the present invention provides a storage medium having stored therein a computer program which, when executed by at least one processor of a file transfer apparatus, causes the file transfer apparatus to execute the file transfer method of the first aspect.
As can be seen from the foregoing technical solutions, the file transfer method, the file transfer apparatus, the electronic device, and the storage medium according to the present invention can directly obtain a target file from a source device storing the target file by using file transfer information pre-stored in a database, and store the target file in a target location of a target container, so that the target container can start a service by using the target file. If the content of the target file depended on by the service is changed, only the target file needs to be modified in the source machine stored in the target file, so that the technical scheme of the invention can avoid using the mirror image to start the service, and further solve the problem of mirror image storage cost increase caused by the change of the content of the file.
Drawings
In order to more clearly illustrate the technical solution of the present invention, the drawings needed to be used in the embodiments will be briefly described below, and it is obvious to those skilled in the art that other drawings can be obtained according to the drawings without any inventive exercise.
Fig. 1 is a flowchart of a file transmission method according to an embodiment of the present invention;
FIG. 2 is a flowchart of obtaining a target file according to an embodiment of the present invention;
FIG. 3 is a flowchart of saving a target file according to an embodiment of the present invention;
fig. 4 is a flowchart of a second method for obtaining a target file according to an embodiment of the present invention;
fig. 5 is a flowchart of a third method for obtaining a target file according to an embodiment of the present invention;
fig. 6 is a flowchart of a fourth method for obtaining a target file according to an embodiment of the present invention;
FIG. 7 is a block diagram of a file transfer apparatus according to an embodiment of the present invention;
fig. 8 is a schematic diagram of a hardware structure of an electronic device according to an embodiment of the present invention.
Detailed Description
At present, when a service is started, a container corresponding to the service is usually found first, and then a container engine of the container is used for pulling an image file corresponding to the service from an image library, so that when the service is started, the container contains files on which the service depends. However, if the content of the file on which the service depends is always changed, the versions of the image generated by the file are increased, and the addition of the multi-version image causes the image library to occupy more space and increases the storage cost of the image. Therefore, the invention provides a file transmission method, before the container starts service, the target file is directly pulled from the source machine to the container local without using mirror image, thereby avoiding the problems of increasing storage space and cost of multi-version mirror image storage.
Fig. 1 is a flowchart of a file transmission method according to an embodiment of the present invention. As shown in fig. 1, a file transmission method provided in an embodiment of the present invention includes:
s101, according to a service realized by a target container, file transmission information of a target file corresponding to the service is obtained from a database, wherein the target file is a file on which the target container starts the service, the file transmission information carries current position information and target position information of the target file, and the current position information is used for representing a source machine address for storing the target file and a storage path of the target file in a source machine.
Typically, a service corresponds to a target file, and a target file corresponds to a file transfer information. In the embodiment of the invention, the file transmission information corresponding to all the services to be realized can be stored in the database in advance, and when the container needs to start the services, the corresponding file transmission information is only required to be acquired from the database.
The file transfer information of the embodiment of the present invention is used to indicate where to obtain the target file and where to transfer the target file to and store the target file, and specifically includes content of current location information of the stored target file, such as an address of the source machine, a storage path of the target file in the source machine, and the like, and content of target location information of the stored target file, such as an address of the target container, a storage path of the target file in the target container, and the like.
S102, according to the current position information in the file transmission information, the target file is obtained from a source machine for storing the target file, wherein the source machine is a computer or a computer cluster for storing the target file.
The source machine in the embodiment of the present invention may be a computer, a terminal, a computer, or a device with communication and calculation functions, which implements a software function. A source machine may have a plurality of target files corresponding to services stored therein, and therefore, the storage location of each target file needs to be clear, so as to accurately obtain a target file corresponding to a certain service.
S103, according to the target position information in the file transmission information, the target file is transmitted to the position indicated by the target position information in the target container to be stored.
According to the file transmission method in the embodiment of the invention, the target file can be directly obtained from the source machine in which the target file is stored by using the file transmission information pre-stored in the database, and the target file is stored in the target position of the target container, so that the target container can start service by using the target file. The service is prevented from being started by using the mirror image, and the problem of increased mirror image storage cost caused by file content change is solved.
Fig. 2 is a flowchart of acquiring a target file according to an embodiment of the present invention. As shown in fig. 2, in the embodiment of the present invention, the step of obtaining the target file from the source machine storing the target file according to the current location information in the file transfer information includes:
s201, according to the file transmission information, determining the address of a source machine for storing the target file and the current storage path of the target file in the source machine.
The current location information of the target file in the file transfer information includes the address of the source machine storing the target file and the current storing path of the target file in the source machine. For example, the source machine address may be represented as source machine a: 10.202.2.236, respectively; the current save path of the target file in source machine A may be denoted as C: \ Users \ Public \ Win.
S202, determining a source machine for storing the target file according to the address of the source machine.
Each source machine in the embodiment of the invention has its own address, so that which source machine is can be determined reversely according to the address.
S203, determining the current storage position of the target file in the source machine according to the current storage path. For example, if the current saving path is C: \ Users \ Public, it may be determined that the target file is saved in the subfolder Public in the folder named Users in the C disk of the source machine.
And S204, acquiring the target file from the current storage position.
In the embodiment of the invention, the name of the target file corresponds to or is the same as the name of the service, so that the target file can be directly obtained from the subfolder Public according to the service name.
In the embodiment of the invention, the target file is transmitted from the current position to the target position by virtue of the file transmission information, the address of the source machine is firstly determined, and then which source machine stores the target file is determined, and then the nodes or node folders on the path are sequentially accessed according to the path of the target file stored by the source machine, and the target file is found from the final node position.
Therefore, the file transmission method provided by the embodiment of the invention can directly acquire the target file from the source machine in which the target file is stored by using the file transmission information pre-stored in the database, so that the service is prevented from being started by using the mirror image, and the problem of increased mirror image storage cost caused by file content change is solved.
Fig. 3 is a flowchart of saving a target file according to an embodiment of the present invention. As shown in fig. 3, in the embodiment of the present invention, the step of transferring the target file to the location indicated by the target location information in the target container for saving according to the target location information of the target file in the file transfer information includes:
s301, according to the file transmission information, determining a target storage path of the target file to be in the target container.
The file transmission method provided by the embodiment of the invention aims to transmit the target file from the storage position to the target container when the target container starts the service, so that the target container can realize the service depending on the target file. Therefore, the target file needs to be saved to the target container that originated the file transfer request.
S302, according to the target storage path, transmitting the target file to a target position in the target container for storage.
And the target container also accesses the nodes or the node folders on the path in sequence according to the target storage path in the file transmission information until finding the final node position on the path, and stores the target file.
Therefore, the file transmission method provided by the embodiment of the invention can utilize the file transmission information pre-stored in the database to store the target file in the target position of the target container, so that the target container can utilize the target file to start the service. The service is prevented from being started by using the mirror image, and the problem of increased mirror image storage cost caused by file content change is solved.
Fig. 4 is a flowchart of a second method for obtaining a target file according to an embodiment of the present invention. As shown in fig. 4, the step of obtaining the target file from the current saving location in the embodiment of the present invention includes:
s401, sending a connection request to the source machine, wherein the connection request is used for indicating the source machine to determine a port number of file transmission.
In this embodiment of the present invention, the service started by the target container may be an HTTP service, the connection request in step S401 may be an HTTP service request, the source machine starts the HTTP service after receiving the connection request, and a port number corresponding to the HTTP service is returned to the target container.
S402, acquiring the port number returned by the source machine. And the target container transmits the target file according to the designated port.
S403, according to the port number, obtaining the target file from the current storage position.
The file transmission method provided by the embodiment of the invention can also be used for transmitting the file according to the type of the service and the corresponding port, so that the accuracy and the safety of file transmission are ensured.
Fig. 5 is a flowchart of a third method for obtaining a target file according to an embodiment of the present invention. As shown in fig. 5, the determining an address of a source machine that stores the target file, and the step of determining a current saving path of the target file in the source machine in the embodiment of the present invention includes:
s501, if the file transmission information indicates that the target file is stored in a plurality of source machine nodes of a source machine cluster, all the source machine nodes in which the target file is stored are obtained.
The source machine in the embodiment of the present invention may be one source machine or one source machine cluster, where a source machine cluster refers to a group formed by a plurality of mutually associated source machines, and one target file may be stored in only one source machine or may be stored in all source machine nodes or some source machine nodes of one source machine cluster. If the target file is stored in a source machine cluster, all source machine nodes storing the target file in the source machine cluster need to be determined.
S502, one source machine node is randomly selected from all the source machine nodes.
In the embodiment of the invention, the mode of selecting the source machine node from the source machine cluster follows a random principle or a polling principle, when the random principle is adopted, one of all the source machine nodes storing the target file is randomly selected, and then the address of the source machine node and the storage path of the target file are determined according to the file transmission information.
S503, determining the address of the source machine node and the current saving path of the target file in the source machine node.
According to the file transmission method in the embodiment of the invention, one source machine node can be selected from the source machine cluster in a random mode to obtain the target file, and then the target file is stored in the target container, so that the target container can start service by using the target file.
Fig. 6 is a flowchart of a fourth method for obtaining a target file according to an embodiment of the present invention. As shown in fig. 6, the determining an address of a source machine that stores the target file, and the step of determining a current saving path of the target file in the source machine in the embodiment of the present invention includes:
s601, if the file transmission information indicates that the target file is stored in a plurality of source machine nodes of a source machine cluster, all the source machine nodes in which the target file is stored are obtained.
S602, selecting a source machine node which should be used in the current file transmission process in a polling mode.
In the embodiment of the present invention, all source machine nodes storing the target file corresponding to the service may also be arranged in a certain order, when the container starts the service for the first time, the first source machine node is selected in order, then when the container starts the service again for the next time, the second source machine node is selected in order, and one source machine node in the source machine cluster is polled and selected in this order to acquire the target file.
S603, determining the address of the source machine node and the current saving path of the target file in the source machine node.
The file transmission method in the embodiment of the invention can also select a source machine node which is used in the current transmission process from the source machine cluster in a polling mode to obtain the target file, and then store the target file in the target container, so that the target container can start the service by using the target file.
As can be seen from the above, embodiments of the present invention provide a file transfer method, which can directly obtain a target file from a source machine storing the target file by using file transfer information pre-stored in a database, and store the target file in a target location of a target container, so that the target container can start a service by using the target file. If the content of the target file depended on by the service is changed, only the target file needs to be modified in the source machine stored in the target file, so that the technical scheme of the invention can avoid using the mirror image to start the service, and further solve the problem of mirror image storage cost increase caused by the change of the content of the file.
Fig. 7 is a block diagram of a file transfer apparatus according to an embodiment of the present invention. As shown in fig. 7, the file transfer apparatus provided in the embodiment of the present invention includes:
an information obtaining module 71, configured to obtain, according to a service implemented by a target container, file transmission information of a target file corresponding to the service from a database, where the target file is a file on which the target container starts the service, and the file transmission information carries current location information and target location information of the target file, and the current location information is used to indicate a source machine address for storing the target file and a storage path of the target file in the source machine; a file obtaining module 72, configured to obtain the target file from a source machine storing the target file according to the current location information in the file transmission information, where the source machine is a computer or a computer cluster storing the target file; and a file transmission module 73, configured to transmit the target file to a location indicated by the target location information in the target container according to the target location information in the file transmission information, and store the target file.
Wherein, the file acquisition module includes: the address acquisition unit is used for determining the address of a source machine for storing the target file and the current storage path of the target file in the source machine according to the file transmission information; a source machine determining unit, configured to determine, according to an address of the source machine, a source machine that stores the target file; a storage location determining unit, configured to determine, according to the current storage path, a current storage location of the target file in the source machine; and the file acquisition unit is used for acquiring the target file from the current storage position.
The file transmission module comprises: a saving path determining unit, configured to determine, according to the file transmission information, a target saving path of the target file to be in the target container; and the file storage unit is used for transmitting the target file to a target position in the target container for storage according to the target storage path.
The file acquisition unit is further configured to: sending a connection request to the source machine, wherein the connection request is used for indicating the source machine to determine a port number of file transmission; acquiring a port number returned by the source machine; and acquiring the target file from the current storage position according to the port number.
The address acquisition unit is further configured to: if the file transmission information indicates that the target file is stored in a plurality of source machine nodes of a source machine cluster, acquiring all source machine nodes in which the target file is stored; randomly selecting a source machine node from all source machine nodes; and determining the address of the source machine node and the current saving path of the target file in the source machine node.
The address acquisition unit is further configured to: if the file transmission information indicates that the target file is stored in a plurality of source machine nodes of a source machine cluster, acquiring all source machine nodes in which the target file is stored; selecting a source machine node which should be used in the current file transmission process in a polling mode; and determining the address of the source machine node and the current saving path of the target file in the source machine node.
Fig. 8 is a schematic diagram of a hardware structure of an electronic device according to an embodiment of the present invention. As shown in fig. 8, an electronic device provided in an embodiment of the present invention includes: a memory 81 for storing program instructions; and the processor 82 is used for calling and executing the program instructions in the memory so as to implement the file transmission method according to the above embodiment.
In an embodiment of the present invention, the processor 82 and the memory 81 may be connected by a bus or other means. The processor may be a general-purpose processor, such as a central processing unit, a digital signal processor, an application specific integrated circuit, or one or more integrated circuits configured to implement embodiments of the present invention. The memory may include volatile memory, such as random access memory; the memory may also include non-volatile memory, such as read-only memory, flash memory, a hard disk, or a solid state disk.
The present invention also provides a storage medium having a computer program stored therein, which when executed by at least one processor of a file transfer apparatus, causes the file transfer apparatus to execute the file transfer method described in the above embodiments.
The storage medium may be a magnetic disk, an optical disk, a read-only memory (ROM) or a Random Access Memory (RAM).
Those skilled in the art will readily appreciate that the techniques of the embodiments of the present invention may be implemented as software plus a required general purpose hardware platform. Based on such understanding, the technical solutions in the embodiments of the present invention may be essentially or partially implemented in the form of a software product, which may be stored in a storage medium, such as ROM/RAM, magnetic disk, optical disk, etc., and includes several instructions for enabling a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the method according to the embodiments or some parts of the embodiments.
The same and similar parts in the various embodiments in this specification may be referred to each other. In particular, for the embodiments of the service construction apparatus and the service loading apparatus, since they are substantially similar to the embodiments of the method, the description is simple, and the relevant points can be referred to the description in the embodiments of the method.
The above-described embodiments of the present invention should not be construed as limiting the scope of the present invention.

Claims (14)

1. A method for file transfer, comprising:
acquiring file transmission information of a target file corresponding to a service from a database according to the service realized by a target container, wherein the target file is a file on which the service is started by the target container, the file transmission information carries current position information and target position information of the target file, and the current position information is used for representing a source machine address for storing the target file and a storage path of the target file in a source machine;
acquiring the target file from a source machine storing the target file according to the current position information in the file transmission information, wherein the source machine is a computer or a computer cluster storing the target file;
and transmitting the target file to the position indicated by the target position information in the target container for storage according to the target position information in the file transmission information.
2. The method of claim 1, wherein the step of obtaining the target file from a source machine storing the target file according to the current location information in the file transfer information comprises:
according to the file transmission information, determining the address of a source machine for storing the target file and the current storage path of the target file in the source machine;
determining a source machine for storing the target file according to the address of the source machine;
determining the current storage position of the target file in the source machine according to the current storage path;
and acquiring the target file from the current storage position.
3. The method according to claim 1, wherein the step of transferring the target file to the location indicated by the target location information in the target container according to the target location information in the file transfer information comprises:
determining a target saving path of the target file to be in the target container according to the file transmission information;
and transmitting the target file to a target position in the target container for storage according to the target storage path.
4. The method of claim 2, wherein the step of retrieving the target file from the current saving location comprises:
sending a connection request to the source machine, wherein the connection request is used for indicating the source machine to determine a port number of file transmission;
acquiring a port number returned by the source machine;
and acquiring the target file from the current storage position according to the port number.
5. The method of claim 2, wherein the step of determining an address of a source machine that saves the target file, and wherein the step of determining a current saving path of the target file in the source machine comprises:
if the file transmission information indicates that the target file is stored in a plurality of source machine nodes of a source machine cluster, acquiring all source machine nodes in which the target file is stored;
randomly selecting a source machine node from all source machine nodes;
and determining the address of the source machine node and the current saving path of the target file in the source machine node.
6. The method of claim 2, wherein the step of determining an address of a source machine that saves the target file, and wherein the step of determining a current saving path of the target file in the source machine comprises:
if the file transmission information indicates that the target file is stored in a plurality of source machine nodes of a source machine cluster, acquiring all source machine nodes in which the target file is stored;
selecting a source machine node which should be used in the current file transmission process in a polling mode;
and determining the address of the source machine node and the current saving path of the target file in the source machine node.
7. A file transfer apparatus, comprising:
an information obtaining module, configured to obtain, from a database, file transfer information of a target file corresponding to a service according to the service implemented by a target container, where the target file is a file on which the target container starts the service, and the file transfer information carries current location information and target location information of the target file, and the current location information is used to indicate a source machine address where the target file is stored and a storage path of the target file in a source machine;
a file obtaining module, configured to obtain the target file from a source machine storing the target file according to the current location information in the file transmission information, where the source machine is a computer or a computer cluster storing the target file;
and the file transmission module is used for transmitting the target file to the position indicated by the target position information in the target container for storage according to the target position information in the file transmission information.
8. The apparatus of claim 7, wherein the file acquisition module comprises:
the address acquisition unit is used for determining the address of a source machine for storing the target file and the current storage path of the target file in the source machine according to the file transmission information;
a source machine determining unit, configured to determine, according to an address of the source machine, a source machine that stores the target file;
a storage location determining unit, configured to determine, according to the current storage path, a current storage location of the target file in the source machine;
and the file acquisition unit is used for acquiring the target file from the current storage position.
9. The apparatus of claim 7, wherein the file transfer module comprises:
a saving path determining unit, configured to determine, according to the file transmission information, a target saving path of the target file to be in the target container;
and the file storage unit is used for transmitting the target file to a target position in the target container for storage according to the target storage path.
10. The apparatus of claim 8, wherein the file obtaining unit is further configured to: sending a connection request to the source machine, wherein the connection request is used for indicating the source machine to determine a port number of file transmission; acquiring a port number returned by the source machine; and acquiring the target file from the current storage position according to the port number.
11. The apparatus of claim 8, wherein the address fetch unit is further configured to: if the file transmission information indicates that the target file is stored in a plurality of source machine nodes of a source machine cluster, acquiring all source machine nodes in which the target file is stored; randomly selecting a source machine node from all source machine nodes; and determining the address of the source machine node and the current saving path of the target file in the source machine node.
12. The apparatus of claim 8, wherein the address fetch unit is further configured to: if the file transmission information indicates that the target file is stored in a plurality of source machine nodes of a source machine cluster, acquiring all source machine nodes in which the target file is stored; selecting a source machine node which should be used in the current file transmission process in a polling mode; and determining the address of the source machine node and the current saving path of the target file in the source machine node.
13. An electronic device, comprising:
a memory for storing program instructions;
a processor for calling and executing program instructions in said memory to implement the file transfer method of any of claims 1-6.
14. A storage medium, characterized in that the storage medium has stored therein a computer program which, when executed by at least one processor of a file transfer apparatus, causes the file transfer apparatus to execute the file transfer method according to any one of claims 1 to 6.
CN201911410348.7A 2019-12-31 2019-12-31 File transmission method and device, electronic equipment and storage medium Active CN111131497B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911410348.7A CN111131497B (en) 2019-12-31 2019-12-31 File transmission method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911410348.7A CN111131497B (en) 2019-12-31 2019-12-31 File transmission method and device, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN111131497A true CN111131497A (en) 2020-05-08
CN111131497B CN111131497B (en) 2022-08-26

Family

ID=70506241

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911410348.7A Active CN111131497B (en) 2019-12-31 2019-12-31 File transmission method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN111131497B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111756818A (en) * 2020-06-05 2020-10-09 腾讯科技(深圳)有限公司 File transfer method, device, equipment and storage medium

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102970333A (en) * 2011-10-27 2013-03-13 微软公司 File fetch from a remote client device
CN105607944A (en) * 2015-12-18 2016-05-25 北京奇虎科技有限公司 Method and device for sharing application environment
CN106844489A (en) * 2016-12-24 2017-06-13 上海七牛信息技术有限公司 A kind of file operation method, device and system
CN106874357A (en) * 2016-12-28 2017-06-20 新华三技术有限公司 A kind of Resources Customization method and apparatus of Web applications
CN106878366A (en) * 2016-06-20 2017-06-20 阿里巴巴集团控股有限公司 A kind of file uploading method and device
US20180285210A1 (en) * 2017-03-28 2018-10-04 Commvault Systems, Inc. Container image generation process
CN110244990A (en) * 2019-04-29 2019-09-17 五八有限公司 Application component call method, device, electronic equipment and storage medium

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102970333A (en) * 2011-10-27 2013-03-13 微软公司 File fetch from a remote client device
CN105607944A (en) * 2015-12-18 2016-05-25 北京奇虎科技有限公司 Method and device for sharing application environment
CN106878366A (en) * 2016-06-20 2017-06-20 阿里巴巴集团控股有限公司 A kind of file uploading method and device
CN106844489A (en) * 2016-12-24 2017-06-13 上海七牛信息技术有限公司 A kind of file operation method, device and system
CN106874357A (en) * 2016-12-28 2017-06-20 新华三技术有限公司 A kind of Resources Customization method and apparatus of Web applications
US20180285210A1 (en) * 2017-03-28 2018-10-04 Commvault Systems, Inc. Container image generation process
CN110244990A (en) * 2019-04-29 2019-09-17 五八有限公司 Application component call method, device, electronic equipment and storage medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
李伟: ""基于Docker的镜像组合技术研究与实现"", 《中国优秀硕士论文全文数据库》 *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111756818A (en) * 2020-06-05 2020-10-09 腾讯科技(深圳)有限公司 File transfer method, device, equipment and storage medium
CN111756818B (en) * 2020-06-05 2022-01-14 腾讯科技(深圳)有限公司 File transfer method, device, equipment and storage medium

Also Published As

Publication number Publication date
CN111131497B (en) 2022-08-26

Similar Documents

Publication Publication Date Title
CN111399756B (en) Data storage method, data downloading method and device
CN106031127B (en) Method and apparatus for management of applications
CN108156252B (en) Data access method and device, server and client
CN111143723A (en) Page jump method and device, electronic equipment and storage medium
US8856365B2 (en) Computer-implemented method, computer system and computer readable medium
EP3163946A1 (en) Information transmission method and apparatus, device, computer program and recording medium
CN107172214B (en) Service node discovery method and device with load balancing function
CN109933289B (en) Storage copy deployment method and system, electronic equipment and storage medium
CN110677492A (en) Access request processing method and device, electronic equipment and storage medium
CN111159219A (en) Data management method, device, server and storage medium
CN111131497B (en) File transmission method and device, electronic equipment and storage medium
CN113779452B (en) Data processing method, device, equipment and storage medium
CN114416508A (en) Application performance monitoring method and device, storage medium and electronic equipment
US9521087B1 (en) Servicing requests using multiple data release cycles
CN112363980A (en) Data processing method and device for distributed system
CN109032693A (en) Method and device for loading display information, electronic equipment and readable storage medium
CN110413684B (en) Database synchronization method, device and system
CN110955460A (en) Service process starting method and device, electronic equipment and storage medium
CN114338794B (en) Service message pushing method and device, electronic equipment and storage medium
CN111680014B (en) Shared file acquisition method and device, electronic equipment and storage medium
CN105760396B (en) A kind of webpage loading method and device
CN111159244B (en) Data query method and device
CN113485855A (en) Memory sharing method and device, electronic equipment and readable storage medium
CN111147556A (en) Load balancing method, device, equipment and storage medium
CN111767104B (en) Language type switching method and device, computer 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