Search

CN-121996653-A - Index data configuration method and device

CN121996653ACN 121996653 ACN121996653 ACN 121996653ACN-121996653-A

Abstract

The embodiment of the disclosure provides an index data configuration method and device, and relates to the technical field of distributed search. The method is applied to a master node, and comprises the steps of responding to a request operation of index data configuration, traversing and inquiring configuration information of each region, determining the region as a first region, acquiring a master copy, configuring the master copy in the first region, acquiring a slave copy, and configuring the slave copy in a second region if the configuration information of one region is the master copy priority configuration information, wherein the second region is the region except the first region, and the configuration information of the second region is the full-copy priority configuration information. By adopting the technical scheme, the writing operation can be executed in the same area, and the convenience of the writing operation of a user is improved.

Inventors

  • YANG QUANWEN

Assignees

  • 北京金山云网络技术有限公司

Dates

Publication Date
20260508
Application Date
20241106

Claims (10)

  1. 1. An index data configuration method, applied to a master node, comprising: Responding to request operation of index data configuration, traversing and inquiring configuration information of each region, wherein the index data is divided into a plurality of fragments, one of the fragments is a master copy, each master copy is provided with at least one slave copy, the configuration information comprises master copy priority configuration information or full-slave copy priority configuration information, and the number of the master copy priority configuration information is at most one; if the configuration information of one region is primary copy priority configuration information, determining the region as a first region, acquiring a primary copy, and configuring the primary copy in the first region; The method comprises the steps of obtaining a slave copy, and configuring the slave copy in a second area, wherein the second area is an area excluding the first area, and the configuration information of the second area is the full-copy priority configuration information.
  2. 2. The method of claim 1, wherein each of the regions includes a plurality of slave nodes, wherein the obtaining a master copy and configuring the master copy in the first region includes: Acquiring the number of first slave nodes in the first region; And acquiring the master copy and the number of the master copies, and configuring the master copy in the first area according to the number of the master copies and the number of the first slave nodes, wherein the number of the first slave nodes is greater than or equal to the number of the master copies.
  3. 3. The method of claim 2, wherein configuring the master copy in the first region based on the number of master copies and the number of first slave nodes comprises: If the number of the master copies is the same as that of the first slave nodes, configuring one master copy on each of the first slave nodes; and if the number of the master copies is smaller than that of the first slave nodes, selecting slave nodes to be configured from the first slave nodes, and configuring one master copy on each slave node to be configured, wherein the number of the slave nodes to be configured is the same as that of the master copies.
  4. 4. The method of claim 1, wherein the obtaining the slave copy and configuring the slave copy in the second region comprises: acquiring the slave copies and the number of the slave copies, and acquiring the number of second slave nodes in the second region; and configuring the slave copies on the second slave nodes of the second region according to the number of the second slave nodes of the second region and the number of the slave copies.
  5. 5. The method according to claim 4, wherein the method further comprises: And if the number of the slave copies configured on the second slave node is larger than the number of the master copies configured on the first slave node, moving part of the slave copies from the second slave node to the first slave node until the number of the slave copies on the second slave node is dynamically balanced with the number of the full copies on the first slave node, wherein the full copies comprise the master copy and the slave copies.
  6. 6. The method according to claim 1 or 4, characterized in that the method further comprises: And if the unconfigured slave copy exists, configuring the unconfigured slave copy on the first slave node.
  7. 7. The method of claim 1, wherein after the traversing queries the configuration information for each locale, the method further comprises: And if the configuration information of the region does not exist and is the primary copy priority configuration information, acquiring the primary copy and the secondary copy, and dynamically configuring the primary copy and the secondary copy in the first region and the second region until the number of the full copies of the first region and the number of the full copies of the second region are dynamically balanced.
  8. 8. An index data configuration device, applied to a master node, comprising: The system comprises a query module, a search module and a search module, wherein the query module is used for responding to the request operation of index data configuration, and traversing and querying the configuration information of each region, wherein the index data is divided into a plurality of fragments, one of the fragments is a master copy, and each master copy is provided with at least one slave copy; The determining module is used for determining the region as a first region and acquiring a master copy if the configuration information of one region is master copy priority configuration information, and configuring the master copy in the first region; the first configuration module is used for acquiring a slave copy and configuring the slave copy in a second area, wherein the second area is an area excluding the first area, and the configuration information of the second area is the full-copy priority configuration information.
  9. 9. An electronic device, comprising: a processor and a memory, wherein the memory has stored therein a computer program which, when executed by the processor, performs the method of any of claims 1-7.
  10. 10. A computer readable storage medium, characterized in that the storage medium has stored therein a computer program which, when executed by a processor, implements the method according to any of claims 1-7.

Description

Index data configuration method and device Technical Field The embodiment of the disclosure relates to the technical field of distributed search, in particular to an index data configuration method and device. Background At present, the distributed search can provide basic region sensing capability, and the data fragments of the cluster nodes can be automatically distributed according to the configured region information. According to the default zone awareness, all copies of the same partition of an index are not deployed to nodes of the same rack, but cannot satisfy all write operations performed in the same zone. Therefore, there is a need for an index data configuration method, which can execute a writing operation in the same region, so as to improve the convenience of a user writing operation. Disclosure of Invention In order to solve the above technical problems or at least partially solve the above technical problems, an embodiment of the present disclosure provides an index data configuration method and apparatus. A first aspect of an embodiment of the present disclosure provides an index data configuration method, applied to a master node, including: Responding to request operation of index data configuration, traversing and inquiring configuration information of each region, wherein the index data is divided into a plurality of fragments, one of the fragments is a master copy, each master copy is provided with at least one slave copy, the configuration information comprises master copy priority configuration information or full-slave copy priority configuration information, and the number of the master copy priority configuration information is at most one; if the configuration information of one region is primary copy priority configuration information, determining the region as a first region, acquiring a primary copy, and configuring the primary copy in the first region; The method comprises the steps of obtaining a slave copy, and configuring the slave copy in a second area, wherein the second area is an area excluding the first area, and the configuration information of the second area is the full-copy priority configuration information. In one example, each of the regions includes a plurality of slave nodes, the obtaining a master copy and configuring the master copy at the first region includes: Acquiring the number of first slave nodes in the first region; And acquiring the master copy and the number of the master copies, and configuring the master copy in the first area according to the number of the master copies and the number of the first slave nodes, wherein the number of the first slave nodes is greater than or equal to the number of the master copies. In one example, the configuring the master copy in the first region according to the number of master copies and the number of first slave nodes includes: If the number of the master copies is the same as that of the first slave nodes, configuring one master copy on each of the first slave nodes; and if the number of the master copies is smaller than that of the first slave nodes, selecting slave nodes to be configured from the first slave nodes, and configuring one master copy on each slave node to be configured, wherein the number of the slave nodes to be configured is the same as that of the master copies. In one example, the obtaining the slave copy and configuring the slave copy in the second region includes: acquiring the slave copies and the number of the slave copies, and acquiring the number of second slave nodes in the second region; and configuring the slave copies on the second slave nodes of the second region according to the number of the second slave nodes of the second region and the number of the slave copies. In one example, the method further comprises: And if the number of the slave copies configured on the second slave node is larger than the number of the master copies configured on the first slave node, moving part of the slave copies from the second slave node to the first slave node until the number of the slave copies on the second slave node is dynamically balanced with the number of the full copies on the first slave node, wherein the full copies comprise the master copy and the slave copies. In one example, the method further comprises: And if the unconfigured slave copy exists, configuring the unconfigured slave copy on the first slave node. In one example, after the traversing queries the configuration information for each locale, the method further comprises: And if the configuration information of the region does not exist and is the primary copy priority configuration information, acquiring the primary copy and the secondary copy, and dynamically configuring the primary copy and the secondary copy in the first region and the second region until the number of the full copies of the first region and the number of the full copies of the second region are dynamically balanced. A second aspect of an embodi