WO2021189253A1 - Data transmission method and apparatus - Google Patents

Data transmission method and apparatus Download PDF

Info

Publication number
WO2021189253A1
WO2021189253A1 PCT/CN2020/080896 CN2020080896W WO2021189253A1 WO 2021189253 A1 WO2021189253 A1 WO 2021189253A1 CN 2020080896 W CN2020080896 W CN 2020080896W WO 2021189253 A1 WO2021189253 A1 WO 2021189253A1
Authority
WO
WIPO (PCT)
Prior art keywords
server
search
search request
elastic
message
Prior art date
Application number
PCT/CN2020/080896
Other languages
French (fr)
Chinese (zh)
Inventor
郭子亮
Original Assignee
深圳市欢太科技有限公司
Oppo广东移动通信有限公司
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 深圳市欢太科技有限公司, Oppo广东移动通信有限公司 filed Critical 深圳市欢太科技有限公司
Priority to CN202080096690.9A priority Critical patent/CN115087968A/en
Priority to PCT/CN2020/080896 priority patent/WO2021189253A1/en
Publication of WO2021189253A1 publication Critical patent/WO2021189253A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/953Querying, e.g. by the use of web search engines

Definitions

  • This application relates to the field of electronic technology, in particular to a data transmission method and device.
  • the user’s terminal equipment uses the representational state transfer-ful application programming interface (restful api) provided by the elastic search (Es) engine or the client software development kit (client software development kit, client SDK interface), directly insert or update the search request data into the index of the elastic search server.
  • the representational state transfer-ful application programming interface (restful api) provided by the elastic search (Es) engine or the client software development kit (client software development kit, client SDK interface)
  • client software development kit client software development kit, client SDK interface
  • the submission speed and data volume of the search request data completely depend on the frequency of the terminal device calling the interface and the total number of data passed in each request (using the bulk interface).
  • the elastic search server cluster has fewer resources available, if the user’s terminal device write speed is too high, there is a high probability that the elastic search server cluster will become unstable, or even cause the elastic search server cluster to be unavailable, thereby reducing usage
  • the availability of data writing or search services provided by the elastic search server cluster is difficult to guarantee the availability of the elastic search server in the elastic search server cluster.
  • the embodiments of the present application provide a data transmission method and device, which can improve the availability of an elastic search server cluster, and avoid that the entire elastic search server cluster is unstable or unavailable due to the large amount of data written in the search request data.
  • an embodiment of the present application provides a data transmission method, which is applied to a storage server in a data transmission system.
  • the data transmission system further includes a terminal device, a gateway server, a transit server, and at least one elastic search server cluster.
  • Methods include:
  • the search request message carrying search request data
  • the search request message is sent by the terminal device to the gateway server, and then the gateway server A message generated according to the search request data;
  • the first elastic search server in, the first elastic search server is any server in the at least one elastic search server cluster.
  • an embodiment of the present application provides a data transmission method, which is applied to a transit server in a data transmission system.
  • the data transmission system further includes a terminal device, a gateway server, a storage server, and at least one elastic search server cluster.
  • Methods include:
  • the search request message is sent to a first elastic search server in the at least one elastic search server cluster, where the first elastic search server is any server in the at least one elastic search server cluster.
  • an embodiment of the present application provides a data transmission device, which is applied to a storage server in a data transmission system, and the data transmission system further includes a terminal device, a gateway server, a transit server, and at least one elastic search server cluster, so
  • the data transmission device includes:
  • the receiving unit is configured to receive a search request message sent by the gateway server, the search request message carries search request data, and the search request message is the terminal device sending the search request data to the gateway server, and then A message generated by the gateway server according to the search request data;
  • the receiving unit is further configured to receive a subscription request sent by the transit server;
  • the first sending unit is configured to send the search request message to the transit server according to the subscription request, and instruct the transit server to send the search request message to the first in the at least one elastic search server cluster
  • An elastic search server, and the first elastic search server is any server in the at least one elastic search server cluster.
  • an embodiment of the present application provides a data transmission device, which is applied to a transit server in a data transmission system, and the data transmission system further includes a terminal device, a gateway server, a storage server, and at least one elastic search server cluster, so
  • the data transmission device includes:
  • the second sending unit is configured to send a subscription request to the storage server
  • the reading unit is configured to read a search request message from the message queue of the storage server, the search request message carries search request data, and the search request message is sent by the terminal device to the search request data.
  • the gateway server then the gateway server generates the search request message according to the search request data and writes it into the message queue of the storage server;
  • the second sending unit is further configured to send the search request message to a first elastic search server in the at least one elastic search server cluster, where the first elastic search server is the at least one elastic search server cluster Any server in.
  • an embodiment of the present application provides a storage server, including a processor, a memory, a communication interface, and one or more programs, wherein the one or more programs are stored in the memory and are configured by the above Executed by the processor, and the foregoing program includes instructions for executing the steps in the first aspect of the embodiments of the present application.
  • an embodiment of the present application provides a transit server, including a processor, a memory, a communication interface, and one or more programs, wherein the one or more programs are stored in the memory and are configured by the above Executed by the processor, and the foregoing program includes instructions for executing the steps in the second aspect of the embodiments of the present application.
  • an embodiment of the present application provides a computer-readable storage medium, wherein the above-mentioned computer-readable storage medium stores a computer program for electronic data exchange, wherein the above-mentioned computer program enables a computer to execute Some or all of the steps described in one aspect or the second aspect.
  • the embodiments of the present application provide a computer program product, wherein the above-mentioned computer program product includes a non-transitory computer-readable storage medium storing a computer program, and the above-mentioned computer program is operable to cause a computer to execute as implemented in this application. Examples include part or all of the steps described in the first aspect or the second aspect.
  • the computer program product may be a software installation package.
  • FIG. 1A is a schematic structural diagram of a data transmission system for implementing a data transmission method according to an embodiment of the present application
  • FIG. 1B is a schematic flowchart of a data transmission method disclosed in an embodiment of the present application.
  • FIG. 1C is a schematic diagram of a demonstration of writing the search request message into a message queue according to an embodiment of the present application
  • FIG. 1D is a schematic diagram illustrating a mapping relationship between a message collection name and an elastic search server cluster and index name provided by an embodiment of the present application
  • FIG. 2 is a schematic flowchart of another data transmission method disclosed in an embodiment of the present application.
  • FIG. 3 is a schematic flowchart of another data transmission method disclosed in an embodiment of the present application.
  • FIG. 4A is a schematic structural diagram of another storage server disclosed in an embodiment of the present application.
  • 4B is a schematic structural diagram of another transit server disclosed in an embodiment of the present application.
  • FIG. 5 is a schematic structural diagram of a data transmission device disclosed in an embodiment of the present application.
  • FIG. 6A is a schematic structural diagram of another data transmission device disclosed in an embodiment of the present application.
  • FIG. 6B is a modified structure of the data transmission device shown in FIG. 6A disclosed in an embodiment of the present application.
  • Es server is a search server based on the Lucene engine. It provides a full-text search engine with distributed multi-user capabilities. It is a highly available and scalable search engine framework.
  • Message queue It is a "first in, first out” data organization in the basic data structure.
  • Presentation layer state transfer-ful application programming interface (representational state transfer-ful application programming interface, restful api): Presentation layer state transfer application programming interface, with a software construction style designed to provide web services.
  • SDK Software development kit
  • the terminal devices involved in the embodiments of this application may include various handheld devices with wireless communication functions (such as mobile phones, tablet computers, etc.), vehicle-mounted devices, wearable devices, computing devices, or other processing devices connected to wireless modems, as well as various Forms of User Equipment (User Equipment, UE), Mobile Station (Mobile Station, MS), and so on.
  • UE User Equipment
  • MS Mobile Station
  • FIG. 1A is a schematic structural diagram of a data transmission system for implementing a data transmission method according to an embodiment of the present invention.
  • the data transmission system may include a terminal device 1001, a gateway server 1002, a storage server 1003, a transit server 1004, and at least one elastic search server cluster.
  • Each elastic search server cluster in the at least one elastic search server cluster includes multiple elastic search servers 1004,
  • the terminal device 1001 is a client device used by the user.
  • the gateway server 1002 is connected to the terminal device 1001.
  • the terminal device 1001 does not directly send search request data to the elastic search server cluster, but sends the search request data to the gateway server 1002.
  • the storage server 1003 is connected to the gateway server 1002.
  • the gateway server 1002 writes the received search request data in the form of a search request message into the storage server 1003.
  • the storage server 1003 writes the search request message into the message queue.
  • the storage server 1003 also communicates with the transit server 1004. Connect, the transit server 1004 sends a subscription message to the storage server 1003, and reads the search request message from the storage server 1003, and then the transit server 1004 sends the read search request message to the elastic search server 1005 in the elastic search server cluster , So as to realize the user's terminal equipment to access the elastic search server cluster.
  • FIG. 1B is a schematic flowchart of a data transmission method disclosed in an embodiment of the present application, which is applied to a storage server in a data transmission system.
  • An elastic search server cluster the data transmission method includes the following steps:
  • the user service of the terminal device can send search request data to the gateway server, and then the gateway server generates a search request message according to the search request data, and sends the search request message Sent to the storage server, so that the storage server can receive the search request message sent by the gateway server.
  • the terminal device can pre-register the user service.
  • the terminal device can obtain the elastic search server cluster information corresponding to the index in advance, so that the terminal device can send the elastic search server to the gateway server when it needs search access. Search request message for cluster information.
  • the storage server can receive different search request messages sent by the gateway server, so that the storage server can sequentially write the search request messages into the message queue according to the order in which the search request messages are received.
  • the search request data includes elastic search server cluster information and index name information to which the search request data belongs.
  • writing the search request message to a message queue may include the following steps:
  • FIG. 1C is a schematic diagram of writing the search request message into the message queue according to an embodiment of the application.
  • the storage server sends the search request message to the storage server according to the index name and the elastic search server cluster information.
  • the storage server can also establish a mapping relationship between the message set name corresponding to the search request message and the elastic search server cluster and index name, as shown in Figure 1D, which is implemented in this application
  • the example provides a demonstration diagram of the mapping relationship between the name of the message collection and the elastic search server cluster and index name.
  • Topic A, Topic B, Topic C, and Topic D are the names of the message collections, C1, C2, C3.. .It is an elastic search server cluster, V1, V2, V3... are index names.
  • the transit server can read the search request message in the message queue at the same time.
  • the above-mentioned transit server may be, for example, a sink server.
  • the storage server may receive a subscription request sent by the transit server, and the subscription request is used to instruct the storage server to send the search request message in the message queue to the transit server.
  • the storage server can read the search request set according to the order of the message set in the message queue. Because the read data and write data in the message queue follow the "first in first out" rule, it can ensure that the message queue is read The order of the search request data and the write search request data is the same.
  • part of the search request data can be stored through the message queue, which is specific to the current elastic search server cluster.
  • the availability of the elastic search server cluster can be improved, and the large amount of data written in the search request data can be avoided to cause the entire elastic search server
  • the cluster is unstable or unavailable.
  • the search request data is stored in the message queue, the message track can be traced back for each search request data.
  • the search request data can be read again from the message queue. , So as to recover from the failure.
  • the data transmission method described in the embodiment of this application is applied to a storage server in a data transmission system.
  • the data transmission system also includes a terminal device, a gateway server, a transit server, and at least one elastic search server cluster.
  • the search request message sent by the server.
  • the search request message carries the search request data.
  • the search request message is a message that the terminal device sends the search request data to the gateway server, and then the gateway server generates the search request data according to the search request data; writes the search request message into the message queue ; Receive the subscription request sent by the transit server, send the search request message to the transit server according to the subscription request, and instruct the transit server to send the search request message to the first elastic search server in at least one elastic search server cluster, the first elastic search server It is any server in at least one elastic search server cluster.
  • the search request data can be stored in the message queue and read by the transit server, which can improve the availability of the elastic search server cluster and avoid writing data due to search requests.
  • the large amount of imported data makes the entire elastic search server cluster unstable or unavailable.
  • the trajectory of the message can be traced back for each search request data.
  • FIG. 2 is a schematic flowchart of a data transmission method disclosed in an embodiment of the present application.
  • the data transmission method is applied to a transit server in a data transmission system.
  • the data transmission system further includes a terminal device, a gateway server, a storage server, and at least one elastic search server cluster.
  • the data transmission method includes the following steps:
  • the search request message carries search request data, and the search request message is sent by the terminal device.
  • the search request data is sent to the gateway server, and then the gateway server generates the search request message according to the search request data and writes it into the message queue of the storage server.
  • the user service of the terminal device can send search request data to the gateway server, and then the gateway server generates a search request message according to the search request data, and sends the search request message to The storage server, and further, the server can write the search request message into the message queue, so that the transit server can send a subscription request to the storage server; and read the search request message from the message queue of the storage server.
  • reading the search request message from the message queue of the storage server may include the following steps:
  • the message set is read from the message queue of the storage server, and the message set includes the search request message.
  • the search request data includes elastic search server cluster information and index name information to which the search request data belongs.
  • the storage server writes the search request message into the message queue, it is specifically based on the elastic search server cluster information and all information.
  • the index name information divides the search request message into message sets, and then writes the message sets into the message queue, so that the transit server can read from the message queue of the storage server according to the sequence of the message sets in the message queue The message collection.
  • step 201 before reading the search request message from the message queue of the storage server, the following steps may be further included:
  • the health status data includes at least one of the following health status sub-data: indexing rate, indexing time, memory size, and request rejection number, Wherein, each of the health status sub-data corresponds to a parameter threshold;
  • the transit server can obtain the current index rate, index time, memory size, and request rejections of all elastic search servers in at least one elastic search server cluster.
  • the index rate refers to the average value of multiple index rates corresponding to all elastic search servers.
  • Index time consumption refers to the sum of multiple index time consumptions corresponding to all elastic search servers
  • memory size refers to the sum of multiple memory sizes corresponding to all elastic search servers
  • the number of request rejections refers to multiple indexes corresponding to all elastic search servers. The sum of the number of rejected requests.
  • the transit server may also preset the first parameter threshold corresponding to the index rate, the second parameter threshold corresponding to the time-consuming indexing, the third parameter threshold corresponding to the memory size, and the fourth parameter threshold corresponding to the number of request rejections.
  • index rate, index time consumption, memory size, and request rejection number exceed the corresponding parameter threshold. If the index rate, index time consumption, memory size, and request rejection number do not exceed the corresponding parameter threshold, you can start from the storage
  • the search request message is read from the message queue of the server. If there is at least one health status sub-data that exceeds the corresponding parameter threshold, the execution of the operation of reading the search request message from the message queue of the storage server can be suspended, so that Dynamically control the read rate of read search request messages to avoid the situation where the elastic search server cluster becomes unavailable due to excessive write requests.
  • the transit server may send the read search request message to the first elastic search server in the at least one elastic search server cluster, where the first elastic search server may be any server in the at least one elastic search server cluster.
  • the search request data includes elastic search server cluster information.
  • sending the search request message to the first elastic search server in the at least one elastic search server cluster may include the following steps:
  • the search request data may include the elastic search server cluster information to be sent by the search request data. Therefore, the technical secondary school server may determine the first elastic search server cluster in the at least one elastic search server cluster according to the elastic search server cluster information.
  • An elastic search server cluster is an elastic search server cluster corresponding to the elastic search server cluster information. Then, the transit server may send the search request message to the first elastic search server in the first elastic search server cluster, and the first elastic search server may be any server in the first elastic search server cluster.
  • the search request data includes elastic search server cluster information and version information of the elastic search engine.
  • the search request message is sent to the first elastic search in the at least one elastic search server cluster.
  • the server can include the following steps:
  • the gateway server can support multiple versions of the elastic search engine, and the search request data can include the version information of the elastic search engine. Furthermore, when the search request data is sent from the terminal device to the gateway server, and then through the storage server, it reaches the transit server and is transited.
  • the server may determine the first elastic search server corresponding to the version information in the first elastic search server cluster according to the version information of the elastic search engine in the search request data. Therefore, the user service of the terminal device can operate the elastic search server clusters of different versions through the same interface, so that the cost can be reduced in the process of cluster upgrade and version switching later.
  • the transit server includes an SDK interface or an API interface.
  • sending the search request message to the first elastic search server may include the following steps:
  • the transit server may include the software development kit SDK interface or API interface, so that the transit server can send the search request message to the first elastic search server through the SDK interface, or send the search request message to the first elastic search server through the API interface server.
  • the transit server receives a feedback message that the first elastic search server cluster is out of the network abnormality, in this embodiment of the application, the following steps may be further included:
  • the search request message is sent to a second elastic search server in a second elastic search server cluster in the at least one elastic search server cluster, where the second elastic search server cluster and the first elastic search server cluster are located Different computer rooms.
  • the transit server can write the same search request message to different elastic search server clusters. If the first elastic search server cluster goes out of the network abnormally, the transit server can also send the search request message to the second elastic search server cluster.
  • the second elastic search server can be any server in the second elastic search server cluster, so that it can ensure that the search request data sent by the user through the terminal device can be accessed successfully, and the elastic search server cluster is minimized. The unavailable situation arises.
  • the data transmission method described in the embodiment of this application is applied to a transit server in a data transmission system.
  • the data transmission system also includes a terminal device, a gateway server, a storage server, and at least one elastic search server cluster. Send a subscription request to the storage server; and read the search request message from the message queue of the storage server.
  • the search request message carries search request data.
  • the search request message is sent by the terminal device to the gateway server, and then the gateway server
  • the search request message is generated according to the search request data and then written into the message queue of the storage server; the search request message is sent to the first elastic search server in at least one elastic search server cluster, and the first elastic search server is at least one elastic search server cluster
  • the entire elastic search server cluster is unstable or unavailable.
  • the search request data is stored in the message queue, the trace of the message can be traced back for each search request data. When the elastic search server cluster is abnormal, it can also be retrieved from the message queue again. Read the search request data for fault recovery.
  • FIG. 3 is a schematic flowchart of a data transmission method disclosed in an embodiment of the present application.
  • the data transmission system may include a terminal device, a gateway server, a storage server, a transit server, and at least one elastic search server cluster.
  • the data transmission method includes the following steps:
  • the terminal device sends search request data to a gateway server.
  • the gateway server generates a search request message according to the search request data.
  • the gateway server sends the search request message to a storage server.
  • the storage server writes the search request message into a message queue.
  • the transit server sends a subscription request to the storage server.
  • the transit server reads the search request message from the message queue of the storage server.
  • the data transmission method described in the embodiment of the present application sends search request data to a gateway server through a terminal device, the gateway server generates a search request message according to the search request data, and the gateway server sends the search request message
  • the storage server writes the search request message into a message queue
  • the transit server sends a subscription request to the storage server
  • the transit server reads the search request message from the message queue of the storage server
  • the search request message is sent to a first elastic search server in the at least one elastic search server cluster
  • the first elastic search server is any server in the at least one elastic search server cluster.
  • the search request data is stored in the message queue and read by the transit server, which can improve the availability of the elastic search server cluster and avoid the large amount of data written in the search request data, which may make the entire elastic search server cluster unstable or unavailable
  • the search request data is stored in the message queue, the message track can be traced back for each search request data.
  • the search request data can also be read from the message queue again for failure recovery.
  • FIG. 4A is a schematic structural diagram of a storage server disclosed in an embodiment of the present application.
  • the storage server includes a processor, a memory, a communication interface, and one or more programs. Or multiple programs are stored in the above-mentioned memory and are configured to be executed by the above-mentioned processor, and the above-mentioned programs include instructions for executing the following steps:
  • the search request message carrying search request data
  • the search request message is sent by the terminal device to the gateway server, and then the gateway server A message generated according to the search request data;
  • the first elastic search server in, the first elastic search server is any server in the at least one elastic search server cluster.
  • the search request data includes elastic search server cluster information and index name information to which the search request data belongs.
  • a mapping relationship between the name of the message set corresponding to the search request message and the name of the elastic search server cluster and the index is established.
  • Figure 4B is a schematic structural diagram of a transit server disclosed in an embodiment of the present application.
  • the transit server includes a processor, a memory, a communication interface, and one or more programs. Or multiple programs are stored in the above-mentioned memory and are configured to be executed by the above-mentioned processor, and the above-mentioned programs include instructions for executing the following steps:
  • the search request message is sent to a first elastic search server in the at least one elastic search server cluster, where the first elastic search server is any server in the at least one elastic search server cluster.
  • the above program includes instructions for executing the following steps:
  • the message set is read from the message queue of the storage server, and the message set includes the search request message.
  • the above program also includes instructions for performing the following steps:
  • the health status data includes at least one of the following health status sub-data: indexing rate, indexing time, memory size, number of request rejections, where: Each of the health status sub-data corresponds to a parameter threshold;
  • the search request data includes elastic search server cluster information, and in terms of sending the search request message to the first elastic search server in the at least one elastic search server cluster, the above program includes Instructions to perform the following steps:
  • the search request data includes elastic search server cluster information and elastic search engine version information, and in the sending of the search request message to the first elastic search server cluster in the at least one elastic search server cluster
  • the above program includes instructions for performing the following steps:
  • the elastic search server corresponding to the version information is used as the first elastic search server, and the search request message is sent to the first elastic search server.
  • the transit server includes an SDK interface or an API interface
  • the above program includes instructions for executing the following steps:
  • the search request message is sent to the first elastic search server through the API interface.
  • the above program further includes instructions for executing the following steps:
  • the search request message is sent to a second elastic search server in a second elastic search server cluster in the at least one elastic search server cluster, where the second elastic search server cluster and the first elastic search server cluster are located Different computer rooms.
  • an electronic device includes hardware structures and/or software modules corresponding to each function.
  • this application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a certain function is executed by hardware or computer software-driven hardware depends on the specific application and design constraint conditions of the technical solution. Professionals and technicians can use different methods for each specific application to implement the described functions, but such implementation should not be considered beyond the scope of this application.
  • the embodiment of the present application may divide the electronic device into functional units according to the foregoing method examples.
  • each functional unit may be divided corresponding to each function, or two or more functions may be integrated into one processing unit.
  • the above-mentioned integrated unit can be implemented in the form of hardware or software functional unit. It should be noted that the division of units in the embodiments of the present application is illustrative, and is only a logical function division, and there may be other division methods in actual implementation.
  • FIG. 5 is a schematic structural diagram of a data transmission device disclosed in an embodiment of the present application, which is applied to a storage server in a data transmission system.
  • An elastic search server cluster The data transmission system also includes a terminal device, a gateway server, a transit server, and at least one elastic search server cluster.
  • the data transmission device includes a receiving unit 501, a writing unit 502, and a first sending unit 503. ,
  • the receiving unit 501 is configured to receive a search request message sent by the gateway server, where the search request message carries search request data, and the search request message is used by the terminal device to send the search request data to the gateway. Server, and then a message generated by the gateway server according to the search request data;
  • the writing unit 502 is configured to write the search request message into a message queue
  • the receiving unit 501 is further configured to receive a subscription request sent by the transit server;
  • the first sending unit 503 is configured to send the search request message to the transit server according to the subscription request, and instruct the transit server to send the search request message to the at least one elastic search server cluster
  • the first elastic search server in, the first elastic search server is any server in the at least one elastic search server cluster.
  • the search request data includes elastic search server cluster information and index name information to which the search request data belongs.
  • the writing unit 502 specifically uses At:
  • a mapping relationship between the name of the message set corresponding to the search request message and the name of the elastic search server cluster and the index is established.
  • the data transmission device described in the embodiment of this application sends a subscription request to the storage server; and reads the search request message from the message queue of the storage server.
  • the search request message carries the search request data
  • the search request message is
  • the terminal device sends the search request data to the gateway server, and then the gateway server generates a search request message according to the search request data and writes it to the message queue of the storage server; the search request message is sent to the first in at least one elastic search server cluster
  • An elastic search server is any server in at least one elastic search server cluster. In this way, the elastic search server can be improved by storing the search request data in the message queue and reading it by the relay server.
  • the availability of the cluster prevents the entire elastic search server cluster from being unstable or unavailable due to the large amount of data written in the search request data.
  • the search request data is stored in the message queue, it is possible to backtrack the message for each search request data Track, when the elastic search server cluster is abnormal, you can also read the search request data from the message queue again to recover from the failure.
  • each "unit” may be, for example, an integrated circuit ASIC, a single circuit, used to execute one or more software or firmware.
  • Program processor shared, dedicated or chipset
  • memory combinatorial logic circuit, and/or provide other suitable components for realizing the above-mentioned functions.
  • the receiving unit 501, the writing unit 502, and the first sending unit 503 may be a control circuit or a processor.
  • FIG. 6A is a schematic structural diagram of a data transmission device disclosed in an embodiment of the present application, which is applied to a transit server in a data transmission system.
  • An elastic search server cluster the data transmission device includes a second sending unit 601 and a reading unit 602, wherein:
  • the second sending unit 601 is configured to send a subscription request to the storage server
  • the reading unit 602 is configured to read a search request message from a message queue of the storage server, the search request message carries search request data, and the search request message is sent by the terminal device. Data to the gateway server, and then the gateway server generates the search request message according to the search request data and writes it into the message queue of the storage server;
  • the second sending unit 602 is further configured to send the search request message to a first elastic search server in the at least one elastic search server cluster, where the first elastic search server is the at least one elastic search server Any server in the cluster.
  • the reading unit is specifically configured to:
  • the message set is read from the message queue of the storage server, and the message set includes the search request message.
  • FIG. 6B is a modified structure of the data transmission device shown in FIG. 6A. Compared with FIG. 6A, it may further include: an acquiring unit 603 and a determining unit 604, where
  • the acquiring unit 603 is configured to acquire health status data of all elastic search servers in the at least one elastic search server cluster, where the health status data includes at least one of the following health status sub-data: indexing rate, indexing time, memory Size and the number of request rejections, where each of the health status sub-data corresponds to a parameter threshold;
  • the determining unit 604 is configured to determine whether there is a health status sub-data that exceeds a corresponding parameter threshold in the health status data, if not, the reading unit 602 executes the message queue from the storage server Read the search request message in the operation.
  • the search request data includes elastic search server cluster information, and in the aspect of sending the search request message to the first elastic search server in the at least one elastic search server cluster, the second sending unit Specifically used for:
  • the search request data includes elastic search server cluster information and version information of an elastic search engine, in the aspect of sending the search request message to the first elastic search server in the at least one elastic search server cluster ,
  • the second sending unit 601 is specifically configured to:
  • the elastic search server corresponding to the version information is used as the first elastic search server, and the search request message is sent to the first elastic search server.
  • the transit server includes an SDK interface or an API interface, and in terms of sending the search request message to the first elastic search server, the second sending unit 601 is specifically configured to:
  • the search request message is sent to the first elastic search server through the API interface.
  • the second sending unit 601 is further configured to:
  • the search request message is sent to a second elastic search server in a second elastic search server cluster in the at least one elastic search server cluster, where the second elastic search server cluster and the first elastic search server cluster are located Different computer rooms.
  • the data transmission device described in the embodiment of this application sends a subscription request to the storage server; and reads the search request message from the message queue of the storage server.
  • the search request message carries the search request data
  • the search request message is
  • the terminal device sends the search request data to the gateway server, and then the gateway server generates a search request message according to the search request data and writes it to the message queue of the storage server; the search request message is sent to the first in at least one elastic search server cluster
  • An elastic search server is any server in at least one elastic search server cluster. In this way, the elastic search server can be improved by storing the search request data in the message queue and reading it by the relay server.
  • the availability of the cluster prevents the entire elastic search server cluster from being unstable or unavailable due to the large amount of data written in the search request data.
  • the search request data is stored in the message queue, it is possible to backtrack the message for each search request data Track, when the elastic search server cluster is abnormal, you can also read the search request data from the message queue again to recover from the failure.
  • each "unit” may be, for example, an integrated circuit ASIC, a single circuit, used to execute one or more software or firmware.
  • Program processor shared, dedicated or chipset
  • memory combinatorial logic circuit, and/or provide other suitable components for realizing the above-mentioned functions.
  • the second sending unit 601, the reading unit 602, the acquiring unit 603, and the determining unit 603 may be a control circuit or a processor.
  • An embodiment of the present application also provides a computer storage medium, wherein the computer storage medium stores a computer program for electronic data exchange, and the computer program causes a computer to execute a part of any data transmission method as described in the above method embodiment. Or all steps.
  • the embodiments of the present application also provide a computer program product.
  • the computer program product includes a non-transitory computer-readable storage medium storing a computer program.
  • the computer program is operable to cause a computer to execute the method described in the foregoing method embodiment. Part or all of the steps of any data transmission method.
  • the disclosed device may be implemented in other ways.
  • the device embodiments described above are merely illustrative, for example, the division of the units is only a logical function division, and there may be other divisions in actual implementation, for example, multiple units or components may be combined or may be Integrate into another system, or some features can be ignored or not implemented.
  • the displayed or discussed mutual coupling or direct coupling or communication connection may be indirect coupling or communication connection through some interfaces, devices or units, and may be in electrical or other forms.
  • the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the objectives of the solutions of the embodiments.
  • the functional units in the various embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units may be integrated into one unit.
  • the above-mentioned integrated unit can be implemented in the form of hardware or in the form of software program modules.
  • the integrated unit is implemented in the form of a software program module and sold or used as an independent product, it can be stored in a computer readable memory.
  • the technical solution of the present application essentially or the part that contributes to the existing technology or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a memory.
  • a number of instructions are included to enable a computer device (which may be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in the various embodiments of the present application.
  • the foregoing memory includes: U disk, read-only memory (read-only memory, ROM), random access memory (random access memory, RAM), mobile hard disk, magnetic disk or optical disk and other media that can store program codes.
  • the program can be stored in a computer-readable memory, and the memory can include: a flash disk , ROM, RAM, magnetic disk or CD, etc.

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The embodiments of the present application disclose a data transmission method and apparatus, being applied to a storage server in a data transmission system. The data transmission system further comprises a terminal device, a gateway server, a transit server, and at least one elastic search server cluster. Storing search request data in a message queue for reading by the transit server can improve the availability of the elastic search server cluster, avoiding unstability or unavailability of the entire elastic search server cluster caused by large amount of data written into the search request data; in addition, as the search request data is stored in the message queue, the trajectory of the message can be traced back for each piece of search request data, and when the elastic search server cluster is anomalous, the search request data may also be re-read from the message queue, so as to perform fault recovery.

Description

数据传输方法及装置Data transmission method and device 技术领域Technical field
本申请涉及电子技术领域,具体涉及一种数据传输方法及装置。This application relates to the field of electronic technology, in particular to a data transmission method and device.
背景技术Background technique
目前,用户的终端设备使用弹性搜索(elastic search,Es)引擎提供的表现层状态转换应用程序接口(representational state transfer-ful application programming interface,restful api)或客户软件开发数据包(client software development kit,client SDK接口),直接将搜索请求数据插入或更新到弹性搜索服务器的索引中。将搜索请求数据写入弹性搜索服务器时,使用put接口一次可提交多个文档数据,使用bulk接口一次可提交一个文档数据。At present, the user’s terminal equipment uses the representational state transfer-ful application programming interface (restful api) provided by the elastic search (Es) engine or the client software development kit (client software development kit, client SDK interface), directly insert or update the search request data into the index of the elastic search server. When writing search request data to the elastic search server, you can use the put interface to submit multiple document data at a time, and use the bulk interface to submit one document data at a time.
使用现有的方式接入弹性搜索服务器,搜索请求数据的提交速度和数据量完全取决于终端设备调用接口的频率和每次请求传入的数据总数(使用bulk接口)。在弹性搜索服务器集群可用资源较少的情况下,如果用户的终端设备写入速度过大,大概率会造成弹性搜索服务器集群不稳定,甚至是导致弹性搜索服务器集群不可用,从而,降低了使用弹性搜索服务器集群提供的数据写入或搜索服务的可用性,难以保证弹性搜索服务器集群中的弹性搜索服务器对可用时长的要求。Using the existing method to access the elastic search server, the submission speed and data volume of the search request data completely depend on the frequency of the terminal device calling the interface and the total number of data passed in each request (using the bulk interface). In the case that the elastic search server cluster has fewer resources available, if the user’s terminal device write speed is too high, there is a high probability that the elastic search server cluster will become unstable, or even cause the elastic search server cluster to be unavailable, thereby reducing usage The availability of data writing or search services provided by the elastic search server cluster is difficult to guarantee the availability of the elastic search server in the elastic search server cluster.
发明内容Summary of the invention
本申请实施例提供了一种数据传输方法及装置,能够提高弹性搜索服务器集群的可用性,避免因为搜索请求数据写入的数据量较大,致使整个弹性搜索服务器集群不稳定或不可用。The embodiments of the present application provide a data transmission method and device, which can improve the availability of an elastic search server cluster, and avoid that the entire elastic search server cluster is unstable or unavailable due to the large amount of data written in the search request data.
第一方面,本申请实施例提供一种数据传输方法,应用于数据传输系统中的存储服务器,所述数据传输系统还包括终端设备、网关服务器、中转服务器和至少一个弹性搜索服务器集群,所述方法包括:In the first aspect, an embodiment of the present application provides a data transmission method, which is applied to a storage server in a data transmission system. The data transmission system further includes a terminal device, a gateway server, a transit server, and at least one elastic search server cluster. Methods include:
接收所述网关服务器发送的搜索请求消息,所述搜索请求消息携带搜索请求数据,所述搜索请求消息是由所述终端设备发送所述搜索请求数据至所述网关服务器,然后由所述网关服务器根据所述搜索请求数据生成的消息;Receiving a search request message sent by the gateway server, the search request message carrying search request data, the search request message is sent by the terminal device to the gateway server, and then the gateway server A message generated according to the search request data;
将所述搜索请求消息写入消息队列;Writing the search request message into a message queue;
接收所述中转服务器发送的订阅请求,根据所述订阅请求将所述搜索请求消息发送至所述中转服务器,并指示所述中转服务器将所述搜索请求消息发送至所述至少一个弹性搜索服务器集群中的第一弹性搜索服务器,所述第一弹性搜索服务器为所述至少一个弹性搜索服务器集群中的任一服务器。Receive a subscription request sent by the transit server, send the search request message to the transit server according to the subscription request, and instruct the transit server to send the search request message to the at least one elastic search server cluster The first elastic search server in, the first elastic search server is any server in the at least one elastic search server cluster.
第二方面,本申请实施例提供一种数据传输方法,应用于数据传输系统中的中转服务器,所述数据传输系统还包括终端设备、网关服务器、存储服务器和至少一个弹性搜索服务器集群,所述方法包括:In a second aspect, an embodiment of the present application provides a data transmission method, which is applied to a transit server in a data transmission system. The data transmission system further includes a terminal device, a gateway server, a storage server, and at least one elastic search server cluster. Methods include:
向所述存储服务器发送订阅请求;并从所述存储服务器的消息队列中读取搜索请求消息,所述搜索请求消息携带搜索请求数据,所述搜索请求消息是由所述终端设备发送所述搜索请求数据至所述网关服务器,然后由所述网关服务器根据所述搜索请求数据生成所述搜索请求消息后写入所述存储服务器的消息队列的;Send a subscription request to the storage server; and read a search request message from the message queue of the storage server, the search request message carries search request data, and the search request message is sent by the terminal device to the search Request data to the gateway server, and then the gateway server generates the search request message according to the search request data and writes it to the message queue of the storage server;
将所述搜索请求消息发送至所述至少一个弹性搜索服务器集群中的第一弹性搜索服 务器,所述第一弹性搜索服务器为所述至少一个弹性搜索服务器集群中的任一服务器。The search request message is sent to a first elastic search server in the at least one elastic search server cluster, where the first elastic search server is any server in the at least one elastic search server cluster.
第三方面,本申请实施例提供了一种数据传输装置,应用于数据传输系统中的存储服务器,所述数据传输系统还包括终端设备、网关服务器、中转服务器和至少一个弹性搜索服务器集群,所述数据传输装置包括:In a third aspect, an embodiment of the present application provides a data transmission device, which is applied to a storage server in a data transmission system, and the data transmission system further includes a terminal device, a gateway server, a transit server, and at least one elastic search server cluster, so The data transmission device includes:
接收单元,用于接收所述网关服务器发送的搜索请求消息,所述搜索请求消息携带搜索请求数据,所述搜索请求消息是由所述终端设备发送所述搜索请求数据至所述网关服务器,然后由所述网关服务器根据所述搜索请求数据生成的消息;The receiving unit is configured to receive a search request message sent by the gateway server, the search request message carries search request data, and the search request message is the terminal device sending the search request data to the gateway server, and then A message generated by the gateway server according to the search request data;
写入单元,用于将所述搜索请求消息写入消息队列;A writing unit for writing the search request message into the message queue;
所述接收单元,还用于接收所述中转服务器发送的订阅请求;The receiving unit is further configured to receive a subscription request sent by the transit server;
第一发送单元,用于根据所述订阅请求将所述搜索请求消息发送至所述中转服务器,并指示所述中转服务器将所述搜索请求消息发送至所述至少一个弹性搜索服务器集群中的第一弹性搜索服务器,所述第一弹性搜索服务器为所述至少一个弹性搜索服务器集群中的任一服务器。The first sending unit is configured to send the search request message to the transit server according to the subscription request, and instruct the transit server to send the search request message to the first in the at least one elastic search server cluster An elastic search server, and the first elastic search server is any server in the at least one elastic search server cluster.
第四方面,本申请实施例提供了一种数据传输装置,应用于数据传输系统中的中转服务器,所述数据传输系统还包括终端设备、网关服务器、存储服务器和至少一个弹性搜索服务器集群,所述数据传输装置包括:In a fourth aspect, an embodiment of the present application provides a data transmission device, which is applied to a transit server in a data transmission system, and the data transmission system further includes a terminal device, a gateway server, a storage server, and at least one elastic search server cluster, so The data transmission device includes:
第二发送单元,用于向所述存储服务器发送订阅请求;The second sending unit is configured to send a subscription request to the storage server;
读取单元,用于从所述存储服务器的消息队列中读取搜索请求消息,所述搜索请求消息携带搜索请求数据,所述搜索请求消息是由所述终端设备发送所述搜索请求数据至所述网关服务器,然后由所述网关服务器根据所述搜索请求数据生成所述搜索请求消息后写入所述存储服务器的消息队列的;The reading unit is configured to read a search request message from the message queue of the storage server, the search request message carries search request data, and the search request message is sent by the terminal device to the search request data. The gateway server, then the gateway server generates the search request message according to the search request data and writes it into the message queue of the storage server;
所述第二发送单元,还用于将所述搜索请求消息发送至所述至少一个弹性搜索服务器集群中的第一弹性搜索服务器,所述第一弹性搜索服务器为所述至少一个弹性搜索服务器集群中的任一服务器。The second sending unit is further configured to send the search request message to a first elastic search server in the at least one elastic search server cluster, where the first elastic search server is the at least one elastic search server cluster Any server in.
第五方面,本申请实施例提供一种存储服务器,包括处理器、存储器、通信接口,以及一个或多个程序,其中,上述一个或多个程序被存储在上述存储器中,并且被配置由上述处理器执行,上述程序包括用于执行本申请实施例第一方面中的步骤的指令。In a fifth aspect, an embodiment of the present application provides a storage server, including a processor, a memory, a communication interface, and one or more programs, wherein the one or more programs are stored in the memory and are configured by the above Executed by the processor, and the foregoing program includes instructions for executing the steps in the first aspect of the embodiments of the present application.
第六方面,本申请实施例提供一种中转服务器,包括处理器、存储器、通信接口,以及一个或多个程序,其中,上述一个或多个程序被存储在上述存储器中,并且被配置由上述处理器执行,上述程序包括用于执行本申请实施例第二方面中的步骤的指令。In a sixth aspect, an embodiment of the present application provides a transit server, including a processor, a memory, a communication interface, and one or more programs, wherein the one or more programs are stored in the memory and are configured by the above Executed by the processor, and the foregoing program includes instructions for executing the steps in the second aspect of the embodiments of the present application.
第七方面,本申请实施例提供了一种计算机可读存储介质,其中,上述计算机可读存储介质存储用于电子数据交换的计算机程序,其中,上述计算机程序使得计算机执行如本申请实施例第一方面或第二方面中所描述的部分或全部步骤。In a seventh aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the above-mentioned computer-readable storage medium stores a computer program for electronic data exchange, wherein the above-mentioned computer program enables a computer to execute Some or all of the steps described in one aspect or the second aspect.
第八方面,本申请实施例提供了一种计算机程序产品,其中,上述计算机程序产品包括存储了计算机程序的非瞬时性计算机可读存储介质,上述计算机程序可操作来使计算机执行如本申请实施例第一方面或第二方面中所描述的部分或全部步骤。该计算机程序产品可以为一个软件安装包。In an eighth aspect, the embodiments of the present application provide a computer program product, wherein the above-mentioned computer program product includes a non-transitory computer-readable storage medium storing a computer program, and the above-mentioned computer program is operable to cause a computer to execute as implemented in this application. Examples include part or all of the steps described in the first aspect or the second aspect. The computer program product may be a software installation package.
附图说明Description of the drawings
为了更清楚地说明本申请实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings that need to be used in the description of the embodiments or the prior art. Obviously, the drawings in the following description are only These are some embodiments of the present application. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative work.
图1A是本申请实施例提供的一种用于实现数据传输方法的数据传输系统的架构示意图;FIG. 1A is a schematic structural diagram of a data transmission system for implementing a data transmission method according to an embodiment of the present application;
图1B是本申请实施例公开的一种数据传输方法的流程示意图;FIG. 1B is a schematic flowchart of a data transmission method disclosed in an embodiment of the present application;
图1C是本申请实施例提供的一种将所述搜索请求消息写入消息队列的演示示意图;FIG. 1C is a schematic diagram of a demonstration of writing the search request message into a message queue according to an embodiment of the present application;
图1D是本申请实施例提供的一种消息集合名称与弹性搜索服务器集群和索引名称之间的映射关系的演示示意图;FIG. 1D is a schematic diagram illustrating a mapping relationship between a message collection name and an elastic search server cluster and index name provided by an embodiment of the present application;
图2是本申请实施例公开的另一种数据传输方法的流程示意图;FIG. 2 is a schematic flowchart of another data transmission method disclosed in an embodiment of the present application;
图3是本申请实施例公开的另一种数据传输方法的流程示意图;FIG. 3 is a schematic flowchart of another data transmission method disclosed in an embodiment of the present application;
图4A是本申请实施例公开的另一种存储服务器的结构示意图;4A is a schematic structural diagram of another storage server disclosed in an embodiment of the present application;
图4B是本申请实施例公开的另一种中转服务器的结构示意图;4B is a schematic structural diagram of another transit server disclosed in an embodiment of the present application;
图5是本申请实施例公开的一种数据传输装置的结构示意图;FIG. 5 is a schematic structural diagram of a data transmission device disclosed in an embodiment of the present application;
图6A是本申请实施例公开的另一种数据传输装置的结构示意图;6A is a schematic structural diagram of another data transmission device disclosed in an embodiment of the present application;
图6B是本申请实施例公开的图6A所示的数据传输装置的变型结构。FIG. 6B is a modified structure of the data transmission device shown in FIG. 6A disclosed in an embodiment of the present application.
具体实施方式Detailed ways
为了使本技术领域的人员更好地理解本申请方案,下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。In order to enable those skilled in the art to better understand the solutions of the application, the technical solutions in the embodiments of the application will be clearly and completely described below in conjunction with the drawings in the embodiments of the application. Obviously, the described embodiments are only It is a part of the embodiments of the present application, but not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by those of ordinary skill in the art without creative work shall fall within the protection scope of this application.
本申请的说明书和权利要求书及上述附图中的术语“第一”、“第二”等是用于区别不同对象,而不是用于描述特定顺序。此外,术语“包括”和“具有”以及它们任何变形,意图在于覆盖不排他的包含。例如包含了一系列步骤或单元的过程、方法、系统、产品或设备没有限定于已列出的步骤或单元,而是可选地还包括没有列出的步骤或单元,或可选地还包括对于这些过程、方法、产品或设备固有的其他步骤或单元。The terms "first", "second", etc. in the specification and claims of this application and the above-mentioned drawings are used to distinguish different objects, rather than to describe a specific sequence. In addition, the terms "including" and "having" and any variations of them are intended to cover non-exclusive inclusions. For example, a process, method, system, product, or device that includes a series of steps or units is not limited to the listed steps or units, but optionally includes unlisted steps or units, or optionally also includes Other steps or units inherent to these processes, methods, products or equipment.
在本文中提及“实施例”意味着,结合实施例描述的特定特征、结构或特性可以包含在本申请的至少一个实施例中。在说明书中的各个位置出现该短语并不一定均是指相同的实施例,也不是与其它实施例互斥的独立的或备选的实施例。本领域技术人员显式地和隐式地理解的是,本文所描述的实施例可以与其它实施例相结合。The reference to "embodiments" herein means that a specific feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various places in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment mutually exclusive with other embodiments. Those skilled in the art clearly and implicitly understand that the embodiments described herein can be combined with other embodiments.
为了便于更好的理解本发明所描述的技术方案,下面对本发明实施例所涉及的技术术语进行解释:In order to facilitate a better understanding of the technical solutions described in the present invention, the technical terms involved in the embodiments of the present invention are explained below:
弹性搜索(elastic search,Es)服务器:Es服务器是一个基于Lucene引擎的搜索服务器,提供一个分布式多用户能力的全文搜索引擎,是一种支持高可用,可扩展的搜索引擎框架。Elastic search (Es) server: The Es server is a search server based on the Lucene engine. It provides a full-text search engine with distributed multi-user capabilities. It is a highly available and scalable search engine framework.
消息队列(Message queue,MQ):是基础数据结构中的“先进先出”的一种数据机构。Message queue (MQ): It is a "first in, first out" data organization in the basic data structure.
表现层状态转化应用程序接口(representational state transfer-ful application programming interface,restful api):表现层状态转换应用程序接口,具有设计提供万维网络服务的软件构建风格。Presentation layer state transfer-ful application programming interface (representational state transfer-ful application programming interface, restful api): Presentation layer state transfer application programming interface, with a software construction style designed to provide web services.
软件开发工具包(software development kit,SDK):一般是一些被软件工程师用于为特定的软件包、软件框架、硬件平台、操作系统等创建应用软件的开发工具的集。Software development kit (SDK): Generally, it is a collection of development tools used by software engineers to create application software for specific software packages, software frameworks, hardware platforms, and operating systems.
本申请实施例涉及的终端设备可以包括各种具有无线通信功能的手持设备(如手机、平板电脑等)、车载设备、可穿戴设备、计算设备或连接到无线调制解调器的其他处理设备,以及各种形式的用户设备(User Equipment,UE),移动台(Mobile Station,MS)等等。The terminal devices involved in the embodiments of this application may include various handheld devices with wireless communication functions (such as mobile phones, tablet computers, etc.), vehicle-mounted devices, wearable devices, computing devices, or other processing devices connected to wireless modems, as well as various Forms of User Equipment (User Equipment, UE), Mobile Station (Mobile Station, MS), and so on.
下面对本申请实施例进行详细介绍。The following describes the embodiments of the application in detail.
本申请实施例提供的数据传输方法适用于用户的终端设备通过搜索请求数据访问弹性搜索服务器的场景。请参见图1A,是本发明实施例提供的一种用于实现数据传输方法的数据传输系统的架构示意图。该数据传输系统可以包括终端设备1001、网关服务器1002、存储服务器1003、中转服务器1004和至少一个弹性搜索服务器集群,至少一个弹性搜索服务器集群中每一弹性搜索服务器集群包括多个弹性搜索服务器1004,其中,终端设备1001是用户使用的客户端设备,网关服务器1002与终端设备1001连接,终端设备1001不直接向弹性搜索服务器集群发送搜索请求数据,而是向网关服务器1002发送搜索请求数据,存储服务器1003与网关服务器1002连接,网关服务器1002将接收到的搜索请求数据以搜索请求消息的形式写入存储服务器1003中,存储服务器1003将搜索请求消息写入消息队列,存储服务器1003还与中转服务器1004连接,中转服务器1004通过向存储服务器1003发送订阅消息,并从存储服务器1003中读取搜索请求消息,然后,中转服务器1004将读取的搜索请求消息发送至弹性搜索服务器集群中的弹性搜索服务器1005,从而实现用户的终端设备对弹性搜索服务器集群的访问。The data transmission method provided in the embodiments of the present application is applicable to a scenario where a user's terminal device accesses an elastic search server through search request data. Please refer to FIG. 1A, which is a schematic structural diagram of a data transmission system for implementing a data transmission method according to an embodiment of the present invention. The data transmission system may include a terminal device 1001, a gateway server 1002, a storage server 1003, a transit server 1004, and at least one elastic search server cluster. Each elastic search server cluster in the at least one elastic search server cluster includes multiple elastic search servers 1004, The terminal device 1001 is a client device used by the user. The gateway server 1002 is connected to the terminal device 1001. The terminal device 1001 does not directly send search request data to the elastic search server cluster, but sends the search request data to the gateway server 1002. The storage server 1003 is connected to the gateway server 1002. The gateway server 1002 writes the received search request data in the form of a search request message into the storage server 1003. The storage server 1003 writes the search request message into the message queue. The storage server 1003 also communicates with the transit server 1004. Connect, the transit server 1004 sends a subscription message to the storage server 1003, and reads the search request message from the storage server 1003, and then the transit server 1004 sends the read search request message to the elastic search server 1005 in the elastic search server cluster , So as to realize the user's terminal equipment to access the elastic search server cluster.
请参阅图1B,图1B是本申请实施例公开的一种数据传输方法的流程示意图,应用于数据传输系统中的存储服务器,所述数据传输系统还包括终端设备、网关服务器、中转服务器和至少一个弹性搜索服务器集群,该数据传输方法包括如下步骤:Please refer to FIG. 1B. FIG. 1B is a schematic flowchart of a data transmission method disclosed in an embodiment of the present application, which is applied to a storage server in a data transmission system. An elastic search server cluster, the data transmission method includes the following steps:
101、接收所述网关服务器发送的搜索请求消息,所述搜索请求消息携带搜索请求数据,所述搜索请求消息是由所述终端设备发送所述搜索请求数据至所述网关服务器,然后由所述网关服务器根据所述搜索请求数据生成的消息。101. Receive a search request message sent by the gateway server, where the search request message carries search request data, and the search request message is sent by the terminal device to the gateway server, and then the search request message is sent by the terminal device to the gateway server. A message generated by the gateway server according to the search request data.
本申请实施例中,当用户通过终端设备访问弹性搜索服务器集群时,终端设备的用户服务可向网关服务器发送搜索请求数据,然后,网关服务器根据搜索请求数据生成搜索请求消息,并将搜索请求消息发送至存储服务器,从而,存储服务器可接收网关服务器发送的搜索请求消息。In the embodiment of this application, when a user accesses the elastic search server cluster through a terminal device, the user service of the terminal device can send search request data to the gateway server, and then the gateway server generates a search request message according to the search request data, and sends the search request message Sent to the storage server, so that the storage server can receive the search request message sent by the gateway server.
其中,终端设备可预先注册用户服务,在注册用户服务时,终端设备可预先获取索引对应的弹性搜索服务器集群信息,从而,终端设备可以在需要进行搜索访问时,向网关服务器发送携带弹性搜索服务器集群信息的搜索请求消息。Among them, the terminal device can pre-register the user service. When registering the user service, the terminal device can obtain the elastic search server cluster information corresponding to the index in advance, so that the terminal device can send the elastic search server to the gateway server when it needs search access. Search request message for cluster information.
102、将所述搜索请求消息写入消息队列。102. Write the search request message to a message queue.
其中,存储服务器可接收网关服务器发送的不同的搜索请求消息,从而,存储服务器可按照接收搜索请求消息的顺序将搜索请求消息依次写入消息队列。The storage server can receive different search request messages sent by the gateway server, so that the storage server can sequentially write the search request messages into the message queue according to the order in which the search request messages are received.
可选地,所述搜索请求数据包括弹性搜索服务器集群信息和所述搜索请求数据所属的索引名称信息,上述步骤102中,所述将所述搜索请求消息写入消息队列,可包括以下步骤:Optionally, the search request data includes elastic search server cluster information and index name information to which the search request data belongs. In step 102, writing the search request message to a message queue may include the following steps:
11、根据所述弹性搜索服务器集群信息和所述索引名称信息将所述搜索请求消息划分至消息集合;11. Divide the search request message into message sets according to the elastic search server cluster information and the index name information;
12、将所述消息集合写入所述消息队列;12. Write the message set to the message queue;
13、建立所述搜索请求消息对应的消息集合名称与弹性搜索服务器集群和索引名称之间的映射关系。13. Establish a mapping relationship between the name of the message set corresponding to the search request message and the name of the elastic search server cluster and the index.
[根据细则91更正 25.05.2020] 
请参阅图1C,图1C为本申请实施例提供的一种将所述搜索请求消息写入消息队列的演示示意图,其中,存储服务器根据索引名称和弹性搜索服务器集群信息将搜索请求消息与存储服务器接收到的具有相同索引名称和弹性搜索服务器集群信息的其他搜索请求消息划分至同一消息集合,从而,消息队列中的一个消息集合对应一个消息集合名称,每一个消息集合中的所有搜索请求消息具有相同的索引名称和弹性搜索服务器集群信息,存储服 务器还可建立搜索请求消息对应的消息集合名称与弹性搜索服务器集群和索引名称之间的映射关系,如图1D所示,图1D为本申请实施例提供的一种消息集合名称与弹性搜索服务器集群和索引名称之间的映射关系的演示示意图,其中,主题A、主题 B、主题C和主题 D为消息集合名称,C1、C2、C3...为弹性搜索服务器集群,V1、V2、V3...为索引名称,通过建立该映射关系,可使中转服务器在读取消息队列中的搜索请求消息时,同时能够读取到与搜索请求消息所属的消息集合对应的消息集合名称、弹性搜索服务器集群和索引名称。
[Correct 25.05.2020 according to Rule 91]
Please refer to FIG. 1C. FIG. 1C is a schematic diagram of writing the search request message into the message queue according to an embodiment of the application. The storage server sends the search request message to the storage server according to the index name and the elastic search server cluster information. Other received search request messages with the same index name and elastic search server cluster information are divided into the same message set, so that one message set in the message queue corresponds to one message set name, and all search request messages in each message set have With the same index name and elastic search server cluster information, the storage server can also establish a mapping relationship between the message set name corresponding to the search request message and the elastic search server cluster and index name, as shown in Figure 1D, which is implemented in this application The example provides a demonstration diagram of the mapping relationship between the name of the message collection and the elastic search server cluster and index name. Topic A, Topic B, Topic C, and Topic D are the names of the message collections, C1, C2, C3.. .It is an elastic search server cluster, V1, V2, V3... are index names. By establishing the mapping relationship, the transit server can read the search request message in the message queue at the same time. The name of the message collection, elastic search server cluster, and index name corresponding to the message collection to which it belongs.
103、接收所述中转服务器发送的订阅请求,根据所述订阅请求将所述搜索请求消息发送至所述中转服务器,并指示所述中转服务器将所述搜索请求消息发送至所述至少一个弹性搜索服务器集群中的第一弹性搜索服务器,所述第一弹性搜索服务器为所述至少一个弹性搜索服务器集群中的任一服务器。103. Receive a subscription request sent by the transit server, send the search request message to the transit server according to the subscription request, and instruct the transit server to send the search request message to the at least one elastic search The first elastic search server in the server cluster, where the first elastic search server is any server in the at least one elastic search server cluster.
其中,上述中转服务器例如可以是sink服务器。Wherein, the above-mentioned transit server may be, for example, a sink server.
其中,存储服务器可接收中转服务器发送的订阅请求,该订阅请求用于指示存储服务器将消息队列中的搜索请求消息发送至中转服务器。The storage server may receive a subscription request sent by the transit server, and the subscription request is used to instruct the storage server to send the search request message in the message queue to the transit server.
具体实施中,存储服务器可按照消息队列中消息集合的排列顺序读取搜索请求集合,由于消息队列中读取数据和写入数据遵循“先进先出”的规则,因此,可以保证读取消息队列的搜索请求数据和写入搜索请求数据的顺序一致。In specific implementation, the storage server can read the search request set according to the order of the message set in the message queue. Because the read data and write data in the message queue follow the "first in first out" rule, it can ensure that the message queue is read The order of the search request data and the write search request data is the same.
考虑到不同的用户会通过不同的多个终端设备对弹性搜索服务器集群进行访问,在搜索请求数据的数据量较大的情况下,通过消息队列可以存储部分搜索请求数据,针对当前弹性搜索服务器集群的负载情况,通过将搜索请求数据存储在消息队列中,由中转服务器读取的方式,可提高弹性搜索服务器集群的可用性,避免因为搜索请求数据写入的数据量较大,致使整个弹性搜索服务器集群不稳定或不可用,此外,由于搜索请求数据存储到了消息队列,可以针对每条搜索请求数据回溯消息的轨迹,当弹性搜索服务器集群异常时,也可以从消息队列中再次读取搜索请求数据,从而进行故障恢复。Considering that different users will access the elastic search server cluster through different multiple terminal devices, when the amount of search request data is large, part of the search request data can be stored through the message queue, which is specific to the current elastic search server cluster. By storing the search request data in the message queue and reading it by the transit server, the availability of the elastic search server cluster can be improved, and the large amount of data written in the search request data can be avoided to cause the entire elastic search server The cluster is unstable or unavailable. In addition, because the search request data is stored in the message queue, the message track can be traced back for each search request data. When the elastic search server cluster is abnormal, the search request data can be read again from the message queue. , So as to recover from the failure.
可以看出,本申请实施例中所描述的数据传输方法,应用于数据传输系统中的存储服务器,数据传输系统还包括终端设备、网关服务器、中转服务器和至少一个弹性搜索服务器集群,通过接收网关服务器发送的搜索请求消息,搜索请求消息携带搜索请求数据,搜索请求消息是由终端设备发送搜索请求数据至网关服务器,然后由网关服务器根据搜索请求数据生成的消息;将搜索请求消息写入消息队列;接收中转服务器发送的订阅请求,根据订阅请求将搜索请求消息发送至中转服务器,并指示中转服务器将搜索请求消息发送至至少一个弹性搜索服务器集群中的第一弹性搜索服务器,第一弹性搜索服务器为至少一个弹性搜索服务器集群中的任一服务器,如此,可通过将搜索请求数据存储在消息队列中,由中转服务器读取的方式,可提高弹性搜索服务器集群的可用性,避免因为搜索请求数据写入的数据量较大,致使整个弹性搜索服务器集群不稳定或不可用,此外,由于搜索请求数据存储到了消息队列,可以针对每条搜索请求数据回溯消息的轨迹,当弹性搜索服务器集群异常时,也可以从消息队列中再次读取搜索请求数据,从而进行故障恢复。It can be seen that the data transmission method described in the embodiment of this application is applied to a storage server in a data transmission system. The data transmission system also includes a terminal device, a gateway server, a transit server, and at least one elastic search server cluster. The search request message sent by the server. The search request message carries the search request data. The search request message is a message that the terminal device sends the search request data to the gateway server, and then the gateway server generates the search request data according to the search request data; writes the search request message into the message queue ; Receive the subscription request sent by the transit server, send the search request message to the transit server according to the subscription request, and instruct the transit server to send the search request message to the first elastic search server in at least one elastic search server cluster, the first elastic search server It is any server in at least one elastic search server cluster. In this way, the search request data can be stored in the message queue and read by the transit server, which can improve the availability of the elastic search server cluster and avoid writing data due to search requests. The large amount of imported data makes the entire elastic search server cluster unstable or unavailable. In addition, since the search request data is stored in the message queue, the trajectory of the message can be traced back for each search request data. When the elastic search server cluster is abnormal, You can also read the search request data from the message queue again to recover from the failure.
与上述一致地,图2是本申请实施例公开的一种数据传输方法的流程示意图。数据传输方法应用于数据传输系统中的中转服务器,所述数据传输系统还包括终端设备、网关服务器、存储服务器和至少一个弹性搜索服务器集群,该数据传输方法包括如下步骤:Consistent with the above, FIG. 2 is a schematic flowchart of a data transmission method disclosed in an embodiment of the present application. The data transmission method is applied to a transit server in a data transmission system. The data transmission system further includes a terminal device, a gateway server, a storage server, and at least one elastic search server cluster. The data transmission method includes the following steps:
201、向所述存储服务器发送订阅请求;并从所述存储服务器的消息队列中读取搜索请求消息,所述搜索请求消息携带搜索请求数据,所述搜索请求消息是由所述终端设备发送所述搜索请求数据至所述网关服务器,然后由所述网关服务器根据所述搜索请求数据生成所述搜索请求消息后写入所述存储服务器的消息队列的。201. Send a subscription request to the storage server; and read a search request message from the message queue of the storage server, the search request message carries search request data, and the search request message is sent by the terminal device. The search request data is sent to the gateway server, and then the gateway server generates the search request message according to the search request data and writes it into the message queue of the storage server.
具体实施中,当用户通过终端设备访问弹性搜索服务器集群时,终端设备的用户服务可向网关服务器发送搜索请求数据,然后,网关服务器根据搜索请求数据生成搜索请求消息,并将搜索请求消息发送至存储服务器,进而,服务器可将搜索请求消息写入消息队列,从而,中转服务器可以向存储服务器发送订阅请求;并从存储服务器的消息队列中读取搜索请求消息。In specific implementation, when a user accesses the elastic search server cluster through a terminal device, the user service of the terminal device can send search request data to the gateway server, and then the gateway server generates a search request message according to the search request data, and sends the search request message to The storage server, and further, the server can write the search request message into the message queue, so that the transit server can send a subscription request to the storage server; and read the search request message from the message queue of the storage server.
可选地,上述步骤201中,所述从所述存储服务器的消息队列中读取搜索请求消息,可包括如下步骤:Optionally, in the above step 201, reading the search request message from the message queue of the storage server may include the following steps:
按照所述消息队列中消息集合的排列顺序,从所述存储服务器的所述消息队列中读取所述消息集合,所述消息集合包括所述搜索请求消息。According to the sequence of the message sets in the message queue, the message set is read from the message queue of the storage server, and the message set includes the search request message.
其中,所述搜索请求数据包括弹性搜索服务器集群信息和所述搜索请求数据所属的索引名称信息,存储服务器在将搜索请求消息写入消息队列时,具体是根据所述弹性搜索服务器集群信息和所述索引名称信息将所述搜索请求消息划分至消息集合,然后将消息集合写入所述消息队列,从而,中转服务器可以按照消息队列中消息集合的排列顺序,从存储服务器的消息队列中读取所述消息集合。Wherein, the search request data includes elastic search server cluster information and index name information to which the search request data belongs. When the storage server writes the search request message into the message queue, it is specifically based on the elastic search server cluster information and all information. The index name information divides the search request message into message sets, and then writes the message sets into the message queue, so that the transit server can read from the message queue of the storage server according to the sequence of the message sets in the message queue The message collection.
可选地,上述步骤201中,在从所述存储服务器的消息队列中读取搜索请求消息之前,还可包括如下步骤:Optionally, in the foregoing step 201, before reading the search request message from the message queue of the storage server, the following steps may be further included:
2011、获取所述至少一个弹性搜索服务器集群中所有弹性搜索服务器的健康状态数据,所述健康状态数据包括以下至少一种健康状态子数据:索引速率、索引耗时、内存大小、请求拒绝数,其中,每一所述健康状态子数据对应一个参数阈值;2011. Acquire health status data of all elastic search servers in the at least one elastic search server cluster, where the health status data includes at least one of the following health status sub-data: indexing rate, indexing time, memory size, and request rejection number, Wherein, each of the health status sub-data corresponds to a parameter threshold;
2012、确定所述健康状态数据中是否存在超过对应参数阈值的健康状态子数据,若不存在,则执行所述从所述存储服务器的消息队列中读取搜索请求消息的操作。2012. Determine whether there is health state sub-data in the health state data that exceeds a corresponding parameter threshold, and if not, execute the operation of reading the search request message from the message queue of the storage server.
中转服务器可获取至少一个弹性搜索服务器集群中所有弹性搜索服务器当前的索引速率、索引耗时、内存大小、请求拒绝数,其中,索引速率是指所有弹性搜索服务器对应的多个索引速率的平均值,索引耗时是指所有弹性搜索服务器对应的多个索引耗时之和,内存大小是指所有弹性搜索服务器对应的多个内存大小之和,请求拒绝数是指所有弹性搜索服务器对应的多个请求拒绝数之和。中转服务器中还可预先设置索引速率对应的第一参数阈值,索引耗时对应的第二参数阈值、内存大小对应的第三参数阈值、请求拒绝数对应的第四参数阈值。然后分别确定索引速率、索引耗时、内存大小、请求拒绝数是否超过对应的参数阈值,若索引速率、索引耗时、内存大小、请求拒绝数均未超过对应的参数阈值,可从所述存储服务器的消息队列中读取搜索请求消息,若存在至少一个健康状态子数据超过对应的参数阈值,可暂停执行所述从所述存储服务器的消息队列中读取搜索请求消息的操作,从而,可动态控制读取搜索请求消息的读取速率,避免出现弹性搜索服务器集群因为写入请求量过大导致弹性搜索服务器集群不可用的情况。The transit server can obtain the current index rate, index time, memory size, and request rejections of all elastic search servers in at least one elastic search server cluster. The index rate refers to the average value of multiple index rates corresponding to all elastic search servers. , Index time consumption refers to the sum of multiple index time consumptions corresponding to all elastic search servers, memory size refers to the sum of multiple memory sizes corresponding to all elastic search servers, and the number of request rejections refers to multiple indexes corresponding to all elastic search servers. The sum of the number of rejected requests. The transit server may also preset the first parameter threshold corresponding to the index rate, the second parameter threshold corresponding to the time-consuming indexing, the third parameter threshold corresponding to the memory size, and the fourth parameter threshold corresponding to the number of request rejections. Then respectively determine whether the index rate, index time consumption, memory size, and request rejection number exceed the corresponding parameter threshold. If the index rate, index time consumption, memory size, and request rejection number do not exceed the corresponding parameter threshold, you can start from the storage The search request message is read from the message queue of the server. If there is at least one health status sub-data that exceeds the corresponding parameter threshold, the execution of the operation of reading the search request message from the message queue of the storage server can be suspended, so that Dynamically control the read rate of read search request messages to avoid the situation where the elastic search server cluster becomes unavailable due to excessive write requests.
202、将所述搜索请求消息发送至所述至少一个弹性搜索服务器集群中的第一弹性搜索服务器,所述第一弹性搜索服务器为所述至少一个弹性搜索服务器集群中的任一服务器。202. Send the search request message to a first elastic search server in the at least one elastic search server cluster, where the first elastic search server is any server in the at least one elastic search server cluster.
中转服务器可将读取的搜索请求消息发送至至少一个弹性搜索服务器集群中的第一弹性搜索服务器,其中,第一弹性搜索服务器可以是至少一个弹性搜索服务器集群中的任一服务器。The transit server may send the read search request message to the first elastic search server in the at least one elastic search server cluster, where the first elastic search server may be any server in the at least one elastic search server cluster.
可选地,所述搜索请求数据包括弹性搜索服务器集群信息,上述步骤202中,将所述搜索请求消息发送至所述至少一个弹性搜索服务器集群中的第一弹性搜索服务器,可包括如下步骤:Optionally, the search request data includes elastic search server cluster information. In step 202, sending the search request message to the first elastic search server in the at least one elastic search server cluster may include the following steps:
21、根据所述弹性搜索服务器集群信息确定所述至少一个弹性搜索服务器集群中的第一弹性搜索服务器集群;21. Determine the first elastic search server cluster in the at least one elastic search server cluster according to the elastic search server cluster information;
22、将所述搜索请求消息发送至所述第一弹性搜索服务器。22. Send the search request message to the first elastic search server.
其中,搜索请求数据中可包括该搜索请求数据将发送的弹性搜索服务器集群信息,从而,中专服务器可根据弹性搜索服务器集群信息确定至少一个弹性搜索服务器集群中的第一弹性搜索服务器集群,第一弹性搜索服务器集群为与弹性搜索服务器集群信息对应的弹性搜索服务器集群。然后,中转服务器可将搜索请求消息发送至第一弹性搜索服务器集群中的第一弹性搜索服务器,第一弹性搜索服务器可以为第一弹性搜索服务器集群中的任一服务器。Wherein, the search request data may include the elastic search server cluster information to be sent by the search request data. Therefore, the technical secondary school server may determine the first elastic search server cluster in the at least one elastic search server cluster according to the elastic search server cluster information. An elastic search server cluster is an elastic search server cluster corresponding to the elastic search server cluster information. Then, the transit server may send the search request message to the first elastic search server in the first elastic search server cluster, and the first elastic search server may be any server in the first elastic search server cluster.
可选地,所述搜索请求数据包括弹性搜索服务器集群信息和弹性搜索引擎的版本信息,上述步骤202中,将所述搜索请求消息发送至所述至少一个弹性搜索服务器集群中的第一弹性搜索服务器,可包括如下步骤:Optionally, the search request data includes elastic search server cluster information and version information of the elastic search engine. In step 202, the search request message is sent to the first elastic search in the at least one elastic search server cluster. The server can include the following steps:
23、根据所述弹性搜索服务器集群信息确定所述至少一个弹性搜索服务器集群中的第一弹性搜索服务器集群;23. Determine the first elastic search server cluster in the at least one elastic search server cluster according to the elastic search server cluster information;
24、确定所述第一弹性搜索服务器集群中与所述版本信息对应的弹性搜索服务器;24. Determine the elastic search server corresponding to the version information in the first elastic search server cluster;
25、将所述与所述版本信息对应的弹性搜索服务器作为所述第一弹性搜索服务器,将所述搜索请求消息发送至所述第一弹性搜索服务器。25. Use the elastic search server corresponding to the version information as the first elastic search server, and send the search request message to the first elastic search server.
其中,网关服务器可以支持多个弹性搜索引擎版本,搜索请求数据中可包括弹性搜索引擎的版本信息,进而,当搜索请求数据从终端设备发送至网关服务器,再经过存储服务器,到达中转服务器,中转服务器可根据搜索请求数据中弹性搜索引擎的版本信息确定第一弹性搜索服务器集群中与该版本信息对应的第一弹性搜索服务器。从而,可使终端设备的用户服务通过相同的接口操作不同版本的弹性搜索服务器集群,使后期在集群升级、版本切换过程中能够降低成本。Among them, the gateway server can support multiple versions of the elastic search engine, and the search request data can include the version information of the elastic search engine. Furthermore, when the search request data is sent from the terminal device to the gateway server, and then through the storage server, it reaches the transit server and is transited. The server may determine the first elastic search server corresponding to the version information in the first elastic search server cluster according to the version information of the elastic search engine in the search request data. Therefore, the user service of the terminal device can operate the elastic search server clusters of different versions through the same interface, so that the cost can be reduced in the process of cluster upgrade and version switching later.
可选地,所述中转服务器包括SDK接口或API接口,上述步骤22或者步骤25中,将所述搜索请求消息发送至所述第一弹性搜索服务器,可包括如下步骤:Optionally, the transit server includes an SDK interface or an API interface. In step 22 or step 25, sending the search request message to the first elastic search server may include the following steps:
A1、通过所述SDK接口将所述搜索请求消息发送至所述第一弹性搜索服务器;或者,A1. Send the search request message to the first elastic search server through the SDK interface; or,
A2、通过所述API接口将所述搜索请求消息发送至所述第一弹性搜索服务器。A2. Send the search request message to the first elastic search server through the API interface.
其中,中转服务器中可包括软件开发工具包SDK接口或者API接口,从而中转服务器可通过SDK接口将搜索请求消息发送至第一弹性搜索服务器,或者通过API接口将搜索请求消息发送至第一弹性搜索服务器。Among them, the transit server may include the software development kit SDK interface or API interface, so that the transit server can send the search request message to the first elastic search server through the SDK interface, or send the search request message to the first elastic search server through the API interface server.
可选地,若所述中转服务器接收到所述第一弹性搜索服务器集群出线网络异常的反馈消息,本申请实施例中,还可包括如下步骤:Optionally, if the transit server receives a feedback message that the first elastic search server cluster is out of the network abnormality, in this embodiment of the application, the following steps may be further included:
将所述搜索请求消息发送至所述至少一个弹性搜索服务器集群中的第二弹性搜索服务器集群中的第二弹性搜索服务器,所述第二弹性搜索服务器集群与所述第一弹性搜索服务器集群处于不同机房。The search request message is sent to a second elastic search server in a second elastic search server cluster in the at least one elastic search server cluster, where the second elastic search server cluster and the first elastic search server cluster are located Different computer rooms.
其中,中转服务器可将相同的搜索请求消息写入不同的弹性搜索服务器集群,若第一弹性搜索服务器集群出线网络异常,则中转服务器还可将搜索请求消息发送至第二弹性搜索服务器集群中的第二弹性搜索服务器,第二弹性搜索服务器可以是第二弹性搜索服务器集群中的任一服务器,从而,可保证用户通过终端设备发出的搜索请求数据能够访问成功,最大程度的降低弹性搜索服务器集群出不可用的情况出现。Among them, the transit server can write the same search request message to different elastic search server clusters. If the first elastic search server cluster goes out of the network abnormally, the transit server can also send the search request message to the second elastic search server cluster. The second elastic search server. The second elastic search server can be any server in the second elastic search server cluster, so that it can ensure that the search request data sent by the user through the terminal device can be accessed successfully, and the elastic search server cluster is minimized. The unavailable situation arises.
可以看出,本申请实施例中所描述的数据传输方法,应用于数据传输系统中的中转服务器,所述数据传输系统还包括终端设备、网关服务器、存储服务器和至少一个弹性搜索服务器集群,通过向存储服务器发送订阅请求;并从存储服务器的消息队列中读取搜索请求消息,搜索请求消息携带搜索请求数据,搜索请求消息是由终端设备发送搜索请求数据至所述网关服务器,然后由网关服务器根据搜索请求数据生成搜索请求消息后写入存储服 务器的消息队列的;将搜索请求消息发送至至少一个弹性搜索服务器集群中的第一弹性搜索服务器,第一弹性搜索服务器为至少一个弹性搜索服务器集群中的任一服务器,如此,可通过将搜索请求数据存储在消息队列中,由中转服务器读取的方式,可提高弹性搜索服务器集群的可用性,避免因为搜索请求数据写入的数据量较大,致使整个弹性搜索服务器集群不稳定或不可用,此外,由于搜索请求数据存储到了消息队列,可以针对每条搜索请求数据回溯消息的轨迹,当弹性搜索服务器集群异常时,也可以从消息队列中再次读取搜索请求数据,从而进行故障恢复。It can be seen that the data transmission method described in the embodiment of this application is applied to a transit server in a data transmission system. The data transmission system also includes a terminal device, a gateway server, a storage server, and at least one elastic search server cluster. Send a subscription request to the storage server; and read the search request message from the message queue of the storage server. The search request message carries search request data. The search request message is sent by the terminal device to the gateway server, and then the gateway server The search request message is generated according to the search request data and then written into the message queue of the storage server; the search request message is sent to the first elastic search server in at least one elastic search server cluster, and the first elastic search server is at least one elastic search server cluster In this way, by storing the search request data in the message queue and reading it by the transit server, the availability of the elastic search server cluster can be improved, and the large amount of data written by the search request data can be avoided. As a result, the entire elastic search server cluster is unstable or unavailable. In addition, since the search request data is stored in the message queue, the trace of the message can be traced back for each search request data. When the elastic search server cluster is abnormal, it can also be retrieved from the message queue again. Read the search request data for fault recovery.
与上述一致地,图3是本申请实施例公开的一种数据传输方法的流程示意图。应用于图1A所示的数据传输系统,该数据传输系统可以终端设备、网关服务器、存储服务器、中转服务器和至少一个弹性搜索服务器集群,该数据传输方法包括如下步骤:Consistent with the above, FIG. 3 is a schematic flowchart of a data transmission method disclosed in an embodiment of the present application. Applied to the data transmission system shown in FIG. 1A, the data transmission system may include a terminal device, a gateway server, a storage server, a transit server, and at least one elastic search server cluster. The data transmission method includes the following steps:
301、终端设备发送搜索请求数据至网关服务器。301. The terminal device sends search request data to a gateway server.
302、网关服务器根据所述搜索请求数据生成搜索请求消息。302. The gateway server generates a search request message according to the search request data.
303、所述网关服务器发送所述搜索请求消息至存储服务器。303. The gateway server sends the search request message to a storage server.
304、所述存储服务器将所述搜索请求消息写入消息队列。304. The storage server writes the search request message into a message queue.
305、中转服务器向所述存储服务器发送订阅请求。305. The transit server sends a subscription request to the storage server.
306、所述中转服务器从所述存储服务器的消息队列中读取搜索请求消息。306. The transit server reads the search request message from the message queue of the storage server.
307、将所述搜索请求消息发送至所述至少一个弹性搜索服务器集群中的第一弹性搜索服务器,所述第一弹性搜索服务器为所述至少一个弹性搜索服务器集群中的任一服务器。307. Send the search request message to a first elastic search server in the at least one elastic search server cluster, where the first elastic search server is any server in the at least one elastic search server cluster.
其中,上述步骤301-步骤307的具体描述可以参照图1B和图2所描述的数据传输方法的相应描述,在此不再赘述。For specific descriptions of the above steps 301 to 307, reference may be made to the corresponding descriptions of the data transmission method described in FIG. 1B and FIG. 2, which will not be repeated here.
可以看出,本申请实施例中所描述的数据传输方法,通过终端设备发送搜索请求数据至网关服务器,网关服务器根据所述搜索请求数据生成搜索请求消息,所述网关服务器发送所述搜索请求消息至存储服务器,所述存储服务器将所述搜索请求消息写入消息队列,中转服务器向所述存储服务器发送订阅请求,所述中转服务器从所述存储服务器的消息队列中读取搜索请求消息,将所述搜索请求消息发送至所述至少一个弹性搜索服务器集群中的第一弹性搜索服务器,所述第一弹性搜索服务器为所述至少一个弹性搜索服务器集群中的任一服务器,如此,可通过将搜索请求数据存储在消息队列中,由中转服务器读取的方式,可提高弹性搜索服务器集群的可用性,避免因为搜索请求数据写入的数据量较大,致使整个弹性搜索服务器集群不稳定或不可用,此外,由于搜索请求数据存储到了消息队列,可以针对每条搜索请求数据回溯消息的轨迹,当弹性搜索服务器集群异常时,也可以从消息队列中再次读取搜索请求数据,从而进行故障恢复。It can be seen that the data transmission method described in the embodiment of the present application sends search request data to a gateway server through a terminal device, the gateway server generates a search request message according to the search request data, and the gateway server sends the search request message To the storage server, the storage server writes the search request message into a message queue, the transit server sends a subscription request to the storage server, the transit server reads the search request message from the message queue of the storage server, and The search request message is sent to a first elastic search server in the at least one elastic search server cluster, and the first elastic search server is any server in the at least one elastic search server cluster. The search request data is stored in the message queue and read by the transit server, which can improve the availability of the elastic search server cluster and avoid the large amount of data written in the search request data, which may make the entire elastic search server cluster unstable or unavailable In addition, because the search request data is stored in the message queue, the message track can be traced back for each search request data. When the elastic search server cluster is abnormal, the search request data can also be read from the message queue again for failure recovery.
请参阅图4A,图4A是本申请实施例公开的一种存储服务器的结构示意图,如图所示,该存储服务器包括处理器、存储器、通信接口,以及一个或多个程序,其中,上述一个或多个程序被存储在上述存储器中,并且被配置由上述处理器执行,上述程序包括用于执行以下步骤的指令:Please refer to FIG. 4A. FIG. 4A is a schematic structural diagram of a storage server disclosed in an embodiment of the present application. As shown in the figure, the storage server includes a processor, a memory, a communication interface, and one or more programs. Or multiple programs are stored in the above-mentioned memory and are configured to be executed by the above-mentioned processor, and the above-mentioned programs include instructions for executing the following steps:
接收所述网关服务器发送的搜索请求消息,所述搜索请求消息携带搜索请求数据,所述搜索请求消息是由所述终端设备发送所述搜索请求数据至所述网关服务器,然后由所述网关服务器根据所述搜索请求数据生成的消息;Receiving a search request message sent by the gateway server, the search request message carrying search request data, the search request message is sent by the terminal device to the gateway server, and then the gateway server A message generated according to the search request data;
将所述搜索请求消息写入消息队列;Writing the search request message into a message queue;
接收所述中转服务器发送的订阅请求,根据所述订阅请求将所述搜索请求消息发送至所述中转服务器,并指示所述中转服务器将所述搜索请求消息发送至所述至少一个弹性搜 索服务器集群中的第一弹性搜索服务器,所述第一弹性搜索服务器为所述至少一个弹性搜索服务器集群中的任一服务器。Receive a subscription request sent by the transit server, send the search request message to the transit server according to the subscription request, and instruct the transit server to send the search request message to the at least one elastic search server cluster The first elastic search server in, the first elastic search server is any server in the at least one elastic search server cluster.
在一个可能的示例中,所述搜索请求数据包括弹性搜索服务器集群信息和所述搜索请求数据所属的索引名称信息,在所述将所述搜索请求消息写入消息队列方面,上述程序具体用于执行以下步骤的指令:In a possible example, the search request data includes elastic search server cluster information and index name information to which the search request data belongs. In the aspect of writing the search request message to the message queue, the above program is specifically used for Follow the instructions for the following steps:
根据所述弹性搜索服务器集群信息和所述索引名称信息将所述搜索请求消息划分至消息集合;Dividing the search request message into message sets according to the elastic search server cluster information and the index name information;
将所述消息集合写入所述消息队列;Writing the message set into the message queue;
建立所述搜索请求消息对应的消息集合名称与弹性搜索服务器集群和索引名称之间的映射关系。A mapping relationship between the name of the message set corresponding to the search request message and the name of the elastic search server cluster and the index is established.
请参阅图4B,图4B是本申请实施例公开的一种中转服务器的结构示意图,如图所示,该中转服务器包括处理器、存储器、通信接口,以及一个或多个程序,其中,上述一个或多个程序被存储在上述存储器中,并且被配置由上述处理器执行,上述程序包括用于执行以下步骤的指令:Please refer to Figure 4B. Figure 4B is a schematic structural diagram of a transit server disclosed in an embodiment of the present application. As shown in the figure, the transit server includes a processor, a memory, a communication interface, and one or more programs. Or multiple programs are stored in the above-mentioned memory and are configured to be executed by the above-mentioned processor, and the above-mentioned programs include instructions for executing the following steps:
向所述存储服务器发送订阅请求;并从所述存储服务器的消息队列中读取搜索请求消息,所述搜索请求消息携带搜索请求数据,所述搜索请求消息是由所述终端设备发送所述搜索请求数据至所述网关服务器,然后由所述网关服务器根据所述搜索请求数据生成所述搜索请求消息后写入所述存储服务器的消息队列的;Send a subscription request to the storage server; and read a search request message from the message queue of the storage server, the search request message carries search request data, and the search request message is sent by the terminal device to the search Request data to the gateway server, and then the gateway server generates the search request message according to the search request data and writes it to the message queue of the storage server;
将所述搜索请求消息发送至所述至少一个弹性搜索服务器集群中的第一弹性搜索服务器,所述第一弹性搜索服务器为所述至少一个弹性搜索服务器集群中的任一服务器。The search request message is sent to a first elastic search server in the at least one elastic search server cluster, where the first elastic search server is any server in the at least one elastic search server cluster.
在一个可能的示例中,在所述从所述存储服务器的消息队列中读取搜索请求消息方面,上述程序包括用于执行以下步骤的指令:In a possible example, in the aspect of reading the search request message from the message queue of the storage server, the above program includes instructions for executing the following steps:
按照所述消息队列中消息集合的排列顺序,从所述存储服务器的所述消息队列中读取所述消息集合,所述消息集合包括所述搜索请求消息。According to the sequence of the message sets in the message queue, the message set is read from the message queue of the storage server, and the message set includes the search request message.
在一个可能的示例中,上述程序还包括用于执行以下步骤的指令:In a possible example, the above program also includes instructions for performing the following steps:
获取所述至少一个弹性搜索服务器集群中所有弹性搜索服务器的健康状态数据,所述健康状态数据包括以下至少一种健康状态子数据:索引速率、索引耗时、内存大小、请求拒绝数,其中,每一所述健康状态子数据对应一个参数阈值;Obtain the health status data of all elastic search servers in the at least one elastic search server cluster, where the health status data includes at least one of the following health status sub-data: indexing rate, indexing time, memory size, number of request rejections, where: Each of the health status sub-data corresponds to a parameter threshold;
确定所述健康状态数据中是否存在超过对应参数阈值的健康状态子数据,若不存在,则执行所述从所述存储服务器的消息队列中读取搜索请求消息的操作。It is determined whether there is a health state sub-data in the health state data that exceeds a corresponding parameter threshold, and if it does not exist, the operation of reading the search request message from the message queue of the storage server is performed.
在一个可能的示例中,所述搜索请求数据包括弹性搜索服务器集群信息,在所述将所述搜索请求消息发送至所述至少一个弹性搜索服务器集群中的第一弹性搜索服务器方面,上述程序包括用于执行以下步骤的指令:In a possible example, the search request data includes elastic search server cluster information, and in terms of sending the search request message to the first elastic search server in the at least one elastic search server cluster, the above program includes Instructions to perform the following steps:
根据所述弹性搜索服务器集群信息确定所述至少一个弹性搜索服务器集群中的第一弹性搜索服务器集群;Determining the first elastic search server cluster in the at least one elastic search server cluster according to the elastic search server cluster information;
将所述搜索请求消息发送至所述第一弹性搜索服务器。Sending the search request message to the first elastic search server.
在一个可能的示例中,所述搜索请求数据包括弹性搜索服务器集群信息和弹性搜索引擎的版本信息,在所述将所述搜索请求消息发送至所述至少一个弹性搜索服务器集群中的第一弹性搜索服务器方面,上述程序包括用于执行以下步骤的指令:In a possible example, the search request data includes elastic search server cluster information and elastic search engine version information, and in the sending of the search request message to the first elastic search server cluster in the at least one elastic search server cluster In terms of the search server, the above program includes instructions for performing the following steps:
根据所述弹性搜索服务器集群信息确定所述至少一个弹性搜索服务器集群中的第一弹性搜索服务器集群;Determining the first elastic search server cluster in the at least one elastic search server cluster according to the elastic search server cluster information;
确定所述第一弹性搜索服务器集群中与所述版本信息对应的弹性搜索服务器;Determine the elastic search server corresponding to the version information in the first elastic search server cluster;
将所述与所述版本信息对应的弹性搜索服务器作为所述第一弹性搜索服务器,将所述搜索请求消息发送至所述第一弹性搜索服务器。The elastic search server corresponding to the version information is used as the first elastic search server, and the search request message is sent to the first elastic search server.
在一个可能的示例中,所述中转服务器包括SDK接口或API接口,在所述将所述搜索请求消息发送至所述第一弹性搜索服务器方面,上述程序包括用于执行以下步骤的指令:In a possible example, the transit server includes an SDK interface or an API interface, and in terms of sending the search request message to the first elastic search server, the above program includes instructions for executing the following steps:
通过所述SDK接口将所述搜索请求消息发送至所述第一弹性搜索服务器;或者,Sending the search request message to the first elastic search server through the SDK interface; or,
通过所述API接口将所述搜索请求消息发送至所述第一弹性搜索服务器。The search request message is sent to the first elastic search server through the API interface.
在一个可能的示例中,若所述中转服务器接收到所述第一弹性搜索服务器集群出线网络异常的反馈消息,上述程序还包括用于执行以下步骤的指令:In a possible example, if the transit server receives a feedback message that the first elastic search server cluster is out of the network abnormality, the above program further includes instructions for executing the following steps:
将所述搜索请求消息发送至所述至少一个弹性搜索服务器集群中的第二弹性搜索服务器集群中的第二弹性搜索服务器,所述第二弹性搜索服务器集群与所述第一弹性搜索服务器集群处于不同机房。The search request message is sent to a second elastic search server in a second elastic search server cluster in the at least one elastic search server cluster, where the second elastic search server cluster and the first elastic search server cluster are located Different computer rooms.
上述主要从方法侧执行过程的角度对本申请实施例的方案进行了介绍。可以理解的是,电子设备为了实现上述功能,其包含了执行各个功能相应的硬件结构和/或软件模块。本领域技术人员应该很容易意识到,结合本文中所提供的实施例描述的各示例的单元及算法步骤,本申请能够以硬件或硬件和计算机软件的结合形式来实现。某个功能究竟以硬件还是计算机软件驱动硬件的方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。The foregoing mainly introduces the solution of the embodiment of the present application from the perspective of the execution process on the method side. It can be understood that, in order to implement the above-mentioned functions, an electronic device includes hardware structures and/or software modules corresponding to each function. Those skilled in the art should easily realize that in combination with the units and algorithm steps of the examples described in the embodiments provided herein, this application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a certain function is executed by hardware or computer software-driven hardware depends on the specific application and design constraint conditions of the technical solution. Professionals and technicians can use different methods for each specific application to implement the described functions, but such implementation should not be considered beyond the scope of this application.
本申请实施例可以根据上述方法示例对电子设备进行功能单元的划分,例如,可以对应各个功能划分各个功能单元,也可以将两个或两个以上的功能集成在一个处理单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。需要说明的是,本申请实施例中对单元的划分是示意性的,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式。The embodiment of the present application may divide the electronic device into functional units according to the foregoing method examples. For example, each functional unit may be divided corresponding to each function, or two or more functions may be integrated into one processing unit. The above-mentioned integrated unit can be implemented in the form of hardware or software functional unit. It should be noted that the division of units in the embodiments of the present application is illustrative, and is only a logical function division, and there may be other division methods in actual implementation.
请参阅图5,图5是本申请实施例公开的一种数据传输装置的结构示意图,应用于数据传输系统中的存储服务器,所述数据传输系统还包括终端设备、网关服务器、中转服务器和至少一个弹性搜索服务器集群所述数据传输系统还包括终端设备、网关服务器、中转服务器和至少一个弹性搜索服务器集群,所述数据传输装置包括接收单元501、写入单元502和第一发送单元503,其中,Please refer to FIG. 5. FIG. 5 is a schematic structural diagram of a data transmission device disclosed in an embodiment of the present application, which is applied to a storage server in a data transmission system. An elastic search server cluster. The data transmission system also includes a terminal device, a gateway server, a transit server, and at least one elastic search server cluster. The data transmission device includes a receiving unit 501, a writing unit 502, and a first sending unit 503. ,
所述接收单元501,用于接收所述网关服务器发送的搜索请求消息,所述搜索请求消息携带搜索请求数据,所述搜索请求消息是由所述终端设备发送所述搜索请求数据至所述网关服务器,然后由所述网关服务器根据所述搜索请求数据生成的消息;The receiving unit 501 is configured to receive a search request message sent by the gateway server, where the search request message carries search request data, and the search request message is used by the terminal device to send the search request data to the gateway. Server, and then a message generated by the gateway server according to the search request data;
所述写入单元502,用于将所述搜索请求消息写入消息队列;The writing unit 502 is configured to write the search request message into a message queue;
所述接收单元501,还用于接收所述中转服务器发送的订阅请求;The receiving unit 501 is further configured to receive a subscription request sent by the transit server;
所述第一发送单元503,用于根据所述订阅请求将所述搜索请求消息发送至所述中转服务器,并指示所述中转服务器将所述搜索请求消息发送至所述至少一个弹性搜索服务器集群中的第一弹性搜索服务器,所述第一弹性搜索服务器为所述至少一个弹性搜索服务器集群中的任一服务器。The first sending unit 503 is configured to send the search request message to the transit server according to the subscription request, and instruct the transit server to send the search request message to the at least one elastic search server cluster The first elastic search server in, the first elastic search server is any server in the at least one elastic search server cluster.
可选地,所述搜索请求数据包括弹性搜索服务器集群信息和所述搜索请求数据所属的索引名称信息,在所述将所述搜索请求消息写入消息队列方面,所述写入单元502具体用于:Optionally, the search request data includes elastic search server cluster information and index name information to which the search request data belongs. In the aspect of writing the search request message to the message queue, the writing unit 502 specifically uses At:
根据所述弹性搜索服务器集群信息和所述索引名称信息将所述搜索请求消息划分至消息集合;Dividing the search request message into message sets according to the elastic search server cluster information and the index name information;
将所述消息集合写入所述消息队列;Writing the message set into the message queue;
建立所述搜索请求消息对应的消息集合名称与弹性搜索服务器集群和索引名称之间的映射关系。A mapping relationship between the name of the message set corresponding to the search request message and the name of the elastic search server cluster and the index is established.
可以看出,本申请实施例中所描述的数据传输装置,通过向存储服务器发送订阅请求;并从存储服务器的消息队列中读取搜索请求消息,搜索请求消息携带搜索请求数据,搜索请求消息是由终端设备发送搜索请求数据至所述网关服务器,然后由网关服务器根据搜索请求数据生成搜索请求消息后写入存储服务器的消息队列的;将搜索请求消息发送至至少一个弹性搜索服务器集群中的第一弹性搜索服务器,第一弹性搜索服务器为至少一个弹性搜索服务器集群中的任一服务器,如此,可通过将搜索请求数据存储在消息队列中,由中转服务器读取的方式,可提高弹性搜索服务器集群的可用性,避免因为搜索请求数据写入的数据量较大,致使整个弹性搜索服务器集群不稳定或不可用,此外,由于搜索请求数据存储到了消息队列,可以针对每条搜索请求数据回溯消息的轨迹,当弹性搜索服务器集群异常时,也可以从消息队列中再次读取搜索请求数据,从而进行故障恢复。It can be seen that the data transmission device described in the embodiment of this application sends a subscription request to the storage server; and reads the search request message from the message queue of the storage server. The search request message carries the search request data, and the search request message is The terminal device sends the search request data to the gateway server, and then the gateway server generates a search request message according to the search request data and writes it to the message queue of the storage server; the search request message is sent to the first in at least one elastic search server cluster An elastic search server. The first elastic search server is any server in at least one elastic search server cluster. In this way, the elastic search server can be improved by storing the search request data in the message queue and reading it by the relay server. The availability of the cluster prevents the entire elastic search server cluster from being unstable or unavailable due to the large amount of data written in the search request data. In addition, since the search request data is stored in the message queue, it is possible to backtrack the message for each search request data Track, when the elastic search server cluster is abnormal, you can also read the search request data from the message queue again to recover from the failure.
需要注意的是,本申请实施例所描述的存储服务器是以功能单元的形式呈现。这里所使用的术语“单元”应当理解为尽可能最宽的含义,用于实现各个“单元”所描述功能的对象例如可以是集成电路ASIC,单个电路,用于执行一个或多个软件或固件程序的处理器(共享的、专用的或芯片组)和存储器,组合逻辑电路,和/或提供实现上述功能的其他合适的组件。It should be noted that the storage server described in the embodiment of the present application is presented in the form of a functional unit. The term "unit" used here should be understood as the broadest possible meaning. The object used to realize the functions described by each "unit" may be, for example, an integrated circuit ASIC, a single circuit, used to execute one or more software or firmware. Program processor (shared, dedicated or chipset) and memory, combinatorial logic circuit, and/or provide other suitable components for realizing the above-mentioned functions.
其中,接收单元501、写入单元502和第一发送单元503可以是控制电路或处理器。Among them, the receiving unit 501, the writing unit 502, and the first sending unit 503 may be a control circuit or a processor.
请参阅图6A,图6A是本申请实施例公开的一种数据传输装置的结构示意图,应用于数据传输系统中的中转服务器,所述数据传输系统还包括终端设备、网关服务器、存储服务器和至少一个弹性搜索服务器集群,所述数据传输装置包括第二发送单元601和读取单元602,其中,Please refer to FIG. 6A. FIG. 6A is a schematic structural diagram of a data transmission device disclosed in an embodiment of the present application, which is applied to a transit server in a data transmission system. An elastic search server cluster, the data transmission device includes a second sending unit 601 and a reading unit 602, wherein:
所述第二发送单元601,用于向所述存储服务器发送订阅请求;The second sending unit 601 is configured to send a subscription request to the storage server;
所述读取单元602,用于从所述存储服务器的消息队列中读取搜索请求消息,所述搜索请求消息携带搜索请求数据,所述搜索请求消息是由所述终端设备发送所述搜索请求数据至所述网关服务器,然后由所述网关服务器根据所述搜索请求数据生成所述搜索请求消息后写入所述存储服务器的消息队列的;The reading unit 602 is configured to read a search request message from a message queue of the storage server, the search request message carries search request data, and the search request message is sent by the terminal device. Data to the gateway server, and then the gateway server generates the search request message according to the search request data and writes it into the message queue of the storage server;
所述第二发送单元602,还用于将所述搜索请求消息发送至所述至少一个弹性搜索服务器集群中的第一弹性搜索服务器,所述第一弹性搜索服务器为所述至少一个弹性搜索服务器集群中的任一服务器。The second sending unit 602 is further configured to send the search request message to a first elastic search server in the at least one elastic search server cluster, where the first elastic search server is the at least one elastic search server Any server in the cluster.
可选地,在所述从所述存储服务器的消息队列中读取搜索请求消息面,所述读取单元具体用于:Optionally, in the reading the search request message surface from the message queue of the storage server, the reading unit is specifically configured to:
按照所述消息队列中消息集合的排列顺序,从所述存储服务器的所述消息队列中读取所述消息集合,所述消息集合包括所述搜索请求消息。According to the sequence of the message sets in the message queue, the message set is read from the message queue of the storage server, and the message set includes the search request message.
可选地,如图6B,图6B为图6A所示的数据传输装置的变型结构,其与图6A相比较,还可以包括:获取单元603和确定单元604,其中,Optionally, as shown in FIG. 6B, FIG. 6B is a modified structure of the data transmission device shown in FIG. 6A. Compared with FIG. 6A, it may further include: an acquiring unit 603 and a determining unit 604, where
所述获取单元603,用于获取所述至少一个弹性搜索服务器集群中所有弹性搜索服务器的健康状态数据,所述健康状态数据包括以下至少一种健康状态子数据:索引速率、索引耗时、内存大小、请求拒绝数,其中,每一所述健康状态子数据对应一个参数阈值;The acquiring unit 603 is configured to acquire health status data of all elastic search servers in the at least one elastic search server cluster, where the health status data includes at least one of the following health status sub-data: indexing rate, indexing time, memory Size and the number of request rejections, where each of the health status sub-data corresponds to a parameter threshold;
所述确定单元604,用于确定所述健康状态数据中是否存在超过对应参数阈值的健康状态子数据,若不存在,则由所述读取单元602执行所述从所述存储服务器的消息队列中 读取搜索请求消息的操作。The determining unit 604 is configured to determine whether there is a health status sub-data that exceeds a corresponding parameter threshold in the health status data, if not, the reading unit 602 executes the message queue from the storage server Read the search request message in the operation.
可选地,所述搜索请求数据包括弹性搜索服务器集群信息,在所述将所述搜索请求消息发送至所述至少一个弹性搜索服务器集群中的第一弹性搜索服务器方面,所述第二发送单元具体用于:Optionally, the search request data includes elastic search server cluster information, and in the aspect of sending the search request message to the first elastic search server in the at least one elastic search server cluster, the second sending unit Specifically used for:
根据所述弹性搜索服务器集群信息确定所述至少一个弹性搜索服务器集群中的第一弹性搜索服务器集群;Determining the first elastic search server cluster in the at least one elastic search server cluster according to the elastic search server cluster information;
将所述搜索请求消息发送至所述第一弹性搜索服务器。Sending the search request message to the first elastic search server.
可选地,所述搜索请求数据包括弹性搜索服务器集群信息和弹性搜索引擎的版本信息,在所述将所述搜索请求消息发送至所述至少一个弹性搜索服务器集群中的第一弹性搜索服务器方面,所述第二发送单元601具体用于:Optionally, the search request data includes elastic search server cluster information and version information of an elastic search engine, in the aspect of sending the search request message to the first elastic search server in the at least one elastic search server cluster , The second sending unit 601 is specifically configured to:
根据所述弹性搜索服务器集群信息确定所述至少一个弹性搜索服务器集群中的第一弹性搜索服务器集群;Determining the first elastic search server cluster in the at least one elastic search server cluster according to the elastic search server cluster information;
确定所述第一弹性搜索服务器集群中与所述版本信息对应的弹性搜索服务器;Determine the elastic search server corresponding to the version information in the first elastic search server cluster;
将所述与所述版本信息对应的弹性搜索服务器作为所述第一弹性搜索服务器,将所述搜索请求消息发送至所述第一弹性搜索服务器。The elastic search server corresponding to the version information is used as the first elastic search server, and the search request message is sent to the first elastic search server.
可选地,所述中转服务器包括SDK接口或API接口,在所述将所述搜索请求消息发送至所述第一弹性搜索服务器方面,所述第二发送单元601具体用于:Optionally, the transit server includes an SDK interface or an API interface, and in terms of sending the search request message to the first elastic search server, the second sending unit 601 is specifically configured to:
通过所述SDK接口将所述搜索请求消息发送至所述第一弹性搜索服务器;或者,Sending the search request message to the first elastic search server through the SDK interface; or,
通过所述API接口将所述搜索请求消息发送至所述第一弹性搜索服务器。The search request message is sent to the first elastic search server through the API interface.
可选地,若所述中转服务器接收到所述第一弹性搜索服务器集群出线网络异常的反馈消息,所述第二发送单元601还用于:Optionally, if the transit server receives a feedback message that the first elastic search server cluster is out of the network abnormality, the second sending unit 601 is further configured to:
将所述搜索请求消息发送至所述至少一个弹性搜索服务器集群中的第二弹性搜索服务器集群中的第二弹性搜索服务器,所述第二弹性搜索服务器集群与所述第一弹性搜索服务器集群处于不同机房。The search request message is sent to a second elastic search server in a second elastic search server cluster in the at least one elastic search server cluster, where the second elastic search server cluster and the first elastic search server cluster are located Different computer rooms.
可以看出,本申请实施例中所描述的数据传输装置,通过向存储服务器发送订阅请求;并从存储服务器的消息队列中读取搜索请求消息,搜索请求消息携带搜索请求数据,搜索请求消息是由终端设备发送搜索请求数据至所述网关服务器,然后由网关服务器根据搜索请求数据生成搜索请求消息后写入存储服务器的消息队列的;将搜索请求消息发送至至少一个弹性搜索服务器集群中的第一弹性搜索服务器,第一弹性搜索服务器为至少一个弹性搜索服务器集群中的任一服务器,如此,可通过将搜索请求数据存储在消息队列中,由中转服务器读取的方式,可提高弹性搜索服务器集群的可用性,避免因为搜索请求数据写入的数据量较大,致使整个弹性搜索服务器集群不稳定或不可用,此外,由于搜索请求数据存储到了消息队列,可以针对每条搜索请求数据回溯消息的轨迹,当弹性搜索服务器集群异常时,也可以从消息队列中再次读取搜索请求数据,从而进行故障恢复。It can be seen that the data transmission device described in the embodiment of this application sends a subscription request to the storage server; and reads the search request message from the message queue of the storage server. The search request message carries the search request data, and the search request message is The terminal device sends the search request data to the gateway server, and then the gateway server generates a search request message according to the search request data and writes it to the message queue of the storage server; the search request message is sent to the first in at least one elastic search server cluster An elastic search server. The first elastic search server is any server in at least one elastic search server cluster. In this way, the elastic search server can be improved by storing the search request data in the message queue and reading it by the relay server. The availability of the cluster prevents the entire elastic search server cluster from being unstable or unavailable due to the large amount of data written in the search request data. In addition, since the search request data is stored in the message queue, it is possible to backtrack the message for each search request data Track, when the elastic search server cluster is abnormal, you can also read the search request data from the message queue again to recover from the failure.
需要注意的是,本申请实施例所描述的中转服务器是以功能单元的形式呈现。这里所使用的术语“单元”应当理解为尽可能最宽的含义,用于实现各个“单元”所描述功能的对象例如可以是集成电路ASIC,单个电路,用于执行一个或多个软件或固件程序的处理器(共享的、专用的或芯片组)和存储器,组合逻辑电路,和/或提供实现上述功能的其他合适的组件。It should be noted that the transit server described in the embodiment of the present application is presented in the form of a functional unit. The term "unit" used here should be understood as the broadest possible meaning. The object used to realize the functions described by each "unit" may be, for example, an integrated circuit ASIC, a single circuit, used to execute one or more software or firmware. Program processor (shared, dedicated or chipset) and memory, combinatorial logic circuit, and/or provide other suitable components for realizing the above-mentioned functions.
其中,第二发送单元601、读取单元602、获取单元603和确定单元603可以是控制电路或处理器。Wherein, the second sending unit 601, the reading unit 602, the acquiring unit 603, and the determining unit 603 may be a control circuit or a processor.
本申请实施例还提供一种计算机存储介质,其中,该计算机存储介质存储用于电子数据交换的计算机程序,该计算机程序使得计算机执行如上述方法实施例中记载的任何一种 数据传输方法的部分或全部步骤。An embodiment of the present application also provides a computer storage medium, wherein the computer storage medium stores a computer program for electronic data exchange, and the computer program causes a computer to execute a part of any data transmission method as described in the above method embodiment. Or all steps.
本申请实施例还提供一种计算机程序产品,所述计算机程序产品包括存储了计算机程序的非瞬时性计算机可读存储介质,所述计算机程序可操作来使计算机执行如上述方法实施例中记载的任何一种数据传输方法的部分或全部步骤。The embodiments of the present application also provide a computer program product. The computer program product includes a non-transitory computer-readable storage medium storing a computer program. The computer program is operable to cause a computer to execute the method described in the foregoing method embodiment. Part or all of the steps of any data transmission method.
需要说明的是,对于前述的各方法实施例,为了简单描述,故将其都表述为一系列的动作组合,但是本领域技术人员应该知悉,本申请并不受所描述的动作顺序的限制,因为依据本申请,某些步骤可以采用其他顺序或者同时进行。其次,本领域技术人员也应该知悉,说明书中所描述的实施例均属于优选实施例,所涉及的动作和模块并不一定是本申请所必须的。It should be noted that for the foregoing method embodiments, for the sake of simple description, they are all expressed as a series of action combinations, but those skilled in the art should know that this application is not limited by the described sequence of actions. Because according to this application, some steps can be performed in other order or at the same time. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by this application.
在上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述的部分,可以参见其他实施例的相关描述。In the above-mentioned embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in an embodiment, reference may be made to related descriptions of other embodiments.
在本申请所提供的几个实施例中,应该理解到,所揭露的装置,可通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性或其它的形式。In the several embodiments provided in this application, it should be understood that the disclosed device may be implemented in other ways. For example, the device embodiments described above are merely illustrative, for example, the division of the units is only a logical function division, and there may be other divisions in actual implementation, for example, multiple units or components may be combined or may be Integrate into another system, or some features can be ignored or not implemented. In addition, the displayed or discussed mutual coupling or direct coupling or communication connection may be indirect coupling or communication connection through some interfaces, devices or units, and may be in electrical or other forms.
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。The units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the objectives of the solutions of the embodiments.
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件程序模块的形式实现。In addition, the functional units in the various embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units may be integrated into one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software program modules.
所述集成的单元如果以软件程序模块的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储器中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储器中,包括若干指令用以使得一台计算机设备(可为个人计算机、服务器或者网络设备等)执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储器包括:U盘、只读存储器(read-only memory,ROM)、随机存取存储器(random access memory,RAM)、移动硬盘、磁碟或者光盘等各种可以存储程序代码的介质。If the integrated unit is implemented in the form of a software program module and sold or used as an independent product, it can be stored in a computer readable memory. Based on this understanding, the technical solution of the present application essentially or the part that contributes to the existing technology or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a memory. A number of instructions are included to enable a computer device (which may be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in the various embodiments of the present application. The foregoing memory includes: U disk, read-only memory (read-only memory, ROM), random access memory (random access memory, RAM), mobile hard disk, magnetic disk or optical disk and other media that can store program codes.
本领域普通技术人员可以理解上述实施例的各种方法中的全部或部分步骤是可以通过程序来指令相关的硬件来完成,该程序可以存储于一计算机可读存储器中,存储器可以包括:闪存盘、ROM、RAM、磁盘或光盘等。Those of ordinary skill in the art can understand that all or part of the steps in the various methods of the above-mentioned embodiments can be completed by a program instructing relevant hardware. The program can be stored in a computer-readable memory, and the memory can include: a flash disk , ROM, RAM, magnetic disk or CD, etc.
以上对本申请实施例进行了详细介绍,本文中应用了具体个例对本申请的原理及实施方式进行了阐述,以上实施例的说明只是用于帮助理解本申请的方法及其核心思想;同时,对于本领域的一般技术人员,依据本申请的思想,在具体实施方式及应用范围上均会有改变之处,综上所述,本说明书内容不应理解为对本申请的限制。The embodiments of the application are described in detail above, and specific examples are used in this article to illustrate the principles and implementation of the application. The descriptions of the above embodiments are only used to help understand the methods and core ideas of the application; at the same time, for Those of ordinary skill in the art, based on the idea of the application, will have changes in the specific implementation and the scope of application. In summary, the content of this specification should not be construed as a limitation to the application.

Claims (20)

  1. 一种数据传输方法,其特征在于,应用于数据传输系统中的存储服务器,所述数据传输系统还包括终端设备、网关服务器、中转服务器和至少一个弹性搜索服务器集群,所述方法包括:A data transmission method, characterized in that it is applied to a storage server in a data transmission system, and the data transmission system further includes a terminal device, a gateway server, a transit server, and at least one elastic search server cluster, and the method includes:
    接收所述网关服务器发送的搜索请求消息,所述搜索请求消息携带搜索请求数据,所述搜索请求消息是由所述终端设备发送所述搜索请求数据至所述网关服务器,然后由所述网关服务器根据所述搜索请求数据生成的消息;Receiving a search request message sent by the gateway server, the search request message carrying search request data, the search request message is sent by the terminal device to the gateway server, and then the gateway server A message generated according to the search request data;
    将所述搜索请求消息写入消息队列;Writing the search request message into a message queue;
    接收所述中转服务器发送的订阅请求,根据所述订阅请求将所述搜索请求消息发送至所述中转服务器,并指示所述中转服务器将所述搜索请求消息发送至所述至少一个弹性搜索服务器集群中的第一弹性搜索服务器,所述第一弹性搜索服务器为所述至少一个弹性搜索服务器集群中的任一服务器。Receive a subscription request sent by the transit server, send the search request message to the transit server according to the subscription request, and instruct the transit server to send the search request message to the at least one elastic search server cluster The first elastic search server in, the first elastic search server is any server in the at least one elastic search server cluster.
  2. 根据权利要求1所述方法,其特征在于,所述搜索请求数据包括弹性搜索服务器集群信息和所述搜索请求数据所属的索引名称信息,所述将所述搜索请求消息写入消息队列,包括:The method according to claim 1, wherein the search request data includes elastic search server cluster information and index name information to which the search request data belongs, and writing the search request message to a message queue includes:
    根据所述弹性搜索服务器集群信息和所述索引名称信息将所述搜索请求消息划分至消息集合;Dividing the search request message into message sets according to the elastic search server cluster information and the index name information;
    将所述消息集合写入所述消息队列;Writing the message set into the message queue;
    建立所述搜索请求消息对应的消息集合名称与弹性搜索服务器集群和索引名称之间的映射关系。A mapping relationship between the name of the message set corresponding to the search request message and the name of the elastic search server cluster and the index is established.
  3. 一种数据传输方法,其特征在于,应用于数据传输系统中的中转服务器,所述数据传输系统还包括终端设备、网关服务器、存储服务器和至少一个弹性搜索服务器集群,所述方法包括:A data transmission method, characterized in that it is applied to a transit server in a data transmission system, the data transmission system further includes a terminal device, a gateway server, a storage server, and at least one elastic search server cluster, and the method includes:
    向所述存储服务器发送订阅请求;并从所述存储服务器的消息队列中读取搜索请求消息,所述搜索请求消息携带搜索请求数据,所述搜索请求消息是由所述终端设备发送所述搜索请求数据至所述网关服务器,然后由所述网关服务器根据所述搜索请求数据生成所述搜索请求消息后写入所述存储服务器的消息队列的;Send a subscription request to the storage server; and read a search request message from the message queue of the storage server, the search request message carries search request data, and the search request message is sent by the terminal device to the search Request data to the gateway server, and then the gateway server generates the search request message according to the search request data and writes it to the message queue of the storage server;
    将所述搜索请求消息发送至所述至少一个弹性搜索服务器集群中的第一弹性搜索服务器,所述第一弹性搜索服务器为所述至少一个弹性搜索服务器集群中的任一服务器。The search request message is sent to a first elastic search server in the at least one elastic search server cluster, where the first elastic search server is any server in the at least one elastic search server cluster.
  4. 根据权利要求3所述方法,其特征在于,所述从所述存储服务器的消息队列中读取搜索请求消息,包括:The method according to claim 3, wherein said reading the search request message from the message queue of the storage server comprises:
    按照所述消息队列中消息集合的排列顺序,从所述存储服务器的所述消息队列中读取所述消息集合,所述消息集合包括所述搜索请求消息。According to the sequence of the message sets in the message queue, the message set is read from the message queue of the storage server, and the message set includes the search request message.
  5. 根据权利要求3或4所述方法,其特征在于,所述方法还包括:The method according to claim 3 or 4, wherein the method further comprises:
    获取所述至少一个弹性搜索服务器集群中所有弹性搜索服务器的健康状态数据,所述健康状态数据包括以下至少一种健康状态子数据:索引速率、索引耗时、内存大小、请求拒绝数,其中,每一所述健康状态子数据对应一个参数阈值;Obtain the health status data of all elastic search servers in the at least one elastic search server cluster, where the health status data includes at least one of the following health status sub-data: indexing rate, indexing time, memory size, number of request rejections, where: Each of the health status sub-data corresponds to a parameter threshold;
    确定所述健康状态数据中是否存在超过对应参数阈值的健康状态子数据,若不存在,则执行所述从所述存储服务器的消息队列中读取搜索请求消息的操作。It is determined whether there is a health state sub-data in the health state data that exceeds a corresponding parameter threshold, and if it does not exist, the operation of reading the search request message from the message queue of the storage server is performed.
  6. 根据权利要求5所述方法,其特征在于,所述搜索请求数据包括弹性搜索服务器集群信息,所述将所述搜索请求消息发送至所述至少一个弹性搜索服务器集群中的第一弹性搜索服务器,包括:The method according to claim 5, wherein the search request data includes elastic search server cluster information, and the sending the search request message to the first elastic search server in the at least one elastic search server cluster, include:
    根据所述弹性搜索服务器集群信息确定所述至少一个弹性搜索服务器集群中的第一弹性搜索服务器集群;Determining the first elastic search server cluster in the at least one elastic search server cluster according to the elastic search server cluster information;
    将所述搜索请求消息发送至所述第一弹性搜索服务器。Sending the search request message to the first elastic search server.
  7. 根据权利要求5所述方法,其特征在于,所述搜索请求数据包括弹性搜索服务器集群信息和弹性搜索引擎的版本信息,所述将所述搜索请求消息发送至所述至少一个弹性搜索服务器集群中的第一弹性搜索服务器,包括:The method according to claim 5, wherein the search request data includes elastic search server cluster information and elastic search engine version information, and the search request message is sent to the at least one elastic search server cluster The first elastic search server, including:
    根据所述弹性搜索服务器集群信息确定所述至少一个弹性搜索服务器集群中的第一弹性搜索服务器集群;Determining the first elastic search server cluster in the at least one elastic search server cluster according to the elastic search server cluster information;
    确定所述第一弹性搜索服务器集群中与所述版本信息对应的弹性搜索服务器;Determine the elastic search server corresponding to the version information in the first elastic search server cluster;
    将所述与所述版本信息对应的弹性搜索服务器作为所述第一弹性搜索服务器,将所述搜索请求消息发送至所述第一弹性搜索服务器。The elastic search server corresponding to the version information is used as the first elastic search server, and the search request message is sent to the first elastic search server.
  8. 根据权利要求6或7所述方法,其特征在于,所述中转服务器包括SDK接口或API接口,所述将所述搜索请求消息发送至所述第一弹性搜索服务器,包括:The method according to claim 6 or 7, wherein the transit server includes an SDK interface or an API interface, and the sending the search request message to the first elastic search server includes:
    通过所述SDK接口将所述搜索请求消息发送至所述第一弹性搜索服务器;或者,Sending the search request message to the first elastic search server through the SDK interface; or,
    通过所述API接口将所述搜索请求消息发送至所述第一弹性搜索服务器。The search request message is sent to the first elastic search server through the API interface.
  9. 根据权利要求6或7所述方法,其特征在于,若所述中转服务器接收到所述第一弹性搜索服务器集群出线网络异常的反馈消息,所述方法还包括:The method according to claim 6 or 7, wherein if the transit server receives a feedback message that the first elastic search server cluster is out of the network abnormality, the method further comprises:
    将所述搜索请求消息发送至所述至少一个弹性搜索服务器集群中的第二弹性搜索服务器集群中的第二弹性搜索服务器,所述第二弹性搜索服务器集群与所述第一弹性搜索服务器集群处于不同机房。The search request message is sent to a second elastic search server in a second elastic search server cluster in the at least one elastic search server cluster, where the second elastic search server cluster and the first elastic search server cluster are located Different computer rooms.
  10. 一种数据传输装置,其特征在于,应用于数据传输系统中的存储服务器,所述数据传输系统还包括终端设备、网关服务器、中转服务器和至少一个弹性搜索服务器集群,所述数据传输装置包括:A data transmission device, characterized in that it is applied to a storage server in a data transmission system, the data transmission system further includes a terminal device, a gateway server, a transit server, and at least one elastic search server cluster, and the data transmission device includes:
    接收单元,用于接收所述网关服务器发送的搜索请求消息,所述搜索请求消息携带搜索请求数据,所述搜索请求消息是由所述终端设备发送所述搜索请求数据至所述网关服务器,然后由所述网关服务器根据所述搜索请求数据生成的消息;The receiving unit is configured to receive a search request message sent by the gateway server, the search request message carries search request data, and the search request message is the terminal device sending the search request data to the gateway server, and then A message generated by the gateway server according to the search request data;
    写入单元,用于将所述搜索请求消息写入消息队列;A writing unit for writing the search request message into the message queue;
    所述接收单元,还用于接收所述中转服务器发送的订阅请求;The receiving unit is further configured to receive a subscription request sent by the transit server;
    第一发送单元,用于根据所述订阅请求将所述搜索请求消息发送至所述中转服务器,并指示所述中转服务器将所述搜索请求消息发送至所述至少一个弹性搜索服务器集群中的第一弹性搜索服务器,所述第一弹性搜索服务器为所述至少一个弹性搜索服务器集群中的任一服务器。The first sending unit is configured to send the search request message to the transit server according to the subscription request, and instruct the transit server to send the search request message to the first in the at least one elastic search server cluster An elastic search server, and the first elastic search server is any server in the at least one elastic search server cluster.
  11. 根据权利要求10所述的数据传输装置,其特征在于,所述搜索请求数据包括弹性搜索服务器集群信息和所述搜索请求数据所属的索引名称信息,在所述将所述搜索请求消息写入消息队列方面,所述写入单元具体用于:The data transmission device according to claim 10, wherein the search request data includes elastic search server cluster information and index name information to which the search request data belongs, and the search request message is written in the message In terms of queues, the writing unit is specifically used for:
    根据所述弹性搜索服务器集群信息和所述索引名称信息将所述搜索请求消息划分至消息集合;Dividing the search request message into message sets according to the elastic search server cluster information and the index name information;
    将所述消息集合写入所述消息队列;Writing the message set into the message queue;
    建立所述搜索请求消息对应的消息集合名称与弹性搜索服务器集群和索引名称之间的映射关系。A mapping relationship between the name of the message set corresponding to the search request message and the name of the elastic search server cluster and the index is established.
  12. 一种数据传输装置,其特征在于,应用于数据传输系统中的中转服务器,所述数据传输系统还包括终端设备、网关服务器、存储服务器和至少一个弹性搜索服务器集群,所述数据传输装置包括:A data transmission device, characterized in that it is applied to a transit server in a data transmission system, the data transmission system further includes a terminal device, a gateway server, a storage server, and at least one elastic search server cluster, and the data transmission device includes:
    第二发送单元,用于向所述存储服务器发送订阅请求;The second sending unit is configured to send a subscription request to the storage server;
    读取单元,用于从所述存储服务器的消息队列中读取搜索请求消息,所述搜索请求消息携带搜索请求数据,所述搜索请求消息是由所述终端设备发送所述搜索请求数据至所述网关服务器,然后由所述网关服务器根据所述搜索请求数据生成所述搜索请求消息后写入所述存储服务器的消息队列的;The reading unit is configured to read a search request message from the message queue of the storage server, the search request message carries search request data, and the search request message is sent by the terminal device to the search request data. The gateway server, then the gateway server generates the search request message according to the search request data and writes it into the message queue of the storage server;
    所述第二发送单元,还用于将所述搜索请求消息发送至所述至少一个弹性搜索服务器集群中的第一弹性搜索服务器,所述第一弹性搜索服务器为所述至少一个弹性搜索服务器集群中的任一服务器。The second sending unit is further configured to send the search request message to a first elastic search server in the at least one elastic search server cluster, where the first elastic search server is the at least one elastic search server cluster Any server in.
  13. 根据权利要求12所述的数据传输装置,其特征在于,在所述从所述存储服务器的消息队列中读取搜索请求消息面,所述读取单元具体用于:The data transmission device according to claim 12, wherein, in the reading of the search request message surface from the message queue of the storage server, the reading unit is specifically configured to:
    按照所述消息队列中消息集合的排列顺序,从所述存储服务器的所述消息队列中读取所述消息集合,所述消息集合包括所述搜索请求消息。According to the sequence of the message sets in the message queue, the message set is read from the message queue of the storage server, and the message set includes the search request message.
  14. 根据权利要求11所述的数据传输装置,其特征在于,所述装置还包括获取单元和确定单元,其中,The data transmission device according to claim 11, wherein the device further comprises an acquiring unit and a determining unit, wherein:
    所述获取单元,用于获取所述至少一个弹性搜索服务器集群中所有弹性搜索服务器的健康状态数据,所述健康状态数据包括以下至少一种健康状态子数据:索引速率、索引耗时、内存大小、请求拒绝数,其中,每一所述健康状态子数据对应一个参数阈值;The acquiring unit is configured to acquire health status data of all elastic search servers in the at least one elastic search server cluster, where the health status data includes at least one of the following health status sub-data: index rate, index time consumption, memory size The number of request rejections, wherein each of the health status sub-data corresponds to a parameter threshold;
    所述确定单元,用于确定所述健康状态数据中是否存在超过对应参数阈值的健康状态子数据,若不存在,则由所述读取单元执行所述从所述存储服务器的消息队列中读取搜索请求消息的操作。The determining unit is configured to determine whether there are health status sub-data that exceeds a corresponding parameter threshold in the health status data, and if not, the reading unit executes the reading from the message queue of the storage server The operation of fetching the search request message.
  15. 根据权利要求11所述的数据传输装置,其特征在于,所述搜索请求数据包括弹性搜索服务器集群信息,在所述将所述搜索请求消息发送至所述至少一个弹性搜索服务器集群中的第一弹性搜索服务器方面,所述第二发送单元具体用于:The data transmission device according to claim 11, wherein the search request data includes elastic search server cluster information, and in the sending of the search request message to the first one in the at least one elastic search server cluster Regarding the elastic search server, the second sending unit is specifically configured to:
    根据所述弹性搜索服务器集群信息确定所述至少一个弹性搜索服务器集群中的第一弹性搜索服务器集群;Determining the first elastic search server cluster in the at least one elastic search server cluster according to the elastic search server cluster information;
    将所述搜索请求消息发送至所述第一弹性搜索服务器。Sending the search request message to the first elastic search server.
  16. 根据权利要求11所述的数据传输装置,其特征在于,所述搜索请求数据包括弹性搜索服务器集群信息和弹性搜索引擎的版本信息,在所述将所述搜索请求消息发送至所述至少一个弹性搜索服务器集群中的第一弹性搜索服务器方面,所述第二发送单元具体用于:The data transmission device according to claim 11, wherein the search request data includes elastic search server cluster information and version information of the elastic search engine, and the search request message is sent to the at least one elastic search engine. Regarding the first elastic search server in the search server cluster, the second sending unit is specifically configured to:
    根据所述弹性搜索服务器集群信息确定所述至少一个弹性搜索服务器集群中的第一弹性搜索服务器集群;Determining the first elastic search server cluster in the at least one elastic search server cluster according to the elastic search server cluster information;
    确定所述第一弹性搜索服务器集群中与所述版本信息对应的弹性搜索服务器;Determine the elastic search server corresponding to the version information in the first elastic search server cluster;
    将所述与所述版本信息对应的弹性搜索服务器作为所述第一弹性搜索服务器,将所述搜索请求消息发送至所述第一弹性搜索服务器。The elastic search server corresponding to the version information is used as the first elastic search server, and the search request message is sent to the first elastic search server.
  17. 一种存储服务器,其特征在于,包括处理器、存储器、通信接口,以及一个或多个程序,所述一个或多个程序被存储在所述存储器中,并且被配置由所述处理器执行,所述程序包括用于执行如权利要求1或2所述的方法中的步骤的指令。A storage server, characterized by comprising a processor, a memory, a communication interface, and one or more programs, the one or more programs are stored in the memory and configured to be executed by the processor, The program includes instructions for performing the steps in the method as claimed in claim 1 or 2.
  18. 一种中转服务器,其特征在于,包括处理器、存储器、通信接口,以及一个或多个程序,所述一个或多个程序被存储在所述存储器中,并且被配置由所述处理器执行,所述程序包括用于执行如权利要求3-9任一项所述的方法中的步骤的指令。A transit server, characterized by comprising a processor, a memory, a communication interface, and one or more programs, the one or more programs are stored in the memory and configured to be executed by the processor, The program includes instructions for performing the steps in the method according to any one of claims 3-9.
  19. 一种计算机可读存储介质,其特征在于,存储用于电子数据交换的计算机程序,其中,所述计算机程序使得计算机执行如权利要求1-9任一项所述的方法。A computer-readable storage medium, characterized by storing a computer program for electronic data exchange, wherein the computer program causes a computer to execute the method according to any one of claims 1-9.
  20. 一种计算机程序产品,其特征在于,所述计算机程序产品包括存储计算机程序的 非瞬时性计算机可读存储介质,所述计算机程序使得计算机执行如权利要求1-9任一项所述的方法。A computer program product, wherein the computer program product comprises a non-transitory computer-readable storage medium storing a computer program, and the computer program causes a computer to execute the method according to any one of claims 1-9.
PCT/CN2020/080896 2020-03-24 2020-03-24 Data transmission method and apparatus WO2021189253A1 (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN202080096690.9A CN115087968A (en) 2020-03-24 2020-03-24 Data transmission method and device
PCT/CN2020/080896 WO2021189253A1 (en) 2020-03-24 2020-03-24 Data transmission method and apparatus

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2020/080896 WO2021189253A1 (en) 2020-03-24 2020-03-24 Data transmission method and apparatus

Publications (1)

Publication Number Publication Date
WO2021189253A1 true WO2021189253A1 (en) 2021-09-30

Family

ID=77890856

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/080896 WO2021189253A1 (en) 2020-03-24 2020-03-24 Data transmission method and apparatus

Country Status (2)

Country Link
CN (1) CN115087968A (en)
WO (1) WO2021189253A1 (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20120030188A1 (en) * 2010-07-27 2012-02-02 Oracle International Corporation Enterprise-based searching of new and updated data
CN107229639A (en) * 2016-03-24 2017-10-03 上海宝信软件股份有限公司 The storage system of distributing real-time data bank
CN107992568A (en) * 2017-11-29 2018-05-04 政和科技股份有限公司 A kind of searching method, apparatus and system
CN109542930A (en) * 2018-11-16 2019-03-29 重庆邮电大学 A kind of data efficient search method based on ElasticSearch
CN109635031A (en) * 2018-12-19 2019-04-16 成都四方伟业软件股份有限公司 A kind of data quality checking method, apparatus, system and storage medium

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20120030188A1 (en) * 2010-07-27 2012-02-02 Oracle International Corporation Enterprise-based searching of new and updated data
CN107229639A (en) * 2016-03-24 2017-10-03 上海宝信软件股份有限公司 The storage system of distributing real-time data bank
CN107992568A (en) * 2017-11-29 2018-05-04 政和科技股份有限公司 A kind of searching method, apparatus and system
CN109542930A (en) * 2018-11-16 2019-03-29 重庆邮电大学 A kind of data efficient search method based on ElasticSearch
CN109635031A (en) * 2018-12-19 2019-04-16 成都四方伟业软件股份有限公司 A kind of data quality checking method, apparatus, system and storage medium

Also Published As

Publication number Publication date
CN115087968A (en) 2022-09-20

Similar Documents

Publication Publication Date Title
US9692846B2 (en) System, device and method for providing push service using feedback message
WO2021088641A1 (en) Data transmission method, data processing method, data reception method and device, and storage medium
CN105468302B (en) A kind of method, apparatus and system of processing data
CN109617646A (en) Message forwarding method, device, computer equipment and computer readable storage medium
WO2020259227A1 (en) Thread task communication system, method, and related product
TWI716822B (en) Method and device for correcting transaction causality, and electronic equipment
CN109254854A (en) Asynchronous invoking method, computer installation and storage medium
US8832215B2 (en) Load-balancing in replication engine of directory server
US12001450B2 (en) Distributed table storage processing method, device and system
CN104793982A (en) Method and device for establishing virtual machine
CN112422485B (en) Communication method and device of transmission control protocol
CN104601448A (en) Method and device for handling virtual card
CN102891851A (en) Access control method, equipment and system of virtual desktop
US11743690B2 (en) Publish and subscribe communication system
CN112148206A (en) Data reading and writing method and device, electronic equipment and medium
WO2024067529A1 (en) Rdma-based link establishment method and apparatus, and device and storage medium
JP2017182296A (en) Terminal device control method, terminal device, and program
CN111224881B (en) Routing method, system, equipment and computer readable storage medium
WO2021189253A1 (en) Data transmission method and apparatus
US10733201B1 (en) Dynamic provisioning for data replication groups
CN106933646B (en) Method and device for creating virtual machine
CN112052104A (en) Message queue management method based on multi-computer-room realization and electronic equipment
CN106775835A (en) Obtain method, server and the terminal of upgrade file
CN114116656B (en) Data processing method and related device
CN104539450A (en) Website operation activity processing system, method and device

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 20926948

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205 DATED 28/02/2023)

122 Ep: pct application non-entry in european phase

Ref document number: 20926948

Country of ref document: EP

Kind code of ref document: A1