CN113849388A - Test method and device, electronic equipment and storage medium - Google Patents

Test method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN113849388A
CN113849388A CN202111161859.7A CN202111161859A CN113849388A CN 113849388 A CN113849388 A CN 113849388A CN 202111161859 A CN202111161859 A CN 202111161859A CN 113849388 A CN113849388 A CN 113849388A
Authority
CN
China
Prior art keywords
backup
data
storage medium
original data
target
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202111161859.7A
Other languages
Chinese (zh)
Other versions
CN113849388B (en
Inventor
刘婷
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Kingsoft Cloud Network Technology Co Ltd
Original Assignee
Beijing Kingsoft Cloud Network Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Kingsoft Cloud Network Technology Co Ltd filed Critical Beijing Kingsoft Cloud Network Technology Co Ltd
Priority to CN202111161859.7A priority Critical patent/CN113849388B/en
Publication of CN113849388A publication Critical patent/CN113849388A/en
Application granted granted Critical
Publication of CN113849388B publication Critical patent/CN113849388B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/34Recording or statistical evaluation of computer activity, e.g. of down time, of input/output operation ; Recording or statistical evaluation of user activity, e.g. usability assessment
    • G06F11/3409Recording or statistical evaluation of computer activity, e.g. of down time, of input/output operation ; Recording or statistical evaluation of user activity, e.g. usability assessment for performance assessment
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/14Error detection or correction of the data by redundancy in operation
    • G06F11/1402Saving, restoring, recovering or retrying
    • G06F11/1446Point-in-time backing up or restoration of persistent data
    • G06F11/1448Management of the data involved in backup or backup restore
    • G06F11/1451Management of the data involved in backup or backup restore by selection of backup contents
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/14Error detection or correction of the data by redundancy in operation
    • G06F11/1402Saving, restoring, recovering or retrying
    • G06F11/1446Point-in-time backing up or restoration of persistent data
    • G06F11/1458Management of the backup or restore process
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/34Recording or statistical evaluation of computer activity, e.g. of down time, of input/output operation ; Recording or statistical evaluation of user activity, e.g. usability assessment
    • G06F11/3466Performance evaluation by tracing or monitoring
    • G06F11/3476Data logging
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0668Interfaces specially adapted for storage systems adopting a particular infrastructure
    • G06F3/0671In-line storage system
    • G06F3/0673Single storage device
    • G06F3/0674Disk device
    • G06F3/0676Magnetic disk device

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Quality & Reliability (AREA)
  • Computer Hardware Design (AREA)
  • Human Computer Interaction (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application relates to a test method and device, an electronic device and a storage medium. The method comprises the following steps: receiving a test command; writing operation in a specified storage medium according to the test command so as to write original data in the specified storage medium; executing backup operation on original data in a specified storage medium to create target backup data corresponding to the original data in the cloud host to be tested, and recording backup duration of the backup operation; obtaining the reduction data positioned in the appointed storage medium through the reduction operation of reducing the target backup data to the appointed storage medium; carrying out consistency check on the reduced data and the original data to obtain a check result; and determining the cloud host performance of the cloud host to be tested according to the verification result and the backup time length. The problem that a large amount of labor is consumed and efficiency is low due to manual monitoring when the performance of the cloud host to be tested is tested in the correlation technique can be effectively avoided, and testing efficiency can be effectively improved.

Description

Test method and device, electronic equipment and storage medium
Technical Field
The present application relates to the field of testing technologies, and in particular, to a testing method and apparatus, an electronic device, and a storage medium.
Background
Data backup is the basis of disaster recovery, and refers to a process of copying all or part of data sets in a system from a hard disk or an array of an application host to other storage media in order to prevent data loss caused by misoperation of the system or system failure. Data restore refers to the process of restoring previously made target backup data to the hard disk or array of the host.
The time for data backup and the time for data recovery are one of the main bases for comparing and selecting data backup products by customers. At present, a verification mode for verifying the time for data backup and the time for data recovery needs to log in a virtual machine, firstly, random data writing is carried out on a data disc mounted to the virtual machine, then, backup operation is manually executed, and the time for backup also needs to give rough time by manually observing the backup state all the time.
Aiming at the technical problems that the backup operation needs to be manually executed and the time for backup needs to be manually observed in the related art, an effective solution is not provided at present.
Disclosure of Invention
In order to solve the technical problems that a backup operation needs to be manually executed and the time for backup needs to be manually observed, the application provides a testing method and device, an electronic device and a storage medium.
In a first aspect, an embodiment of the present application provides a testing method, including:
receiving a test command;
writing operation is carried out in a specified storage medium according to the test command so as to write original data in the specified storage medium;
executing backup operation on the original data in the specified storage medium to create target backup data corresponding to the original data in the cloud host to be tested, and recording backup duration of the backup operation;
obtaining the reduction data positioned in the appointed storage medium through the reduction operation of reducing the target backup data to the appointed storage medium;
carrying out consistency check on the reduced data and the original data to obtain a check result;
and determining the cloud host performance of the cloud host to be tested according to the verification result and the backup time length.
Optionally, as in the foregoing method, the test command carries a virtual machine IP, a virtual machine ID, and a virtual machine login password;
the writing of the original data into the specified storage medium according to the test command comprises:
according to the virtual machine IP, a target virtual machine is inquired in the cloud host to be tested;
executing login operation on the target virtual machine through the virtual machine ID and the virtual machine login password;
and taking the data disk mounted by the target virtual machine as a specified storage medium, and writing original data into the specified storage medium.
Optionally, as in the foregoing method, the writing the original data into the specified storage medium in which the test command carries a target data size includes:
calling a preset data generation tool to generate the original data of the target data volume;
and writing the original data into a specified storage medium.
Optionally, as in the foregoing method, the test command further carries a target backup number, and the method further includes:
after the backup operation is performed on the original data in the specified storage medium so as to create target backup data corresponding to the original data in the cloud host to be tested, recording the current backup times;
and if the current backup times do not reach the target backup times, returning to execute the writing of the original data into the specified storage medium according to the test command until the current backup times reach the target backup times.
Optionally, as in the foregoing method, after the performing a backup operation on the original data in the specified storage medium to create target backup data corresponding to the original data in the cloud host under test, the method further includes:
determining a target backup ID corresponding to the target backup data;
before the obtaining of the restored data located in the designated storage medium through the restoring operation of restoring the target backup data to the designated storage medium, the method further includes:
acquiring an ID of a backup to be restored;
and under the condition that the ID of the backup to be restored is the target backup ID, selecting all backup data according to the ID of the backup to be restored to obtain the target backup data.
Optionally, as in the foregoing method, the restoring operation through restoring the target backup data to the specified storage medium includes:
determining reduction starting time and reduction ending time of the reduction operation;
determining reduction duration according to the reduction starting time and the reduction finishing time;
determining the cloud host performance of the cloud host to be tested according to the check result and the backup duration, wherein the determining comprises the following steps:
and determining the cloud host performance of the cloud host to be tested according to the verification result, the backup time length and the restoration time length.
Optionally, as in the foregoing method, after writing the original data into the specified storage medium according to the test command, the method further includes:
carrying out Hash operation on the original data to obtain a first Hash value of the original data;
the consistency check of the restored data and the original data is performed to obtain a check result, and the check result includes:
calculating to obtain a second hash value of the reduction data;
comparing the first hash value with the second hash value, and generating the check result for indicating that the restored data is consistent with the original data when the first hash value is consistent with the second hash value;
and under the condition that the first hash value is not consistent with the second hash value through comparison, generating the check result for indicating that the restored data is not consistent with the original data.
Optionally, as in the foregoing method, after the performing a backup operation on the original data in the specified storage medium to create target backup data corresponding to the original data in the cloud host under test, the method further includes:
and cleaning the original data in the specified storage medium.
In a second aspect, an embodiment of the present application provides a testing apparatus, including:
the receiving module is used for receiving the test command;
the writing module is used for performing writing operation in a specified storage medium according to the test command so as to write original data in the specified storage medium;
the backup module is used for executing backup operation on the original data in the specified storage medium so as to create target backup data corresponding to the original data in the cloud host to be tested and record backup duration of the backup operation;
the restoring module is used for obtaining restoring data located in the specified storage medium through restoring operation of restoring the target backup data to the specified storage medium;
the verification module is used for carrying out consistency verification on the restored data and the original data to obtain a verification result;
and the performance determination module is used for determining the cloud host performance of the cloud host to be tested according to the verification result and the backup time length.
In a third aspect, an embodiment of the present application provides an electronic device, including: the system comprises a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory are communicated with each other through the communication bus;
the memory is used for storing a computer program;
the processor, when executing the computer program, is configured to implement the method according to any of the preceding claims.
In a fourth aspect, the present application provides a computer-readable storage medium, which includes a stored program, where the program is executed to perform the method according to any one of the preceding claims.
Compared with the prior art, the technical scheme provided by the embodiment of the application has the following advantages:
the method provided by the embodiment of the application can automatically execute the backup operation on the original data in the appointed storage medium, can acquire the backup duration of the backup operation, and further can automatically perform consistency check on the original data and the restored data to obtain a check result; finally, the cloud host performance of the cloud host to be tested can be automatically determined according to the backup time length and the verification result; the problems of large labor consumption and low efficiency caused by manual monitoring during performance testing of the cloud host to be tested in the related technology can be effectively solved, and the testing efficiency can be effectively improved.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and together with the description, serve to explain the principles of the invention.
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious for those skilled in the art that other drawings can be obtained according to the drawings without inventive exercise.
Fig. 1 is a schematic flowchart of a testing method according to an embodiment of the present disclosure;
fig. 2 is a schematic flow chart of a testing method according to another embodiment of the present application;
FIG. 3 is a schematic flow chart of a testing method provided in the application example of the present application;
FIG. 4 is a block diagram of a testing apparatus according to an embodiment of the present disclosure;
fig. 5 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are some embodiments of the present application, but not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
According to one aspect of an embodiment of the present application, a test method is provided. Alternatively, in this embodiment, the test method may be applied to a hardware environment formed by a terminal and a server. The server is connected with the terminal through a network, and can be used for providing services (such as data backup services, data restoration services and the like) for the terminal or a client installed on the terminal, and a database can be arranged on the server or independent of the server and is used for providing data storage services for the server.
The network may include, but is not limited to, at least one of: wired networks, wireless networks. The wired network may include, but is not limited to, at least one of: wide area networks, metropolitan area networks, local area networks, which may include, but are not limited to, at least one of the following: WIFI (Wireless Fidelity), bluetooth. The terminal may not be limited to a PC, a mobile phone, a tablet computer, and the like.
The testing method of the embodiment of the application can be executed by the server, the terminal or both. The terminal executing the test method of the embodiment of the present application may also be executed by a client installed thereon.
Taking the server to execute the testing method in this embodiment as an example, fig. 1 is a testing method provided in this embodiment, and includes the following steps:
step S101, receiving a test command;
the test method in this embodiment may be applied to a scenario where the host performance of the cloud host to be tested needs to be determined, for example: the method includes the steps of determining a scene of data backup performance, determining a scene of data reduction performance, determining the scene of data backup performance and the scene of data reduction performance at the same time, and the like, and can also be a scene of determining other performances of the cloud host. In the embodiment of the present application, the test method is described by taking an example of determining the data backup performance and the data recovery performance at the same time, and the test method is also applicable to other types of scenarios of host performance tests without contradiction.
Taking a scenario that the data backup performance and the data reduction performance are determined simultaneously by the amount of the data to be copied as an example, the performance of the cloud host to be tested for data backup and data reduction is determined by reducing the backed-up data.
Before testing the cloud host to be tested, a test command for testing the cloud host to be tested needs to be acquired.
The test command may be a command generated or uploaded manually, so that the script implementing the embodiment can trigger the execution of the subsequent steps according to the test command.
And step S102, writing operation is carried out in the specified storage medium according to the test command so as to write the original data in the specified storage medium.
After the test command is obtained, a write operation to write the original data to the specified storage medium may be triggered.
The designated storage medium may be a data disc for writing the original data, or a partition of a data disc.
The original data may be data written in a specified storage medium in accordance with a test command, and the data amount of the original data may be the data amount specified in the test command, or may be data written in accordance with a preset data amount as long as the test command is received.
For example, when the original data is data written in accordance with the data amount specified in the test command, information for specifying the data amount in the test command may be acquired, and then the original data of the corresponding data amount may be written in accordance with the information; when the original data is data written according to a preset data volume as long as a test command is received, the original data written into the specified storage medium according to the preset data volume can be triggered according to the obtained test command.
Step S103, performing a backup operation on the original data in the specified storage medium to create target backup data corresponding to the original data in the cloud host to be tested, and recording a backup duration of the backup operation.
After the original data is written in the designated storage medium, backup operation for backing up the original data to the cloud host to be tested can be executed.
The backup operation may be to backup the original data into the cloud host to be tested, so as to create target backup data corresponding to the original data in the cloud host to be tested.
The cloud host to be tested can be a cloud host capable of performing data backup and data restoration operations.
The target backup data may be data stored in the cloud host to be tested after backup is performed according to the original data, and the target backup data is consistent with the original data under the condition that no abnormality occurs in the backup operation.
In the process of executing the backup operation, the execution process of the backup operation can be timed, and further the backup duration can be obtained.
For example, after the original data is acquired, a backup operation may be triggered to be executed, where the backup operation may be to backup the original data to any storage location of the cloud host to be tested, and in the process of executing the backup operation, the backup start time and the backup end time of the backup operation are recorded, so as to calculate the backup duration.
And step S104, obtaining the restored data in the specified storage medium through the restoring operation of restoring the target backup data to the specified storage medium.
After the original data are backed up to the cloud host to be tested and the target backup data are obtained, the designated storage medium can be restored through the target backup data, so that the restored data are obtained by writing the target backup data into the designated storage medium, and the purpose of restoring the original data to the designated storage medium is achieved.
Before the restoring operation is carried out, the existing data in the specified storage medium can be cleaned, and when the residual space in the specified storage medium is far larger than the target backup data, the restoring operation can be directly carried out without cleaning.
And step S105, carrying out consistency check on the reduced data and the original data to obtain a check result.
After the restored data is obtained, if no abnormality occurs in the backup operation and the restoring operation, the restored data and the original data should be kept consistent, otherwise, if an abnormality occurs in the backup operation and the restoring operation, the restored data and the original data may be inconsistent, so that in this case, it is stated that the cloud host to be tested cannot achieve the purpose of keeping the data consistency at the most basic level.
The consistency check can be a check process of comparing the reduced data with the original data to judge whether the reduced data and the original data are consistent; and after the consistency check, a check result for indicating whether the restored data and the original data are consistent can be obtained.
For example, the verification result may be obtained by comparing the data consistency of each byte in the restored data and the original data, or the verification result may be obtained by comparing the consistency between the information obtained by encoding the restored data in the preset encoding manner and the information obtained by encoding the original data in the preset encoding manner.
And S106, determining the cloud host performance of the cloud host to be tested according to the verification result and the backup time length.
After the verification result and the backup time length are obtained, the cloud host performance of the cloud host to be tested can be determined according to the verification result and the backup time length.
The cloud host performance may be an index for indicating performance of the cloud host in data backup and data restoration.
Since the indexes used for calculating the cloud host performance include a plurality of indexes, the cloud host performance can be determined by weighting each index.
For example, the weight corresponding to the verification result (e.g., n1) and the weight corresponding to the backup duration (e.g., n2) may be predetermined, and when the verification result is consistent, the verification result is 1, otherwise, the verification result is 0; in addition, in order to evaluate the backup performance more accurately, the backup amount per unit time (for example, 18M/s) may be calculated according to the backup duration and the data amount of the original data, and then the score of the backup amount per unit time may be determined according to scores corresponding to different preset backup amounts per unit time (for example, 0.5 when less than 10M/s, 0.6 when more than 10M/s and less than 20M/s, … … when more than 100M/s are 1) in advance, and then when the check results are consistent, the score of the cloud host performance may be calculated to be n1+0.6n 2.
By the method in the embodiment, the backup operation can be automatically executed on the original data in the designated storage medium, the backup duration of the backup operation can be acquired, and further, consistency check can be automatically performed on the original data and the restored data to obtain a check result; finally, the cloud host performance of the cloud host to be tested can be automatically determined according to the backup time length and the verification result; the problems of large labor consumption and low efficiency caused by manual monitoring during performance testing of the cloud host to be tested in the related technology can be effectively solved, and the testing efficiency can be effectively improved.
As an optional implementation manner, as in the foregoing method, the test command carries a virtual machine IP, a virtual machine ID, and a virtual machine login password;
the step S102 writes original data into a specified storage medium according to the test command, and includes the following steps:
step S201, according to the IP of the virtual machine, a target virtual machine is inquired in the cloud host to be tested;
step S202, the login operation is executed to the target virtual machine through the virtual machine ID and the virtual machine login password.
When the test is carried out on the virtual machine through mounting, the IP of the virtual machine, the ID of the virtual machine and the login password of the virtual machine can be written in the generation process of the test command; querying a target virtual machine in the cloud host to be tested through the IP (internet protocol) of the virtual machine (namely, the address of the virtual machine); and executing login operation on the target virtual machine through the virtual machine ID and the virtual machine login password. And then the data backup and data restoration operations are conveniently carried out through the target virtual machine in the later period.
The target virtual machine may be a virtual machine provided in the cloud host, or may be a virtual machine provided at a local end.
For example, the target virtual machine can be logged in by using the paramiko module ssh in python according to the virtual machine IP, the virtual machine ID and the virtual machine login password.
In step S203, the data disk mounted in the target virtual machine is used as a designated storage medium, and the original data is written into the designated storage medium.
After logging in the target virtual machine, the data disk mounted under the target virtual machine can be determined, the data disk is used as a formulated storage medium, and original data are written in the formulated storage medium according to the test command.
Moreover, different target virtual machines can be simultaneously logged in to test a plurality of different cloud hosts to be tested, and further, the purpose of testing all the cloud hosts to be tested in parallel is achieved.
By the method in the embodiment, a method for testing the cloud host to be tested through the virtual machine is provided, and a plurality of different cloud hosts to be tested can be respectively tested through a plurality of target virtual machines, so that the aim of testing all the cloud hosts to be tested in parallel is fulfilled, and the testing efficiency is further improved.
As an optional implementation manner, as in the foregoing method, the test command carries a target data volume, and the step S102 writes original data into a specified storage medium according to the test command, including the following steps:
step S301, a preset data generation tool is called to generate raw data of a target data volume.
Step S302, writing the original data into the designated storage medium.
After the test command is obtained, the original data needs to be written into the specified storage medium, so as to execute the backup operation according to the original data.
The target data amount is written in the generation process of the test command to specify the data amount of the original data required to be generated by the target data amount.
After the test command is obtained, the test command may be analyzed to obtain a target data volume therein, and further, original data of the target data volume may be randomly generated by a data generation tool (e.g., a fio tool), so that the original data of the target data volume may be written into a specified storage medium at a later stage, optionally, each time data of a preset data volume is generated, that is, the generated data volume is written into the specified storage medium until complete original data is written into the specified storage medium; after all the data of the original data are generated, the original data may be uniformly written into the designated storage medium.
By the method in the embodiment, the purpose of writing the corresponding original data according to the target data volume can be achieved, and further, the test of data backup and data recovery can be performed through the data with different data volumes.
As shown in fig. 2, as an optional implementation manner, in the foregoing method, the test command further carries a target backup number, and the method further includes the following steps:
step S401, after performing a backup operation on the original data in the specified storage medium to create target backup data corresponding to the original data in the cloud host to be tested, recording a current backup frequency.
For the same cloud host to be tested, multiple backup operations can be performed to obtain the backup duration corresponding to each backup operation.
And writing the target backup times in the generation process of the test command so as to execute the backup operation of the target backup times on the cloud host to be tested.
In order to determine whether the backup operation of the target backup times is performed, after target backup data corresponding to the original data is created in the cloud host to be tested, the backup times (including the current backup operation) performed so far may be recorded.
For example, an argument (with an initial value of 1) corresponding to the number of times of backup may be preset, so that 1 may be added to the argument after each backup operation is performed, so as to achieve the purpose of counting the current number of times of backup.
Step S402, if the current backup times do not reach the target backup times, executing a first jump operation for jumping to a specified storage medium for writing operation according to the test command until the current backup times reach the target backup times;
in step S403, if the current backup frequency reaches the target backup frequency, a second jump operation for jumping to a restore operation for restoring the target backup data to the specified storage medium to obtain restored data located in the specified storage medium is performed.
When the current backup frequency does not reach the target backup frequency, it indicates that the backup operation needs to be executed again, that is, step S102 needs to be executed again to write the original data into the specified storage medium according to the test command, that is, new original data is written into the storage medium again according to the test command, and step S103 is executed again according to the new original data to perform the backup operation.
And when the current backup frequency reaches the target backup frequency, executing a second jump operation to jump to the step S104 to obtain the restored data in the specified storage medium through the restoring operation of restoring the target backup data to the specified storage medium.
By the method in the embodiment, the backup operation of the target backup times can be executed according to the times of the required backup, namely the target backup times, so that the aim of automatically carrying out multiple backups can be fulfilled.
As an optional implementation manner, as in the foregoing method, after the step S103 performs a backup operation on the original data in the specified storage medium to create target backup data corresponding to the original data in the cloud host to be tested, the method further includes the following steps:
step S511 determines a target backup ID corresponding to the target backup data.
After the target backup data is obtained, in order to conveniently select the target backup data in the later period, the target backup data can be identified, and a target backup ID corresponding to the target backup data is obtained; and the target backup data and the target backup ID have a unique corresponding relation.
The target backup ID may be generated according to the backup time of the target backup data, may be generated according to the backup order, or may be generated according to the identification information of the original data to be backed up.
Optionally, after generating the target backup ID, an index of the target backup data and the target backup ID correspondence may be stored in a python data type dictionary.
Before the restore data located in the designated storage medium is obtained through the restore operation of restoring the target backup data to the designated storage medium, the method further includes the following steps:
step S521, obtaining a backup ID to be restored;
in step S522, when the to-be-restored backup ID is the target backup ID, the target backup data is selected from all backup data according to the to-be-restored backup ID.
Before a restore operation needs to be performed on a specified storage medium, data for the restore needs to be determined.
Therefore, the backup ID to be restored may be acquired first.
The backup ID to be restored may be a target backup ID of backup data for restoration.
When the backup ID to be restored is the target backup ID, it indicates that the designated storage medium needs to be restored by the target backup data, and further, the target backup data can be selected from all backup data according to the backup ID to be restored.
For example, when the restore operation is performed, when the index of the backup data and the backup ID are stored in the python data type dictionary correspondingly, and the to-be-restored backup ID is the target backup ID, the to-be-restored backup ID can be queried in all backup IDs to obtain a matching backup ID corresponding to the to-be-restored backup ID, so that the target index of the target backup data corresponding to the matching backup ID can be obtained, and the target backup data can be obtained according to the target index.
By the method of the embodiment, the backup data is identified by the backup ID, so that the efficiency of acquiring the backup data can be effectively improved, and the efficiency of later-stage data restoration can be improved.
As an alternative implementation manner, as the foregoing method, the step S104 includes a restore operation of restoring the target backup data to the specified storage medium, and includes the following steps:
step S601, determining reduction starting time and reduction finishing time of reduction operation;
step S602, determining the reduction duration according to the reduction starting time and the reduction ending time.
In the process of executing the reduction operation, the execution process of the reduction operation can be timed, the reduction starting time is obtained by timing when the reduction operation starts, and the reduction ending time is obtained by timing when the reduction operation ends; and finally, determining the reduction duration by determining the time difference between the reduction ending time and the reduction starting time.
The step S106 determines the cloud host performance of the cloud host to be tested according to the verification result and the backup duration, and includes:
and determining the cloud host performance of the cloud host to be tested according to the verification result, the backup time length and the restoration time length.
After the check result, the backup time length and the restoration time length are obtained, the backup performance of the cloud host to be detected can be determined according to the backup time length, the restoration performance of the cloud host to be detected can be determined according to the restoration time length, and then the cloud host performance of the cloud host to be detected can be determined according to the check result, the backup time length and the restoration time length.
For example, a weight (e.g., 0.2) corresponding to the verification result, a weight (e.g., 0.4) corresponding to the backup duration, and a weight (e.g., 0.4) corresponding to the restore duration may be predetermined, and when the verification results are consistent, the verification result is 1, otherwise, the verification result is 0; moreover, for more accurate evaluation of backup performance, the backup amount per unit time (e.g., 18M/s) may be calculated according to the backup duration and the data amount of the original data, then the score corresponding to different predetermined backup amounts per unit time (e.g., 0.5 less than 10M/s, 0.6 greater than 10M/s and 20M/s, … …, and 1 greater than 100M/s) is predetermined, and similarly, the backup amount per unit time (e.g., 22M/s) may be calculated according to the restore duration and the data amount of the target backup data, and then the score corresponding to different predetermined backup amounts per unit time (e.g., 0.5 less than 10M/s, 0.6 greater than 10M/s and 20M/s, and 0.7 greater than 20M/s and 30M/s, 0.7, … …, more than 100M/s is 1), the score of the portion per unit time is determined, and when the check result is consistent, the score for indicating the performance of the cloud host can be calculated to be 0.2 × 0.2+0.4 × 0.6+0.4 × 0.7-0.56.
By the method in the embodiment, the restoration time length can be increased on the basis of the verification result and the backup time length to determine the cloud host performance of the cloud host to be tested, so that the multidimensional evaluation of the cloud host to be tested can be improved, and the comprehensiveness of the evaluation is improved.
As an alternative implementation manner, as the foregoing method, after the step S102 writes the original data into the specified storage medium according to the test command, the method further includes the following steps:
in step S711, a hash operation is performed on the original data to obtain a first hash value of the original data.
After the original data are written into the designated storage medium according to the test command, the complete original data in the designated storage medium can be determined, and further, the hash operation can be performed on the original data to obtain a first hash value of the original data.
Further, when the original data is written into the designated storage medium by the target virtual machine, since the original data is actually written into the cache when the data is written by the virtual machine, after the first hash value of the original data is obtained, the data disk corresponding to the designated storage medium may be unloaded, so that the original data is written into the target storage medium from the cache. And when the current process is used for executing the subsequent data backup operation, the login of the target virtual machine needs to be quitted, so that the data backup operation is executed through the process, and when another process is used for executing the subsequent data backup operation, the login of the target virtual machine does not need to be quitted.
For example, the MD5 value (e.g., X1) of the raw data may be obtained by MD5sum, and X1 is taken as the first hash value.
And carrying out consistency check on the restored data and the original data to obtain a check result, wherein the check result comprises the following steps:
step S721, calculating a second hash value of the restored data;
step S722, comparing the first hash value with the second hash value, and generating a check result indicating that the restored data is consistent with the original data when the first hash value is consistent with the second hash value;
in step S723, in a case that the first hash value is inconsistent with the second hash value, a check result indicating that the restored data is inconsistent with the original data is generated.
After the reduced data is obtained, hash calculation may be performed on the reduced data to obtain a second hash value of the reduced data. Moreover, the calculation method of performing the hash calculation on the restored data is the same as the calculation method of performing the hash calculation on the original data.
After the second hash value is obtained, the first hash value and the second hash value can be compared, and a check result used for indicating that the reduced data is consistent with the original data is generated under the condition that the first hash value is consistent with the second hash value; and under the condition that the first hash value is not consistent with the second hash value through comparison, generating a check result for indicating that the restored data is not consistent with the original data.
For example, the MD5 value (e.g., X2) of the restored data may be obtained by MD5sum, and X2 is taken as the second hash value.
When X2 is X1, generating a check result indicating that the restored data is consistent with the original data; when X2 ≠ X1, a check result indicating that the restored data is inconsistent with the original data is generated.
By the method in the embodiment, the purposes of comparing the reduced data with the original data and verifying whether the reduced data is consistent with the original data or not can be achieved based on the comparison between the second hash value of the reduced data and the first hash value of the original data.
As an optional implementation manner, as in the foregoing method, after performing a backup operation on original data in a specified storage medium to create target backup data corresponding to the original data in a cloud host to be tested, the method further includes the following steps:
in step S801, the original data in the designated storage medium is cleaned.
After executing backup operation on original data in a specified storage medium, if another backup operation needs to be performed on the specified storage medium or a restore operation needs to be performed, the data needs to be continuously written in the specified storage medium; in order to avoid that the remaining storage space in the designated storage medium is not enough to store new original data or restored data which needs to be written for performing another backup operation, the original data in the designated storage medium can be cleaned.
By the method in the embodiment, the condition that the residual storage space of the specified storage medium is enough to write new data can be effectively ensured.
As shown in fig. 3, an application example applying the method of the foregoing embodiment is further provided:
p1, transmitting a virtual machine IP, a virtual machine ID, a virtual machine login password, a data size date, and a required backup number count (i.e., a target backup number) into a script for testing the cloud host to be tested;
p2, logging in the target virtual machine by using a paramiko module ssh in python through the virtual machine IP, the virtual machine ID and the virtual machine login password;
p3, performing random write operation on a disk (i.e., a designated storage medium) by using a fio tool through the data size date to obtain original data, and acquiring an MD5 value (i.e., a first hash value) of the original data through MD5sum after the random write operation is completed;
p4, then unloading (umount) the disk, and quitting logging to connect the target virtual machine;
p5., performing backup operation on the target virtual machine, backing up the original delivery to the target cloud host, obtaining a target backup ID, storing the target backup ID in a python data type dictionary, and calculating the backup duration by recording the starting backup time and the ending backup time of the backup operation;
and P6, logging in the target virtual machine again, mounting the disk on the target virtual machine according to the drive letter of the disk, and cleaning data of the disk;
p7, judging whether the current backup times reach the required backup times count, and circulating the operation according to the required backup times count;
and P8, finally, selecting the backup ID to be restored for restoration operation according to the requirement, inquiring a backup index corresponding to the backup ID to be restored in the dictionary, calculating restoration duration by recording the restoration starting time and the restoration ending time, acquiring an MD5 value (namely a second hash value) of restored data, comparing the MD5 value with the MD5 value of the original data, checking the data consistency, and further obtaining the cloud host performance of the target cloud host.
As shown in fig. 4, according to an embodiment of another aspect of the present application, there is also provided a test apparatus including:
the receiving module 1 is used for receiving a test command;
the writing module 2 is used for performing writing operation in the specified storage medium according to the test command so as to write original data in the specified storage medium;
the backup module 3 is used for executing backup operation on the original data in the specified storage medium so as to create target backup data corresponding to the original data in the cloud host to be tested, and recording backup duration of the backup operation;
the restoring module 4 is used for obtaining restoring data located in the specified storage medium through restoring operation of restoring the target backup data to the specified storage medium;
the checking module 5 is used for checking consistency of the restored data and the original data to obtain a checking result;
and the performance determining module 6 is used for determining the cloud host performance of the cloud host to be tested according to the verification result and the backup time length.
Specifically, the specific process of implementing the functions of each module in the apparatus according to the embodiment of the present invention may refer to the related description in the method embodiment, and is not described herein again.
According to another embodiment of the present application, there is also provided an electronic apparatus including: as shown in fig. 5, the electronic device may include: the system comprises a processor 1501, a communication interface 1502, a memory 1503 and a communication bus 1504, wherein the processor 1501, the communication interface 1502 and the memory 1503 complete communication with each other through the communication bus 1504.
A memory 1503 for storing a computer program;
the processor 1501 is configured to implement the steps of the above-described method embodiments when executing the program stored in the memory 1503.
The bus mentioned in the electronic device may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown, but this does not mean that there is only one bus or one type of bus.
The communication interface is used for communication between the electronic equipment and other equipment.
The Memory may include a Random Access Memory (RAM) or a Non-Volatile Memory (NVM), such as at least one disk Memory. Optionally, the memory may also be at least one memory device located remotely from the processor.
The Processor may be a general-purpose Processor, including a Central Processing Unit (CPU), a Network Processor (NP), and the like; but also Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field Programmable Gate Arrays (FPGAs) or other Programmable logic devices, discrete Gate or transistor logic devices, discrete hardware components.
The embodiment of the present application further provides a computer-readable storage medium, where the storage medium includes a stored program, and when the program runs, the method steps of the above method embodiment are executed.
It is noted that, in this document, relational terms such as "first" and "second," and the like, may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
The foregoing are merely exemplary embodiments of the present invention, which enable those skilled in the art to understand or practice the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the invention. Thus, the present invention is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims (11)

1. A method of testing, comprising:
receiving a test command;
writing operation is carried out in a specified storage medium according to the test command so as to write original data in the specified storage medium;
executing backup operation on the original data in the specified storage medium to create target backup data corresponding to the original data in the cloud host to be tested, and recording backup duration of the backup operation;
obtaining the reduction data positioned in the appointed storage medium through the reduction operation of reducing the target backup data to the appointed storage medium;
carrying out consistency check on the reduced data and the original data to obtain a check result;
and determining the cloud host performance of the cloud host to be tested according to the verification result and the backup time length.
2. The method of claim 1, wherein the test command carries a virtual machine IP, a virtual machine ID, and a virtual machine login password;
the writing of the original data into the specified storage medium according to the test command comprises:
according to the virtual machine IP, a target virtual machine is inquired in the cloud host to be tested;
executing login operation on the target virtual machine through the virtual machine ID and the virtual machine login password;
and taking the data disk mounted by the target virtual machine as a specified storage medium, and writing original data into the specified storage medium.
3. The method according to claim 1, wherein the test command carries a target data volume, and the writing operation in the specified storage medium according to the test command to write the original data in the specified storage medium comprises:
calling a preset data generation tool to generate the original data of the target data volume;
and writing the original data into a specified storage medium.
4. The method of claim 1, wherein the test command further carries a target number of backups, the method further comprising:
after the backup operation is performed on the original data in the specified storage medium so as to create target backup data corresponding to the original data in the cloud host to be tested, recording the current backup times;
if the current backup times do not reach the target backup times, executing a first jump operation for jumping to the writing operation in a specified storage medium according to the test command until the current backup times reach the target backup times;
and if the current backup times reach the target backup times, executing a second jump operation for jumping to the reduction operation for reducing the target backup data to the specified storage medium to obtain the reduction data in the specified storage medium.
5. The method according to claim 4, wherein after the performing a backup operation on the original data in the designated storage medium to create target backup data corresponding to the original data in the cloud host under test, the method further comprises:
determining a target backup ID corresponding to the target backup data;
before the obtaining of the restored data located in the designated storage medium through the restoring operation of restoring the target backup data to the designated storage medium, the method further includes:
acquiring an ID of a backup to be restored;
and under the condition that the ID of the backup to be restored is the target backup ID, selecting all backup data according to the ID of the backup to be restored to obtain the target backup data.
6. The method of claim 1, wherein the restore operation by restoring the target backup data to the specified storage medium comprises:
determining reduction starting time and reduction ending time of the reduction operation;
determining reduction duration according to the reduction starting time and the reduction finishing time;
determining the cloud host performance of the cloud host to be tested according to the check result and the backup duration, wherein the determining comprises the following steps:
and determining the cloud host performance of the cloud host to be tested according to the verification result, the backup time length and the restoration time length.
7. The method of claim 1, wherein after said writing original data to a specified storage medium according to said test command, said method further comprises:
carrying out Hash operation on the original data to obtain a first Hash value of the original data;
the consistency check of the restored data and the original data is performed to obtain a check result, and the check result includes:
calculating to obtain a second hash value of the reduction data;
comparing the first hash value with the second hash value, and generating the check result for indicating that the restored data is consistent with the original data when the first hash value is consistent with the second hash value;
and under the condition that the first hash value is not consistent with the second hash value through comparison, generating the check result for indicating that the restored data is not consistent with the original data.
8. The method according to claim 4, wherein after the performing a backup operation on the original data in the designated storage medium to create target backup data corresponding to the original data in the cloud host under test, the method further comprises:
and cleaning the original data in the specified storage medium.
9. A test apparatus, comprising:
the receiving module is used for receiving the test command;
the writing module is used for performing writing operation in a specified storage medium according to the test command so as to write original data in the specified storage medium;
the backup module is used for executing backup operation on the original data in the specified storage medium so as to create target backup data corresponding to the original data in the cloud host to be tested and record backup duration of the backup operation;
the restoring module is used for obtaining restoring data located in the specified storage medium through restoring operation of restoring the target backup data to the specified storage medium;
the verification module is used for carrying out consistency verification on the restored data and the original data to obtain a verification result;
and the performance determination module is used for determining the cloud host performance of the cloud host to be tested according to the verification result and the backup time length.
10. An electronic device, comprising: the system comprises a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory are communicated with each other through the communication bus;
the memory is used for storing a computer program;
the processor, when executing the computer program, implementing the method of any of claims 1 to 8.
11. A computer-readable storage medium, characterized in that the storage medium comprises a stored program, wherein the program when executed performs the method of any of the preceding claims 1 to 8.
CN202111161859.7A 2021-09-30 2021-09-30 Test method and device, electronic equipment and storage medium Active CN113849388B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111161859.7A CN113849388B (en) 2021-09-30 2021-09-30 Test method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111161859.7A CN113849388B (en) 2021-09-30 2021-09-30 Test method and device, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN113849388A true CN113849388A (en) 2021-12-28
CN113849388B CN113849388B (en) 2024-09-13

Family

ID=78977464

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111161859.7A Active CN113849388B (en) 2021-09-30 2021-09-30 Test method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN113849388B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117349085A (en) * 2023-12-01 2024-01-05 杭州云动智能汽车技术有限公司 Data storage method, data backup method and device
CN117995261A (en) * 2024-03-21 2024-05-07 星汉智能科技股份有限公司 Smart card power-off test method and device and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
GB2345786A (en) * 1999-01-16 2000-07-19 Inventec Corp Testing floppy disks
US20070268762A1 (en) * 2006-05-19 2007-11-22 Fujitsu Limited Semiconductor memory and method for testing the same
CN103455577A (en) * 2013-08-23 2013-12-18 中国科学院计算机网络信息中心 Multi-backup nearby storage and reading method and system of cloud host mirror image file
CN109582524A (en) * 2019-01-07 2019-04-05 郑州云海信息技术有限公司 A kind of test method, system and electronic equipment and storage medium
CN112231143A (en) * 2020-09-24 2021-01-15 北京金山云网络技术有限公司 Backup method and device of cloud host and electronic equipment

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
GB2345786A (en) * 1999-01-16 2000-07-19 Inventec Corp Testing floppy disks
US20070268762A1 (en) * 2006-05-19 2007-11-22 Fujitsu Limited Semiconductor memory and method for testing the same
CN103455577A (en) * 2013-08-23 2013-12-18 中国科学院计算机网络信息中心 Multi-backup nearby storage and reading method and system of cloud host mirror image file
CN109582524A (en) * 2019-01-07 2019-04-05 郑州云海信息技术有限公司 A kind of test method, system and electronic equipment and storage medium
CN112231143A (en) * 2020-09-24 2021-01-15 北京金山云网络技术有限公司 Backup method and device of cloud host and electronic equipment

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
谭文贵;王琨;黄英港;: "一种基于云存储方式进行数据备份的研究及实现", 电子技术与软件工程, no. 17, 31 December 2017 (2017-12-31) *

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117349085A (en) * 2023-12-01 2024-01-05 杭州云动智能汽车技术有限公司 Data storage method, data backup method and device
CN117349085B (en) * 2023-12-01 2024-03-05 杭州云动智能汽车技术有限公司 Data storage method, data backup method and device
CN117995261A (en) * 2024-03-21 2024-05-07 星汉智能科技股份有限公司 Smart card power-off test method and device and storage medium

Also Published As

Publication number Publication date
CN113849388B (en) 2024-09-13

Similar Documents

Publication Publication Date Title
WO2018000607A1 (en) Method and electronic apparatus for identifying test case failure causes
CN113849388B (en) Test method and device, electronic equipment and storage medium
CN112148542B (en) Reliability testing method, device and system for distributed storage cluster
US10528416B2 (en) Checking data integrity of data storage systems
US9558852B2 (en) Method and apparatus for defect repair in NAND memory device
CN111176918A (en) Server testing method, system, equipment and computer readable storage medium
CN113472607A (en) Application program network environment detection method, device, equipment and storage medium
WO2024183701A1 (en) Raid inspection method and inspection apparatus, and electronic device
CN107256723A (en) A kind of method of testing and device for storing product
CN110910249B (en) Data processing method and device, node equipment and storage medium
CN107423176B (en) Memory test method, control terminal, server and system
CN109150587B (en) Maintenance method and device
CN114064435A (en) Database test method, device, medium and electronic equipment
CN110287164B (en) Data recovery method and device and computer equipment
CN115391110A (en) Test method of storage device, terminal device and computer readable storage medium
CN115314289A (en) Attacked executor identifying method, output voter, equipment and storage medium
CN115017018A (en) Method and device for testing performance of server and computer readable storage medium
CN114218011A (en) Test simulation method and device, terminal equipment and storage medium
CN114281611A (en) Method, system, equipment and storage medium for comprehensively detecting system disk
CN112463444A (en) Data inconsistency repairing method and related device
CN110362464B (en) Software analysis method and equipment
CN111858136A (en) Method and system for detecting abnormal data of solid state disk, electronic device and storage medium
CN113407411B (en) Device and method for monitoring accuracy of online data in live broadcast scene
CN112769655B (en) Network variation testing method, device and system
CN115525529A (en) Business object testing method and device and electronic equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant