Data storage method, device, storage medium, program, and electronic device
By dynamically configuring RAID levels and hard drive groups based on data importance and performance requirements, combined with backup strategies and RAID controllers, the problem of unreasonable hard drive resource allocation is solved, achieving efficient utilization of hard drive resources and secure storage of critical data.
Patent Information
- Application Number
- CN202411894773.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-20
- Publication Date
- 2025-11-25
- Estimated Expiration
- 2044-12-20
AI Technical Summary
In traditional storage methods, the unreasonable allocation of hard disk resources may lead to security risks for critical business data due to insufficient resource allocation, while non-critical data consumes too many storage resources, resulting in resource waste and making it difficult to achieve ideal performance in modern business scenarios such as high concurrency and low latency.
The RAID level is determined based on the data importance and performance requirements of message packets in the target business, and hard disk groups that meet the requirements of each RAID level are configured for the server. The target RAID level and hard disk groups are selected for storage based on security level indicators, and hard disk resource utilization is optimized by combining different backup strategies and RAID controller configurations.
This achieves a reasonable allocation of hard disk resources, avoids waste and uneven use, improves the utilization and efficiency of hard disk resources, and ensures the security of critical data and the stability of the system.
Smart Images

Figure CN119806419B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of storage, in particular to a data storage method, a storage device, a computer readable storage medium, a computer program product and an electronic device. BACKGROUND
[0002] The conventional storage mode backs up different message packets by using a same set of hard disks, and such extensive resource allocation mode causes the key business data to face security risks due to insufficient resource allocation, and the non-key data may occupy too many storage resources, resulting in resource waste. When facing modern business scenarios such as high concurrency and low delay, the storage system often fails to achieve ideal performance, affecting the continuity of business and user experience. SUMMARY
[0003] The main purpose of the present application is to provide a data storage method, a storage device, a computer readable storage medium, a computer program product and an electronic device, so as to at least solve the problem of unreasonable hard disk resource allocation in the prior art, resulting in poor hard disk resource utilization.
[0004] In order to achieve the above-mentioned purpose, according to one aspect of the present application, a data storage method is provided, comprising: determining a plurality of RAID (Redundant Arrays of Independent Disks) levels according to the data importance of a plurality of message packets in a target business and the performance requirement level of each message packet to a server, and configuring a hard disk group meeting each RAID level for the server, the performance requirement level including the requirement level of read-write rate and the requirement level of delay rate, the server being used to execute the target business, and one hard disk group including at least one hard disk; in the case that the server receives a target message packet sent by a device end, determining a security level index according to the data importance, data access frequency and data recovery time target of the target message packet, the security level index being an index for evaluating the required security level of the message packet, the target message packet being part of the plurality of message packets; determining a target RAID level from the plurality of RAID levels according to the security level index, and determining the hard disk group corresponding to the target RAID level as a target hard disk group, and storing the target message packet by using the target hard disk group, the target RAID level being one of the plurality of RAID levels.
[0005] Optionally, the data importance of the message package comprises a first degree, a second degree and a third degree, the degrees of importance represented by the first degree, the second degree and the third degree are in turn decreasing, after the server is configured with the hard disk groups satisfying the RAID levels, the method further comprises: determining the backup strategy and the backup frequency of the RAID level corresponding to each of the message packages according to the data importance of the plurality of message packages, the backup strategy comprises: using full backup when the data importance of the message package is the first degree, using incremental backup when the data importance of the message package is the second degree, and using differential backup when the data importance of the message package is the third degree.
[0006] Optionally, the security level indicator is determined according to the data importance, the data access frequency and the data recovery time target of the target message package, comprising: determining a first score as a score corresponding to an importance degree range in which the data importance of the target message package is located according to a first correspondence relationship, the first correspondence relationship being a correspondence relationship between importance degree ranges and scores; determining a second score as a score corresponding to a frequency range in which the data access frequency of the target message package is located according to a second correspondence relationship, the second correspondence relationship being a correspondence relationship between frequency ranges and scores; determining a third score as a score corresponding to a time range in which the data recovery time target of the target message package is located according to a third correspondence relationship, the third correspondence relationship being a correspondence relationship between time ranges and scores; and determining the security level indicator as a sum of the first score, the second score and the third score.
[0007] Optionally, the server is configured with the hard disk groups satisfying the RAID levels, comprising: configuring the server with the number and capacity of hard disks corresponding to each of the RAID levels according to the plurality of RAID levels.
[0008] Optionally, after the server is configured with the hard disk groups satisfying the RAID levels, the method further comprises: deploying a RAID controller on the server and configuring parameters of the RAID controller, the parameters of the RAID controller comprising at least one of the following: stripe size, check mode; and mounting critical data on the server to the RAID, the critical data comprising at least one of the following: database, log file.
[0009] Optionally, before determining the security level index according to the data importance, data access frequency and data recovery time target of the target message package, the method further comprises: performing data decoding on the message package to obtain JSON object data in string format; performing data parsing on the JSON object data to obtain key value information in the JSON object; and performing data verification on the key value information, the data verification comprising: data integrity verification, data format verification, data content verification and data security verification, the data content verification comprising: verifying whether the ID of the key value information is from a legal device, whether the key value information is within a preset range and whether the update time of the key value information is within a preset time period.
[0010] According to another aspect of the present application, a data storage device of a smart home device is provided, comprising: a first determining unit configured to determine a plurality of RAID levels according to data importance of a plurality of message packages in a target service and a performance requirement level of each of the message packages on a server, and configure the server with hard disk groups satisfying each of the RAID levels, the performance requirement level comprising: a requirement level of read-write speed and a requirement level of delay rate, the server being configured to execute the target service, and each of the hard disk groups comprising at least one hard disk; a second determining unit configured to, in a case where the server receives a target message package sent by a device end, determine a security level index according to data importance, data access frequency and data recovery time target of the target message package, the security level index being an index for evaluating a required security level of the message package, the target message package being part of the plurality of message packages; and a storage unit configured to determine a target RAID level from the plurality of RAID levels according to the security level index, determine a target hard disk group corresponding to the target RAID level as a target hard disk group, and store the target message package by using the target hard disk group, the target RAID level being one of the plurality of RAID levels.
[0011] According to still another aspect of the present application, a computer readable storage medium is provided, the computer readable storage medium comprising a stored program, wherein the program, when executed, controls a device where the computer readable storage medium is located to perform any of the methods.
[0012] According to yet another aspect of the present application, a computer program product is provided, comprising computer instructions, the computer instructions being executed by a processor to implement any of the methods.
[0013] According to another aspect of the present application, an electronic device includes one or more processors, a memory, and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, and the one or more programs include any one of the methods.
[0014] According to the technical solution of the present application, first, the multiple RAID levels are determined according to the data importance of the multiple message packets in the target service and the performance requirements such as read-write speed and delay rate of the server, then the corresponding hard disk groups are configured for the server according to the determined multiple RAID levels, in the case of receiving the target message packet sent by the device, the security level index of the target message packet is determined according to the data importance, data access frequency and data recovery time target of the target message packet, finally, the target RAID level is determined from the multiple RAID levels according to the security level index, the target hard disk group corresponding to the target RAID level is determined, and the target message packet is stored by using the hard disk group. According to the characteristics and requirements of the data, the RAID level is dynamically selected, the reasonable configuration of the hard disk resources is realized, the full use of the hard disk space of the server is ensured, the waste and unbalanced use of the hard disk space are avoided, and the utilization rate and efficiency of the hard disk resources are improved. BRIEF DESCRIPTION OF DRAWINGS
[0015] The accompanying drawings, which form a part of the present description, are included to provide a further understanding of the application and are incorporated in and constitute a part of this application. The embodiments of the present application, and their
[0016] Figure 1 A hardware structure block diagram of a mobile terminal for executing a data storage method provided in an embodiment of the present application is shown;
[0017] Figure 2 A flowchart of a data storage method provided in an embodiment of the present application is shown;
[0018] Figure 3 A flowchart of a data storage method provided in an embodiment of the present application is shown;
[0019] Figure 4 A schematic diagram of a data storage device of a smart home device provided in an embodiment of the present application is shown.
[0020] Among the above drawings, the following reference signs are included:
[0021] 102, processor; 104, memory; 106, transmission device; 108, input and output device. DETAILED DESCRIPTION
[0022] It should be noted that, unless otherwise specified, the embodiments and features described in this application can be combined with each other. This application will now be described in detail with reference to the accompanying drawings and embodiments.
[0023] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.
[0024] It should be noted that the terms "first," "second," etc., used in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be used interchangeably where appropriate for the embodiments of this application described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0025] As described in the background section, the existing technology has unreasonable hard disk resource configuration. In order to solve the above technical problems, the embodiments of this application provide a data storage method, a storage device, a computer-readable storage medium, a computer program product, and an electronic device.
[0026] The technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention.
[0027] The methods and embodiments provided in this application can be executed on a mobile terminal, computer terminal, or similar computing device. Taking running on a mobile terminal as an example, Figure 1 This is a hardware structure block diagram of a mobile terminal for a data storage method according to an embodiment of the present invention. Figure 1 As shown, a mobile terminal may include one or more ( Figure 1 Only one is shown in the diagram. A processor 102 (which may include, but is not limited to, a microprocessor MCU or a programmable logic device FPGA, etc.) and a memory 104 for storing data are also shown. The mobile terminal may further include a transmission device 106 for communication functions and an input / output device 108. Those skilled in the art will understand that... Figure 1The illustrated structure is merely schematic and does not limit the structure of the mobile terminal. For example, the mobile terminal can include more or less components than those shown, or have a different configuration or arrangement of the components. Figure 1 The mobile terminal can include more or less components than those shown, or have a different configuration or arrangement of the components. Figure 1
[0028] The memory 104 is used to store computer programs, such as software programs of application software and modules, for example, a computer program corresponding to the data storage method in the embodiments of the present application. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, that is, implements the method. The memory 104 can include a high-speed random access memory, and can further include a non-volatile memory, such as one or more magnetic storage devices, flash memories, or other non-volatile solid-state memories. In some examples, the memory 104 can further include a memory remotely arranged with respect to the processor 102, and the remote memory can be connected to the mobile terminal through a network. Examples of the network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and a combination thereof. The transmission device 106 is used to receive or send data via a network. The specific example of the network can include a wireless network provided by a communication provider of the mobile terminal. In one example, the transmission device 106 includes a network adapter (NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (RF) module, which is used to communicate with the Internet in a wireless manner.
[0029] In the embodiments, a data storage method running on a server, a mobile terminal, a computer terminal or a similar computing device is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that herein.
[0030] Figure 2 is a flowchart of the data storage method according to the embodiments of the present application. As shown in Figure 2 the method includes the following steps:
[0031] Step S201, according to the data importance of a plurality of message packets in a target service and the performance requirement level of each of the message packets to the server, a plurality of RAID levels are determined, and a hard disk group meeting each of the RAID levels is configured for the server, the performance requirement level includes: the requirement level of read-write rate and the requirement level of delay rate, the server is used to execute the target service, and one of the hard disk groups includes at least one hard disk.
[0032] Specifically, the RAID level corresponds to the hard disk group one by one, and a plurality of RAID levels constitute a RAID array of the target service. The target service refers to a specific service or application scenario that needs data storage. The hard disk group is configured according to the requirements of the RAID level, and the appropriate hard disk type, capacity and number are selected, and the hard disks are physically connected and logically configured.
[0033] Specifically, the performance requirement level includes a first level, a second level and a third level, and the performance requirement levels characterized by the first level, the second level and the third level decrease in turn.
[0034] Step S202, in the case that the target message packet sent by the device end is received by the server, according to the data importance, data access frequency and data recovery time target of the target message packet, a security level index is determined, the security level index is an index for evaluating the security level required by the message packet, and the target message packet is part of a plurality of message packets;
[0035] Specifically, the target message packet refers to a specific data unit sent from the device end to the server, and the security level index is calculated based on the data importance, data access frequency and data recovery time target, which is used to evaluate the security level required by the target message packet. Different security levels correspond to different RAID levels.
[0036] Step S203, according to the security level index, a target RAID level is determined from a plurality of RAID levels, and the hard disk group corresponding to the target RAID level is determined as a target hard disk group, and the target message packet is stored by using the target hard disk group, and the target RAID level is one of a plurality of RAID levels.
[0037] Specifically, according to the security level index, a target RAID level is determined from a plurality of RAID levels, and the hard disk group corresponding to the target RAID level is determined, and the target message packet is stored by using the corresponding hard disk group.
[0038] According to the embodiment, first, according to the data importance of the plurality of message packets in the target service and the performance requirements such as read-write speed and delay rate of the server, a plurality of RAID levels are determined, then according to the determined plurality of RAID levels, the corresponding hard disk group is configured for the server, in the case of receiving the target message packet sent by the device end, according to the data importance, data access frequency and data recovery time target of the target message packet, the security level index of the target message packet is determined, finally, according to the security level index, the target RAID level is determined from the plurality of RAID levels, the hard disk group corresponding to the target RAID level is determined as the target hard disk group, and the hard disk group is used to store the target message packet. According to the characteristics and requirements of the data, the RAID level is dynamically selected, the reasonable configuration of the hard disk resources is realized, the full use of the hard disk space of the server is ensured, the waste and uneven use of the hard disk space are avoided, and the utilization rate and efficiency of the hard disk resources are improved.
[0039] In an optional solution, the data importance of the message packet includes a first degree, a second degree and a third degree, the importance degrees represented by the first degree, the second degree and the third degree decrease in turn, after the server is configured with the hard disk group meeting the RAID levels, the method further includes:
[0040] Step S204: according to the data importance of the plurality of message packets, the backup strategy and the backup frequency of the RAID level corresponding to each message packet are determined, the backup strategy includes: in the case that the data importance of the message packet is the first degree, full backup is adopted, in the case that the data importance of the message packet is the second degree, incremental backup is adopted, in the case that the data importance of the message packet is the third degree, differential backup is adopted;
[0041] Specifically, the multiple RAID levels are determined according to the data importance of the multiple message packets in the target service and the performance requirement level of each of the message packets on the server, including: in the case that the data importance of the message packets is the first degree and the performance requirement level is the first level, determining that the multiple RAID levels include RAID10; in the case that the data importance of the message packets is the first degree and the performance requirement level is the second level, determining that the multiple RAID levels include RAID1; in the case that the data importance of the message packets is the first degree and the performance requirement level is the third level, determining that the multiple RAID levels include RAID6; in the case that the data importance of the message packets is the second degree and the performance requirement level is the first level, determining that the multiple RAID levels include RAID5; in the case that the data importance of the message packets is the second degree and the performance requirement level is the second level, determining that the multiple RAID levels include RAID5 or RAID6; in the case that the data importance of the message packets is the second degree and the performance requirement level is the third level, determining that the multiple RAID levels include RAID0; in the case that the data importance of the message packets is the third degree and the performance requirement level is the first level, determining that the multiple RAID levels include RAID0; in the case that the data importance of the message packets is the third degree and the performance requirement level is the second level, determining that the multiple RAID levels include RAID0 or RAID1; in the case that the data importance of the message packets is the third degree and the performance requirement level is the third level, determining that the multiple RAID levels include RAID0.
[0042] Specifically, for the message package with high data importance and high performance requirement level, RAID10 can provide data redundancy and high performance; for the message package with high data importance and medium performance requirement level, RAID1 can provide data redundancy with lower cost; for the message package with high data importance and low performance requirement level, RAID6 can provide data redundancy and high fault tolerance capability, but with poor write performance; for the message package with medium data importance and high performance requirement level, RAID5 can provide data redundancy and better performance; for the message package with medium data importance and medium performance requirement level, RAID5 or RAID6 can be selected according to specific requirements, wherein RAID6 provides higher fault tolerance capability; for the message package with medium data importance and low performance requirement level, RAID0 can improve performance, but does not provide data redundancy, and is suitable for non-critical data; for the message package with low data importance and high performance requirement level, RAID0 can improve performance, and is suitable for scenarios with very high performance requirements but low data security requirements; for the message package with low data importance and medium performance requirement level, RAID0 or RAID1 can be selected according to specific requirements, wherein RAID1 provides data redundancy but with higher cost; for the message package with low data importance and low performance requirement level, RAID0 can improve performance and reduce cost, and is suitable for non-core business data.
[0043] Specifically, full backup specifies complete backup of data, incremental backup refers to backup of data changed since the last backup, differential backup refers to backup of all data changed since the last full backup, and backup frequency and strategy can be adjusted according to target business and data importance.
[0044] Step S205: According to the backup strategy and the backup frequency, set backup parameters of multiple RAID levels.
[0045] Specifically, the set backup parameters include backup strategy, backup frequency and backup window (i.e. time period for performing backup operation).
[0046] Specifically, for data with low importance, a lower backup frequency or incremental backup or differential backup is adopted, which only backs up the data changed since the last backup, reducing the redundancy of the backup data and thus reducing the occupation of system resources and improving the overall performance; for data with high importance, a higher backup frequency or full backup is adopted, which means that each backup will contain a complete data set, thus ensuring that critical data is backed up more frequently and comprehensively, improving the security of the data. Different backup frequencies and strategies are adopted for data of different importance, which can avoid unnecessary frequent backup and redundant storage, make the storage space of the hard disk be reasonably utilized, and further solve the problem of unreasonable allocation of hard disk resources in the prior art.
[0047] In the embodiments, different backup strategies are adopted for different data importance degrees of the message package, which can realize differential backup of different RAID levels, further ensure that the determined backup strategy and backup frequency match the message package of different data importance, and thus further realize the rationalization of the application of hard disk resources.
[0048] In some other example embodiments, a security level index is determined according to the data importance, data access frequency and data recovery time target of the target message package, including:
[0049] According to the first correspondence relationship, a first score is determined as a score corresponding to an importance degree range of the data importance of the target message package, and the first correspondence relationship is a correspondence relationship between the importance degree range and the score;
[0050] According to the second correspondence relationship, a second score is determined as a score corresponding to a frequency range of the data access frequency of the target message package, and the second correspondence relationship is a correspondence relationship between the frequency range and the score;
[0051] According to the third correspondence relationship, a third score is determined as a score corresponding to a time range of the data recovery time target of the target message package, and the third correspondence relationship is a correspondence relationship between the time range and the score;
[0052] The security level index is determined as the sum of the first score, the second score and the third score.
[0053] Specifically, the first correspondence relationship, the second correspondence relationship and the third correspondence relationship are pre-set correspondence relationships, and the importance degree range, the frequency range and the time range are pre-set ranges.
[0054] In the embodiment, the security level index of the data can be more accurately evaluated by comprehensively considering and scoring the data importance, data access frequency and data recovery time target of the target message package, the different RAID levels are selected according to the security level index, the target message package is further stored in a targeted manner, the backup strategy of the target message package is further ensured to meet the security requirement of the target message package, and the security and reliability of the target message package in the system failure are further ensured.
[0055] In addition, the application further presets a corresponding relationship (hereinafter referred to as a fourth corresponding relationship) between the security level index and the RAID level, after obtaining the security level index of the target message package, the RAID level corresponding to the security level index is searched in the fourth corresponding relationship, and the RAID level is the target RAID level. The hard disk group corresponding to the target RAID level is the target hard disk group.
[0056] For example, for the setting of the first correspondence relationship, the second correspondence relationship and the third correspondence relationship, in this application, for data importance, that is, data is crucial to business, and loss or damage will cause significant loss, the threshold is set to 9-10 points; for data importance, that is, data has a certain impact on business, but is not critical, the threshold is set to 5-8 points; for low data importance, that is, data has less impact on business, and loss or damage will not cause serious consequences, the threshold is set to 1-4 points; for high access frequency, that is, the number of daily access is greater than or equal to 1000 times, the threshold is set to 9-10 points; for access frequency, that is, the number of daily access is greater than 100 times and less than 1000 times, the threshold is set to 5-8 points; for low access frequency, that is, the number of daily access is less than 100 times, the threshold is set to 1-4 points; for low recovery time target, that is, the recovery time target is less than or equal to 1 hour, the threshold is set to 9-10 points; for recovery time target, that is, the recovery time target is greater than one hour and less than 12 hours, the threshold is set to 5-8 points; for low recovery time target, that is, the recovery time target is greater than or equal to 12 hours, the threshold is set to 1-4 points. According to the actual situation of the data, score each factor, including data importance, access frequency and recovery time target, and add the scores of each factor to get the total score, and select the RAID level according to the total score. The total score is 24-30 points: select RAID 10 or RAID 1 to ensure high data redundancy and high performance; the total score is 15-23 points: select RAID 5 or RAID 6 to balance performance, redundancy and cost; the total score is 6-14 points: select RAID 0 to reduce cost and improve performance, but need to cooperate with good backup strategy. By considering and scoring the data importance, data access frequency and data recovery time target of the target message package, the security level index of the data can be more accurately evaluated, different RAID levels are selected for backup according to the determined security level index, and the target message package is further stored in a targeted manner, the backup strategy of the target message package is further ensured to meet the security requirements of the target message package, and the security and reliability of the target message package in system failure are further ensured.
[0057] In another optional solution, the server is configured with hard disk groups meeting the RAID levels, including: according to the plurality of RAID levels, the server is configured with hard disks corresponding to the number and capacity of the RAID levels.
[0058] In the embodiment, by configuring the server with hard disks corresponding to the number and capacity of the RAID levels, the RAID levels are reasonably configured, and the configuration of the hard disk resources is further optimized.
[0059] In another alternative, after configuring the server with hard disk groups meeting the RAID levels, the method further comprises: deploying a RAID controller on the server and configuring parameters of the RAID controller, the parameters of the RAID controller including at least one of: a stripe size, a check mode;
[0060] In particular, when configuring the stripe size, the average file size should be considered, if large files such as videos, database files, etc. are mainly processed, a larger stripe size should be selected, if small files such as documents, pictures, etc. are processed, a smaller stripe size should be selected; common check modes include: parity check, cyclic redundancy check, B+ check, etc.
[0061] Mounting the key data on the server to the RAID, the key data including at least one of: a database, a log file.
[0062] In particular, mounting involves the following steps: confirming that the RAID has been correctly configured and is in a usable state, creating a file system on the RAID, creating a mounting point, mounting the RAID, verifying that the RAID has been successfully mounted, etc.
[0063] In the embodiments, by deploying a RAID controller on the server and configuring the stripe size parameter, the size of the data divided into blocks is determined, a reasonable stripe size can not only guarantee the performance of the RAID controller, but also realize the optimized utilization of the storage space, by configuring the check mode of the RAID controller, the RAID controller can detect and correct errors in the data, thereby ensuring the integrity and reliability of the data; mounting the key data on the server to the RAID, thereby ensuring that the data is written to the main server at the same time and is also synchronized to the RAID in real time.
[0064] In some example schemes of the present application, before determining the security level index according to the data importance, data access frequency and data recovery time target of the target message package, the method further comprises:
[0065] Data decoding is performed on the message package to obtain JSON object data in string format;
[0066] Data parsing is performed on the JSON object data to obtain key value information in the JSON object;
[0067] Data verification is performed on the key value information, the data verification including: data integrity verification, data format verification, data content verification and data security verification, the data content verification including: verifying whether the ID of the key value information is from a legal device, whether the key value information is within a preset range and whether the update time of the key value information is within a preset time period.
[0068] Specifically, the message packet is data decoded, data parsed and the results of the processing are data verified.
[0069] In the embodiment, the server ensures that the data can be correctly identified through the decoding and parsing process of the data, helps the server to accurately understand the data content sent by the device end, and provides accurate information basis for subsequent data processing; through the data integrity verification, it is checked whether the decoded and parsed data contains all necessary fields, and the hash value of the JSON object is compared with the expected hash value, to ensure that the data is not tampered or lost in the transmission process; through the format verification of the data, it is helpful to prevent data processing errors caused by format errors; through the content verification of the data, it is helpful to prevent illegal devices from sending data or abnormal data from devices, thereby maintaining the security and stability of the system; through the data security verification, it is ensured that only legal devices can send messages, preventing data from being eavesdropped and tampered with in the transmission process, protecting information from being leaked, and maintaining data security. Through decoding, parsing and verifying the data, the type and characteristics of the data can be more accurately identified, the scoring of the message packet is more accurate, and the security level index of the message packet is more accurate, further optimizing the configuration of the hard disk resources.
[0070] Exemplarily, taking the target message packet as a state update message of a smart bulb as an example, the specific processes of the data decoding, the data parsing and the data verification in the present application are described as follows: the server receives a state update message from the smart bulb through the MQTTBroker, the message format is JSON, and the message contains the ID, the current brightness, the color temperature and other information of the bulb; the server parses the payload part of the MQTT message, and converts it from binary format to JSON object in string format; the fields of the bulb ID (bulb_id), the current brightness (brightness) and the color temperature (color_temp) are extracted from the JSON object. The values of these fields are converted into appropriate types, for example, the brightness is converted from a string to an integer; it is checked whether the brightness value is within the valid range (for example, 0-255), and whether the color temperature value is within the valid range (for example, 1500K-9000K, but the specific range may vary according to the bulb model), and if an invalid value is found, it is replaced with a default value or an error log is recorded; the parsed and cleaned data is stored in the database. The database table contains fields such as bulb ID, brightness, color temperature, update time, etc.; transaction processing is used to ensure the atomicity and consistency of the data; it is checked whether the payload part of the MQTT message contains all the necessary fields (such as bulb_id, brightness, color_temp); the hash value of the JSON object is calculated and compared with the expected hash value to verify the integrity of the data; the format of the JSON object is verified, including whether the field names are correct, whether the data types match, etc.; the JSON Schema is used for format verification to ensure that the message conforms to the expected format specification; it is verified whether the bulb ID exists in the database to ensure that the message comes from a legal device; it is checked whether the brightness and color temperature values are within a reasonable range to prevent abnormal data from being sent by the device; it is verified whether the update time of the message is reasonable to prevent timestamp forgery; the username and password of MQTT are used for identity verification to ensure that only legal devices can send messages; the MQTT connection is encrypted using TLS / SSL to prevent data from being eavesdropped or tampered with during transmission; when sensitive information (such as device keys) is stored in the database, encryption technology is used to protect the security of the data; the average response time of the server processing the MQTT message is measured to ensure that the data processing is completed within a reasonable time range; the performance indicators of the database (such as query response time, write throughput, etc.) are monitored to ensure that the database can handle high-concurrency requests; a stress testing tool is used to simulate a scenario in which a large number of devices send messages simultaneously to verify the performance and stability of the server.
[0071] In order for those skilled in the art to more clearly understand the technical solutions of the present application, the implementation process of the data storage method of the present application will be described in detail below in conjunction with specific embodiments.
[0072] The embodiment relates to a specific data storage method, as shown in the following figure, comprising the following steps: Figure 3
[0073] Step S1: determining a plurality of RAID levels;
[0074] Step S2: configuring a hard disk group corresponding to each RAID level;
[0075] Step S3: deploying a RAID controller in a server;
[0076] Step S4: receiving a target message package;
[0077] Step S5: performing data processing and data verification on the target message package;
[0078] Step S6: writing data, which has been processed and verified, into a hard disk group;
[0079] Step S7: judging whether the server is faulty, if the server is not faulty, then executing the step S4, the step S5 and the step S6 at least once, if the server is faulty, then executing a step S8;
[0080] Step S8: reading data from a plurality of hard disk groups;
[0081] Step S9: performing data recovery.
[0082] It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described herein can be executed in an order different from that shown herein.
[0083] The embodiment of the present application further provides a data storage device of a smart home device. It should be noted that the data storage device of the smart home device in the embodiment of the present application can be used to execute the data storage method provided in the embodiment of the present application. The device is used to realize the embodiment and the preferred embodiment, and details are not repeated. As used below, the term "module" can be a combination of software and / or hardware that realizes a predetermined function. Although the device described in the following embodiment is preferably realized in software, realization of hardware, or a combination of software and hardware, is also possible and is contemplated.
[0084] The data storage device of the smart home device provided in the embodiment of the present application is described below.
[0085] Figure 4 is a schematic diagram of the data storage device of the smart home device according to the embodiment of the present application. As shown in the figure, Figure 4 the device comprises:
[0086] The first determining unit 10 is configured to determine a plurality of RAID levels according to data importance of a plurality of message packets in a target service and a performance requirement level of each of the message packets to a server, and configure the server with hard disk groups satisfying each of the RAID levels, wherein the performance requirement level comprises a requirement level of read-write speed and a requirement level of delay rate, the server is configured to execute the target service, and each of the hard disk groups comprises at least one hard disk.
[0087] Specifically, the RAID levels correspond to the hard disk groups one by one, and the plurality of RAID levels constitute a RAID array of the target service. The target service refers to a specific service or application scenario requiring data storage. The hard disk groups are configured according to the requirements of the RAID levels, and appropriate hard disk types, capacities and quantities are selected, and the hard disks are physically connected and logically configured.
[0088] The second determining unit 20 is configured to determine a security level indicator according to data importance, data access frequency and data recovery time target of a target message packet when the server receives the target message packet sent by a device end, wherein the security level indicator is an indicator for evaluating a required security level of the message packet, and the target message packet is part of the plurality of message packets.
[0089] Specifically, the target message packet refers to a specific data unit sent from the device end to the server, and the security level indicator is calculated based on data importance, data access frequency and data recovery time target, and is used to evaluate the required security level of the target message packet. Different security levels correspond to different RAID levels.
[0090] The storage unit 30 is configured to determine a target RAID level from the plurality of RAID levels according to the security level indicator, determine a target hard disk group corresponding to the target RAID level as a target hard disk group, and store the target message packet in the target hard disk group, wherein the target RAID level is one of the plurality of RAID levels.
[0091] Specifically, the target RAID level is determined from the plurality of RAID levels according to the security level indicator, and the target hard disk group corresponding to the target RAID level is determined, and the target message packet is stored in the corresponding hard disk group.
[0092] According to the embodiment, the first determining unit determines the plurality of RAID levels according to the data importance of the plurality of message packets in the target service and the performance requirements such as read-write speed and delay rate of the server, and configures the corresponding hard disk group for the server according to the determined plurality of RAID levels; in the case that the target message packet is received from the device end, the second determining unit determines the security level index of the target message packet according to the data importance, data access frequency and data recovery time target of the target message packet; the storage unit determines the target RAID level from the plurality of RAID levels according to the security level index, and determines the hard disk group corresponding to the target RAID level as the target hard disk group. According to the characteristics and requirements of the data, the application dynamically selects the RAID level, realizes the reasonable configuration of the hard disk resources, guarantees the full use of the hard disk space of the server, avoids the waste and unbalanced use of the hard disk space, and improves the utilization rate and efficiency of the hard disk resources.
[0093] In another alternative, the apparatus further comprises:
[0094] The third determining unit is configured to determine the backup strategy and backup frequency of the RAID level corresponding to each message packet according to the data importance of the plurality of message packets, wherein the backup strategy comprises: full backup in the case that the data importance of the message packet is the first degree, incremental backup in the case that the data importance of the message packet is the second degree, and differential backup in the case that the data importance of the message packet is the third degree.
[0095] Specifically, the full backup specifies complete backup of data at a specified period, the incremental backup refers to backup of data changed since the last backup, and the differential backup refers to backup of all data changed since the last full backup. The backup frequency and strategy can be adjusted according to the target service and data importance.
[0096] The setting unit is configured to set the backup parameters of the plurality of RAID levels according to the backup strategy and the backup frequency.
[0097] Specifically, the set backup parameters comprise backup strategy, backup frequency and backup window (i.e. the time period for performing backup operation).
[0098] In the embodiment, different backup strategies are adopted for different data importance degrees of the message packet, which can realize differential backup of different RAID levels, and further guarantee that the determined backup strategy and backup frequency match the message packet with different data importance, thereby further realizing the rational application of the hard disk resources.
[0099] Specifically, for data with low importance, a lower backup frequency or incremental backup or differential backup is adopted, which only backs up the data changed since the last backup, reduces the redundancy of the backup data, thereby reducing the occupation of system resources and improving the overall performance; for data with high importance, a higher backup frequency or full backup is adopted, which means that each backup will contain a complete data set, thereby ensuring that critical data is backed up more frequently and comprehensively, improving the security of the data. Different backup frequencies and strategies are adopted for data of different importance, which can avoid unnecessary frequent backup and redundant storage, make the storage space of the hard disk be reasonably utilized, and further solve the problem of unreasonable hard disk resource configuration in the prior art.
[0100] In some other example embodiments, the second determining unit comprises:
[0101] The first determining module is configured to determine, according to a first correspondence relationship, a first score as a score corresponding to an importance degree range of the data importance of the target message package, the first correspondence relationship being a correspondence relationship between an importance degree range and a score.
[0102] The second determining module is configured to determine, according to a second correspondence relationship, a second score as a score corresponding to a frequency range of the data access frequency of the target message package, the second correspondence relationship being a correspondence relationship between a frequency range and a score.
[0103] The third determining module is configured to determine, according to a third correspondence relationship, a third score as a score corresponding to a time range of the data recovery time target of the target message package, the third correspondence relationship being a correspondence relationship between a time range and a score.
[0104] The fourth determining module is configured to determine the security level indicator as a sum of the first score, the second score and the third score.
[0105] Specifically, the first correspondence relationship, the second correspondence relationship and the third correspondence relationship are pre-set correspondence relationships, and the importance degree range, the frequency range and the time range are pre-set ranges.
[0106] In the embodiments, the security level indicator of the data can be more accurately evaluated by comprehensively considering and scoring the data importance, the data access frequency and the data recovery time target of the target message package, and the target message package is stored more targetedly by selecting different RAID levels according to the determined security level indicator, thereby further ensuring that the backup strategy of the target message package meets the security requirement of the target message package, and further ensuring the security and reliability of the target message package in the case of system failure.
[0107] In addition, the application also presets a corresponding relationship (hereinafter referred to as the fourth corresponding relationship) between the security level index and the RAID level, and after obtaining the security level index of the target message package, the RAID level corresponding to the security level index is searched in the fourth corresponding relationship, and the RAID level is the target RAID level. The hard disk group corresponding to the target RAID level is the target hard disk group.
[0108] Exemplarily, for the setting of the first corresponding relationship, the second corresponding relationship and the third corresponding relationship, in the application, for data with high importance, i.e. data is crucial to business, and loss or damage will cause significant loss, the threshold is set to 9-10 points; for data with medium importance, i.e. data has a certain influence on business, but is not critical, the threshold is set to 5-8 points; for data with low importance, i.e. data has less influence on business, and loss or damage will not cause serious consequences, the threshold is set to 1-4 points; for high access frequency, i.e. the number of daily accesses is greater than or equal to 1000 times, the threshold is set to 9-10 points; for medium access frequency, i.e. the number of daily accesses is greater than 100 times and less than 1000 times, the threshold is set to 5-8 points; for low access frequency, i.e. the number of daily accesses is less than 100 times, the threshold is set to 1-4 points; for low recovery time target, i.e. the recovery time target is less than or equal to 1 hour, the threshold is set to 9-10 points; for medium recovery time target, i.e. the recovery time target is greater than one hour and less than 12 hours, the threshold is set to 5-8 points; for high recovery time target, i.e. the recovery time target is greater than or equal to 12 hours, the threshold is set to 1-4 points. According to the actual situation of the data, score each factor, including data importance, access frequency and recovery time target, and add the scores of each factor to obtain the total score, and select the RAID level according to the total score. Total score: 24-30 points: select RAID 10 or RAID 1 to ensure high data redundancy and high performance; total score: 15-23 points: select RAID 5 or RAID 6 to balance performance, redundancy and cost; total score: 6-14 points: select RAID 0 to reduce cost and improve performance, but need to cooperate with good backup strategy. Through comprehensive consideration and scoring of the data importance, data access frequency and data recovery time target of the target message package, the security level index of the data can be more accurately evaluated, different RAID levels are selected for backup through the determined security level index, and the target message package is further stored in a targeted manner, the backup strategy of the target message package is further ensured to meet the security requirements of the target message package, and the security and reliability of the target message package in the case of system failure are further ensured.
[0109] In another alternative, the first determining unit comprises a configuration module configured to configure the server with hard disks of a quantity and capacity corresponding to each of the RAID levels according to the plurality of RAID levels, and the apparatus further comprises a deployment unit configured to deploy a RAID controller on the server and configure parameters of the RAID controller after the server is configured with the hard disk groups satisfying each of the RAID levels, the parameters of the RAID controller including at least one of a stripe size and a check mode.
[0110] In particular, when configuring the stripe size, the average file size should be considered, if large files such as videos, database files, etc. are mainly processed, a larger stripe size should be selected, and if small files such as documents, pictures, etc. are processed, a smaller stripe size should be selected; common check modes include parity check, cyclic redundancy check, B+ check, etc.
[0111] The mounting unit is configured to mount critical data on the server to the RAID, the critical data including at least one of a database and a log file.
[0112] In particular, mounting involves the following steps: confirming that the RAID has been correctly configured and is in a usable state, creating a file system on the RAID, creating a mounting point, mounting the RAID, verifying that the RAID has been successfully mounted, etc.
[0113] In the embodiments, by deploying the RAID controller on the server and configuring the stripe size parameter, the size of the data divided into blocks is determined, a reasonable stripe size can ensure the performance of the RAID controller while also optimizing the use of storage space, by configuring the check mode of the RAID controller, the RAID controller can detect and correct errors in the data, thereby ensuring the integrity and reliability of the data; the critical data on the server is mounted to the RAID, thereby ensuring that the data is written to the main server while also being synchronized to the RAID in real time.
[0114] In some example schemes of the present application, the apparatus further comprises:
[0115] The decoding unit is configured to perform data decoding on the message package to obtain JSON object data in a string format before determining the security level indicator according to the data importance, data access frequency and data recovery time target of the target message package;
[0116] The parsing unit is configured to perform data parsing on the JSON object data to obtain key value information in the JSON object;
[0117] The verification unit is configured to perform data verification on the key-value information, including data integrity verification, data format verification, data content verification, and data security verification. The data content verification includes verifying whether the ID of the key-value information is from a legal device, whether the key-value information is within a preset range, and whether the update time of the key-value information is within a preset time period.
[0118] Specifically, the message packet is subjected to data decoding, data parsing, and data verification on the results of the processing.
[0119] In the embodiments, the server ensures that the data can be correctly identified through the decoding and parsing processes, helps the server accurately understand the data content sent by the device end, and provides an accurate information basis for subsequent data processing. Through data integrity verification, it is checked whether the decoded and parsed data contains all necessary fields, and the hash value of the JSON object is compared with the expected hash value to ensure that the data is not tampered with or lost during transmission. Through format verification of the data, it helps to prevent data processing errors caused by format errors. Through content verification of the data, it helps to prevent illegal devices from sending data or abnormal data from being sent by devices, thereby maintaining the security and stability of the system. Through data security verification, it is ensured that only legal devices can send messages, preventing data from being eavesdropped and tampered with during transmission, protecting information from being leaked, and maintaining data security. Through decoding, parsing, and verification of the data, the type and characteristics of the data can be more accurately identified, making the scoring of the message packet more accurate, and thus the security level index of the message packet more accurate, further optimizing the configuration of the hard disk resources.
[0120] Exemplarily, taking the target message package as an example of a state update message of a smart light bulb, the specific process of data decoding, data parsing and data verification in the present application is described as follows: the server receives a state update message from the smart light bulb through MQTTBroker, the message format is JSON, containing the ID, current brightness, color temperature and other information of the light bulb; the server parses the payload part of the MQTT message and converts it from binary format to JSON object in string format; the ID (bulb_id), current brightness (brightness) and color temperature (color_temp) and other fields of the light bulb are extracted from the JSON object. Convert the values of these fields to appropriate types, such as converting brightness from string to integer; check if the brightness value is within the valid range (e.g. 0-255), check if the color temperature value is within the valid range (e.g. 1500K-9000K, but the specific range may vary depending on the bulb model), if invalid value is found, replace it with default value or record error log; store the parsed and cleaned data in the database. The database table contains bulb ID, brightness, color temperature, update time and other fields; use transaction processing to ensure the atomicity and consistency of data; check if the payload part of the MQTT message contains all necessary fields (such as bulb_id, brightness, color_temp); calculate the hash value of the JSON object and compare it with the expected hash value to verify the integrity of the data; verify the format of the JSON object, including whether the field name is correct, whether the data type is matched, etc.; use JSON Schema for format verification to ensure that the message conforms to the expected format specification; verify whether the bulb ID exists in the database to ensure that the message comes from a legal device; check if the brightness and color temperature values are within a reasonable range to prevent abnormal data from being sent by the device; verify if the update time of the message is reasonable to prevent timestamp forgery; use MQTT username and password for identity verification to ensure that only legal devices can send messages; use TLS / SSL to encrypt MQTT connection to prevent data from being eavesdropped or tampered during transmission; use encryption technology to protect the security of sensitive information (such as device keys) when storing them in the database; measure the average response time of the server processing MQTT messages to ensure that data processing is completed within a reasonable time range; monitor the performance indicators of the database (such as query response time, write throughput, etc.) to ensure that the database can handle high concurrency requests; use stress testing tools to simulate a scenario where a large number of devices send messages simultaneously to verify the performance and stability of the server.
[0121] The data storage device of the smart home device comprises a processor and a memory, the first determining unit, the second determining unit and the storage unit are stored in the memory as program units, and the corresponding functions are realized by the processor executing the program units stored in the memory. The modules are located in the same processor; or the modules are located in different processors in any combination.
[0122] The processor comprises a core, and the core calls the corresponding program unit in the memory. The core can be one or more, and the core parameters are adjusted to at least solve the problem of unreasonable hard disk resource configuration in the prior art, which causes poor hard disk resource utilization.
[0123] The memory can include non-permanent memory in a computer readable medium, random access memory (RAM) and / or non-volatile memory such as read-only memory (ROM) or flash memory (flash RAM), and the memory includes at least one memory chip.
[0124] The embodiment of the application provides a computer readable storage medium, the computer readable storage medium comprises a stored program, wherein the computer readable storage medium is controlled to execute the data storage method when the program is running.
[0125] Specifically, the data storage method comprises:
[0126] In step S201, a plurality of RAID levels are determined according to the data importance of a plurality of message packets in a target service and the performance requirement level of each message packet to a server, and a hard disk group meeting each RAID level is configured for the server, the performance requirement level includes a requirement level of read-write rate and a requirement level of delay rate, the server is used to execute the target service, and one hard disk group includes at least one hard disk.
[0127] Specifically, the RAID level corresponds to the hard disk group one by one, and a plurality of RAID levels constitute a RAID array of the target service. The target service refers to a specific service or application scenario that needs data storage. The hard disk group is configured according to the requirements of the RAID level, and the appropriate hard disk type, capacity and number are selected, and the hard disks are physically connected and logically configured.
[0128] In step S202, in the case that the target message packet is received by the server from the device end, the security level index is determined according to the data importance, data access frequency and data recovery time target of the target message packet, the security level index is an index for evaluating the required security level of the message packet, and the target message packet is part of the plurality of message packets.
[0129] Specifically, the target message package refers to a specific data unit sent from a device end to a server, and the security level indicator is calculated based on data importance, data access frequency, and data recovery time target, and is used to evaluate the required security level of the target message package. Different security levels correspond to different RAID levels.
[0130] In step S203, the target RAID level is determined from the plurality of RAID levels according to the security level indicator, and the target hard disk group corresponding to the target RAID level is determined as the target hard disk group, and the target message package is stored by using the target hard disk group. The target RAID level is one of the plurality of RAID levels.
[0131] Specifically, the target RAID level is determined from the plurality of RAID levels according to the security level indicator, and the target hard disk group corresponding to the target RAID level is determined, and the target message package is stored by using the corresponding hard disk group.
[0132] Optionally, the data importance of the message package includes a first degree, a second degree, and a third degree, and the importance degrees represented by the first degree, the second degree, and the third degree decrease in turn. After the server is configured with hard disk groups meeting the RAID levels, the method further includes: determining the backup strategy and the backup frequency of the RAID level corresponding to each message package according to the data importance of the plurality of message packages, the backup strategy including: using full backup when the data importance of the message package is the first degree, using incremental backup when the data importance of the message package is the second degree, and using differential backup when the data importance of the message package is the third degree; and setting backup parameters of the plurality of RAID levels according to the backup strategy and the backup frequency.
[0133] Optionally, the security level indicator is determined according to the data importance, the data access frequency, and the data recovery time target of the target message package, including: determining a first score as a score corresponding to an importance degree range in which the data importance of the target message package is located according to a first correspondence relationship, the first correspondence relationship being a correspondence relationship between an importance degree range and a score; determining a second score as a score corresponding to a frequency range in which the data access frequency of the target message package is located according to a second correspondence relationship, the second correspondence relationship being a correspondence relationship between a frequency range and a score; determining a third score as a score corresponding to a time range in which the data recovery time target of the target message package is located according to a third correspondence relationship, the third correspondence relationship being a correspondence relationship between a time range and a score; and determining the security level indicator as a sum of the first score, the second score, and the third score.
[0134] Optionally, the server is configured to meet the hard disk group of each RAID level, including: according to a plurality of RAID levels, the server is configured to meet the corresponding number and capacity of each RAID level of the hard disk, after the server is configured to meet the hard disk group of each RAID level, the method further comprises: deploying a RAID controller on the server, and configuring parameters of the RAID controller, the parameters of the RAID controller include at least one of the following: stripe size, check mode; the key data on the server is mounted to the RAID, and the key data includes at least one of the following: database, log file.
[0135] Optionally, before determining the security level index according to the data importance, data access frequency and data recovery time target of the target message package, the method further comprises: decoding the message package to obtain JSON object data in string format; the JSON object data is parsed to obtain key value information in the JSON object; the key value information is verified, and the data verification includes: data integrity verification, data format verification, data content verification and data security verification, and the data content verification includes: verifying whether the ID of the key value information is from a legal device, whether the key value information is within a preset range and whether the update time of the key value information is within a preset period.
[0136] Embodiments of the present application provide a processor for running a program, wherein the program performs the data storage method when running.
[0137] Specifically, the data storage method comprises:
[0138] Step S201, according to the data importance of a plurality of message packages in a target service and the performance requirement level of each message package to the server, a plurality of RAID levels are determined, and the server is configured to meet the hard disk group of each RAID level, the performance requirement level includes: the requirement level of read-write rate and the requirement level of delay rate, the server is used for executing the target service, and one hard disk group includes at least one hard disk;
[0139] Specifically, the RAID level corresponds to the hard disk group one by one, and a plurality of RAID levels constitute a RAID array of the target service. The target service refers to a specific service or application scenario that needs data storage. The hard disk group is configured according to the requirements of the RAID level, and the appropriate hard disk type, capacity and number are selected, and the hard disks are physically connected and logically configured.
[0140] Step S202, in the case that the server receives a target message package sent by the device side, a security level index is determined according to the data importance, data access frequency and data recovery time target of the target message package, the security level index is an index for evaluating the security level required by the message package, and the target message package is part of a plurality of message packages;
[0141] Specifically, the target message package refers to a specific data unit sent from the device side to the server, and the security level index is calculated based on the data importance, data access frequency and data recovery time target, and is used to evaluate the security level required by the target message package. Different security levels correspond to different RAID levels.
[0142] Step S203, according to the security level index, a target RAID level is determined from a plurality of RAID levels, and a target hard disk group corresponding to the target RAID level is determined as a target hard disk group, and the target message package is stored by using the target hard disk group, and the target RAID level is one of a plurality of RAID levels.
[0143] Specifically, according to the security level index, a target RAID level is determined from a plurality of RAID levels, and a target hard disk group corresponding to the target RAID level is determined, and the target message package is stored by using the corresponding hard disk group.
[0144] Optionally, the data importance of the message package includes a first degree, a second degree and a third degree, and the importance degrees represented by the first degree, the second degree and the third degree decrease in turn, after the server is configured with hard disk groups meeting each RAID level, the method further comprises: determining a backup strategy and a backup frequency of each RAID level corresponding to each message package according to the data importance of a plurality of message packages, the backup strategy comprises: using full backup in the case that the data importance of the message package is the first degree, using incremental backup in the case that the data importance of the message package is the second degree, and using differential backup in the case that the data importance of the message package is the third degree; and setting backup parameters of a plurality of RAID levels according to the backup strategy and the backup frequency.
[0145] Optionally, the security level index is determined according to the data importance, the data access frequency and the data recovery time target of the target message package, including: determining a first score as a score corresponding to an importance degree range of the data importance of the target message package according to a first corresponding relationship, the first corresponding relationship being a corresponding relationship between an importance degree range and a score; determining a second score as a score corresponding to a frequency range of the data access frequency of the target message package according to a second corresponding relationship, the second corresponding relationship being a corresponding relationship between a frequency range and a score; determining a third score as a score corresponding to a time range of the data recovery time target of the target message package according to a third corresponding relationship, the third corresponding relationship being a corresponding relationship between a time range and a score; and determining the security level index as a sum of the first score, the second score and the third score.
[0146] Optionally, the server is configured with hard disk groups satisfying each of the RAID levels, including: configuring the server with hard disks of a quantity and a capacity corresponding to each of the RAID levels according to the plurality of RAID levels.
[0147] Optionally, after the server is configured with hard disk groups satisfying each of the RAID levels, the method further includes: deploying a RAID controller on the server and configuring parameters of the RAID controller, the parameters of the RAID controller including at least one of a stripe size and a check mode; and mounting critical data on the server to the RAID, the critical data including at least one of a database and a log file.
[0148] Optionally, before the security level index is determined according to the data importance, the data access frequency and the data recovery time target of the target message package, the method further includes: performing data decoding on the message package to obtain JSON object data in a string format; performing data parsing on the JSON object data to obtain key value information in the JSON object; and performing data verification on the key value information, the data verification including data integrity verification, data format verification, data content verification and data security verification, the data content verification including verifying whether an ID of the key value information is from a legal device, whether the key value information is within a preset range and whether an update time of the key value information is within a preset time period.
[0149] The application further provides a computer program product including computer instructions, which, when executed by a processor, implement at least the following method steps:
[0150] Step S201, according to the data importance of a plurality of message packets in a target service and the performance requirement level of each of the message packets to the server, a plurality of RAID levels are determined, and a hard disk group meeting each of the RAID levels is configured for the server, the performance requirement level includes: the requirement level of read-write rate and the requirement level of delay rate, the server is used to execute the target service, and one of the hard disk groups includes at least one hard disk;
[0151] Specifically, the RAID level corresponds to the hard disk group one by one, and a plurality of RAID levels constitute a RAID array of the target service. The target service refers to a specific service or application scenario that needs data storage. The hard disk group is configured according to the requirements of the RAID level, and the appropriate hard disk type, capacity and number are selected, and the hard disks are physically connected and logically configured.
[0152] Step S202, in the case that the target message packet sent by the device end is received by the server, according to the data importance, data access frequency and data recovery time target of the target message packet, a security level index is determined, the security level index is an index for evaluating the security level required by the message packet, and the target message packet is part of a plurality of message packets;
[0153] Specifically, the target message packet refers to a specific data unit sent from the device end to the server, and the security level index is calculated based on the data importance, data access frequency and data recovery time target, which is used to evaluate the security level required by the target message packet. Different security levels correspond to different RAID levels.
[0154] Step S203, according to the security level index, a target RAID level is determined from a plurality of RAID levels, and the hard disk group corresponding to the target RAID level is determined as a target hard disk group, and the target message packet is stored by using the target hard disk group, and the target RAID level is one of a plurality of RAID levels.
[0155] Specifically, according to the security level index, a target RAID level is determined from a plurality of RAID levels, and the hard disk group corresponding to the target RAID level is determined, and the target message packet is stored by using the corresponding hard disk group.
[0156] Optionally, the data importance of the message package comprises a first degree, a second degree and a third degree, the degrees of importance represented by the first degree, the second degree and the third degree are in turn decreasing, after the server is configured with the hard disk groups satisfying the RAID levels, the method further comprises: determining the backup strategy and the backup frequency of the RAID level corresponding to each of the message packages according to the data importance of the plurality of message packages, the backup strategy comprising: using full backup when the data importance of the message package is the first degree, using incremental backup when the data importance of the message package is the second degree, and using differential backup when the data importance of the message package is the third degree; setting the backup parameters of the plurality of RAID levels according to the backup strategy and the backup frequency.
[0157] Optionally, the security level indicator is determined according to the data importance, the data access frequency and the data recovery time target of the target message package, comprising: determining a first score as a score corresponding to an importance degree range in which the data importance of the target message package is located according to a first correspondence relationship, the first correspondence relationship being a correspondence relationship between importance degree ranges and scores; determining a second score as a score corresponding to a frequency range in which the data access frequency of the target message package is located according to a second correspondence relationship, the second correspondence relationship being a correspondence relationship between frequency ranges and scores; determining a third score as a score corresponding to a time range in which the data recovery time target of the target message package is located according to a third correspondence relationship, the third correspondence relationship being a correspondence relationship between time ranges and scores; and determining the security level indicator as a sum of the first score, the second score and the third score.
[0158] Optionally, the server is configured with the hard disk groups satisfying the RAID levels, comprising: configuring the server with the hard disks corresponding to the number and the capacity of each of the RAID levels according to the plurality of RAID levels.
[0159] Optionally, after the server is configured with the hard disk groups satisfying the RAID levels, the method further comprises: deploying a RAID controller on the server and configuring parameters of the RAID controller, the parameters of the RAID controller comprising at least one of the following: stripe size, check mode; and mounting critical data on the server to the RAID, the critical data comprising at least one of the following: database, log file.
[0160] Optionally, before determining the security level index according to the data importance, data access frequency and data recovery time target of the target message package, the method further comprises: performing data decoding on the message package to obtain JSON object data in string format; performing data parsing on the JSON object data to obtain key value information in the JSON object; and performing data verification on the key value information, the data verification comprising: data integrity verification, data format verification, data content verification and data security verification, the data content verification comprising: verifying whether the ID of the key value information is from a legal device, whether the key value information is within a preset range and whether the update time of the key value information is within a preset time period.
[0161] The embodiments of the present application also provide an electronic device, comprising: one or more processors, a memory, and one or more programs, wherein the one or more programs comprise instructions for performing any of the methods. The one or more processors implement at least the following steps when executing the programs:
[0162] In step S201, a plurality of RAID levels are determined according to the data importance of a plurality of message packages in a target service and the performance requirement level of each of the message packages to a server, and a hard disk group meeting each of the RAID levels is configured for the server, the performance requirement level comprising a requirement level of read-write rate and a requirement level of delay rate, the server being used to execute the target service, and one of the hard disk groups comprising at least one hard disk.
[0163] Specifically, the RAID levels correspond to the hard disk groups one by one, and the plurality of RAID levels constitute a RAID array of the target service. The target service refers to a specific service or application scenario requiring data storage. The hard disk group is configured according to the requirements of the RAID levels, and appropriate hard disk types, capacities and quantities are selected, and the hard disks are physically connected and logically configured.
[0164] In step S202, in a case where the target message package is received by the server from a device end, a security level index is determined according to the data importance, data access frequency and data recovery time target of the target message package, the security level index being an index for evaluating the required security level of the message package, and the target message package being part of the plurality of message packages.
[0165] Specifically, the target message package refers to a specific data unit sent from a device end to a server, and the security level index is a security level index calculated based on the data importance, data access frequency and data recovery time target, and is used to evaluate the required security level of the target message package. Different security levels correspond to different RAID levels.
[0166] In step S203, a target RAID level is determined from the plurality of RAID levels according to the security level indicator, and a hard disk group corresponding to the target RAID level is determined as a target hard disk group, and the target message package is stored by using the target hard disk group, and the target RAID level is one of the plurality of RAID levels.
[0167] In particular, a target RAID level is determined from the plurality of RAID levels according to the security level indicator, and a hard disk group corresponding to the target RAID level is determined, and the target message package is stored by using the corresponding hard disk group.
[0168] Optionally, the data importance of the message package includes a first degree, a second degree and a third degree, the importance degrees represented by the first degree, the second degree and the third degree are in turn reduced, after the server is configured with the hard disk groups satisfying the RAID levels, the method further comprises: determining the backup strategy and the backup frequency of the RAID level corresponding to each message package according to the data importance of the plurality of message packages, the backup strategy comprises: using full backup when the data importance of the message package is the first degree, using incremental backup when the data importance of the message package is the second degree, and using differential backup when the data importance of the message package is the third degree; setting the backup parameters of the plurality of RAID levels according to the backup strategy and the backup frequency.
[0169] Optionally, the security level indicator is determined according to the data importance, the data access frequency and the data recovery time target of the target message package, comprising: determining a first score as a score corresponding to an importance degree range in which the data importance of the target message package is located according to a first corresponding relationship, the first corresponding relationship is a corresponding relationship between importance degree range and score; determining a second score as a score corresponding to a frequency range in which the data access frequency of the target message package is located according to a second corresponding relationship, the second corresponding relationship is a corresponding relationship between frequency range and score; determining a third score as a score corresponding to a time range in which the data recovery time target of the target message package is located according to a third corresponding relationship, the third corresponding relationship is a corresponding relationship between time range and score; determining the security level indicator as a sum of the first score, the second score and the third score.
[0170] Optionally, the server is configured with the hard disk groups satisfying the RAID levels, comprising: configuring the server with the number and capacity of hard disks corresponding to each RAID level according to the plurality of RAID levels.
[0171] Optionally, after configuring the hard disk groups satisfying the RAID levels for the server, the method further comprises: deploying a RAID controller on the server, and configuring parameters of the RAID controller, the parameters of the RAID controller comprising at least one of: a stripe size, a check mode; and mounting key data on the server to the RAID, the key data comprising at least one of: a database, a log file.
[0172] Optionally, before determining the security level index according to the data importance, the data access frequency and the data recovery time target of the target message package, the method further comprises: performing data decoding on the message package to obtain JSON object data in a string format; performing data parsing on the JSON object data to obtain key value information in the JSON object; and performing data verification on the key value information, the data verification comprising: data integrity verification, data format verification, data content verification and data security verification, the data content verification comprising: verifying whether the ID of the key value information is from a legal device, whether the key value information is within a preset range and whether the update time of the key value information is within a preset time period.
[0173] The device herein can be a server, a PC, a PAD, a mobile phone, etc.
[0174] Obviously, those skilled in the art should understand that the modules or steps of the present application can be realized by general computing devices, which can be concentrated on a single computing device or distributed on a network composed of multiple computing devices, and can be realized by program codes executable by the computing devices, so that they can be stored in storage devices and executed by the computing devices, and in some cases, the steps shown or described can be executed in different orders, or they can be manufactured into individual integrated circuit modules or a single integrated circuit module. Therefore, the present application is not limited to any specific combination of hardware and software.
[0175] Those skilled in the art should understand that the embodiments of the present application can be provided as a method, a system or a computer program product. Therefore, the present application can be in the form of a complete hardware embodiment, a complete software embodiment or an embodiment combining software and hardware aspects. Moreover, the present application can be in the form of a computer program product implemented on one or more computer usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) containing computer usable program codes.
[0176] The computer program instructions can also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer-implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart block or blocks. Figure 1 one or more flow or blocks Figure 1 means for functionally implementing the steps in the flowchart block or blocks
[0177] These computer program instructions can also be stored in a computer readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer readable memory produce an article of manufacture including instructions which implement the function specified in the flowchart block or blocks. Figure 1 one or more flow or blocks Figure 1 means for functionally implementing the steps in the flowchart block or blocks
[0178] The computer program instructions can also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer-implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart block or blocks. Figure 1 one or more flow or blocks Figure 1 means for functionally implementing the steps in the flowchart block or blocks
[0179] In one typical configuration, the computing device includes one or more processors (CPUs), input / output interfaces, network interfaces, and memory.
[0180] The memory can include non-persistent memory and / or volatile memory, such as random access memory (RAM) and / or cache memory, for storing instructions and data. The memory can also include non-volatile memory, such as read only memory (ROM), electrically programmable read only memory (EPROM), electrically erasable programmable read only memory (EEPROM), flash memory, or other non-volatile memory. The memory can be a memory of a computer-readable medium.
[0181] Computer-readable media includes permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer-readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassette, magnetic tape disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information accessible to a computing device. According to the definition herein, computer-readable media does not include transitory media such as modulated data signals and carriers.
[0182] It should also be noted that the terms "comprising", "including", or any other variant thereof are intended to cover non-exclusive inclusion, so that processes, methods, articles or devices including a series of elements not only include those elements, but also include other elements not explicitly listed, or inherent to such processes, methods, articles or devices. Without more limitations, the element defined by the statement "including a" does not exclude the presence of another identical element in the process, method, article or device including the element.
[0183] From the above description, it can be seen that the embodiments described in the present application achieve the following technical effects:
[0184] 1) The storage method of the present application first determines a plurality of RAID levels according to the data importance of a plurality of message packets in the target service and the performance requirements such as read-write speed and delay rate of the server, then configures the corresponding hard disk group for the server according to the determined plurality of RAID levels, in the case of receiving the target message packet sent by the device end, determines the security level index of the target message packet according to the data importance, data access frequency and data recovery time target of the target message packet, finally determines the target RAID level from the plurality of RAID levels according to the security level index, and determines the target hard disk group corresponding to the target RAID level as the target hard disk group, and stores the target message packet by using the hard disk group. According to the characteristics and requirements of the data, the RAID level is dynamically selected, the reasonable configuration of the hard disk resources is realized, the full use of the server hard disk space is ensured, the waste and unbalanced use of the hard disk space are avoided, and the utilization rate and benefit of the hard disk resources are improved.
[0185] 2)、The data storage device of the smart home device of the application, a plurality of RAID levels are determined by the first determination unit according to the data importance of a plurality of message packets in the target service and the performance requirement level of each message packet to the server, the configuration unit configures the hard disk group meeting each RAID level for the server according to the plurality of RAID levels, forms a RAID array, and the second determination unit determines the security level index according to the data importance, data access frequency and data recovery time target of the target message packet in the case that the server receives the target message packet sent by the device end, the storage unit determines the hard disk group corresponding to the target RAID level from the RAID level array according to the security level index to store the target message packet. According to the data importance of a plurality of message packets in the target service of the smart home device and the performance requirement such as read-write speed and delay rate of the server, a plurality of RAID levels are determined, and the corresponding hard disk group is configured for the server according to the determined plurality of RAID levels to form a RAID array. After the server receives the target message packet sent by the device end, the security level index of the target message packet is determined according to the data importance, data access frequency and data recovery time target of the target message packet, and the hard disk group corresponding to the target RAID level is determined from the RAID array according to the security level index to store the target message packet. According to the characteristics and requirements of the smart home device data, the RAID level is dynamically selected, and the reasonable configuration of the hard disk resources is realized.
[0186] The above only describes the preferred embodiments of the application and is not used to limit the application. For those skilled in the art, the application can have various changes and variations. Any modification, equivalent replacement, improvement, etc. within the spirit and principle of the application shall be included in the protection scope of the application.
Claims
1. A data storage method, characterized by, The method comprises the following steps: determining a plurality of RAID levels according to data importance of a plurality of message packages in a target service and performance requirement levels of each of the message packages to a server, wherein the performance requirement levels comprise requirement levels of read-write speed and requirement levels of delay rate, and the server is used to execute the target service, and one of the hard disk groups comprises at least one hard disk; in a case where the target message package is received by the server, determining a security level index according to data importance, data access frequency and data recovery time target of the target message package, wherein the security level index is an index for evaluating a required security level of the message package, and the target message package is part of the plurality of message packages; determining a target RAID level from the plurality of RAID levels according to the security level index, and determining the hard disk group corresponding to the target RAID level as a target hard disk group, and storing the target message package by using the target hard disk group, wherein the target RAID level is one of the plurality of RAID levels, determining a security level index according to data importance, data access frequency and data recovery time target of the target message package, comprising: determining a first score as a score corresponding to an importance degree range of the data importance of the target message package according to a first corresponding relationship, wherein the first corresponding relationship is a corresponding relationship between importance degree ranges and scores; determining a second score as a score corresponding to a frequency range of the data access frequency of the target message package according to a second corresponding relationship, wherein the second corresponding relationship is a corresponding relationship between frequency ranges and scores; determining a third score as a score corresponding to a time range of the data recovery time target of the target message package according to a third corresponding relationship, wherein the third corresponding relationship is a corresponding relationship between time ranges and scores; determining the security level index as a sum of the first score, the second score and the third score.
2. The method of claim 1, wherein, The data importance of the message package comprises a first degree, a second degree and a third degree, and the importance degrees represented by the first degree, the second degree and the third degree are in turn reduced, and after the server is configured with the hard disk groups meeting each of the RAID levels, the method further comprises: determining a backup strategy and a backup frequency of each of the message packages corresponding to the RAID level according to data importance of the plurality of message packages, wherein the backup strategy comprises full backup in a case where the data importance of the message package is the first degree, incremental backup in a case where the data importance of the message package is the second degree, and differential backup in a case where the data importance of the message package is the third degree; setting backup parameters of the plurality of RAID levels according to the backup strategy and the backup frequency.
3. The method according to claim 1 or 2, characterized in that, The server is configured with the hard disk groups meeting each of the RAID levels, comprising: configuring the server with hard disks of a corresponding number and capacity for each of the RAID levels according to the plurality of RAID levels.
4. The method according to claim 1 or 2, characterized in that, After configuring the server with hard disk groups satisfying each of the RAID levels, the method further comprises: deploying a RAID controller on the server and configuring parameters of the RAID controller, the parameters of the RAID controller including at least one of the following: a stripe size, a check mode; mounting key data on the server to the RAID, the key data including at least one of the following: a database, a log file.
5. The method according to claim 1 or 2, characterized in that, Before determining the security level index according to the data importance, the data access frequency and the data recovery time target of the target message package, the method further comprises: performing data decoding on the message package to obtain JSON object data in a string format; performing data parsing on the JSON object data to obtain key value information in the JSON object; performing data verification on the key value information, the data verification including: data integrity verification, data format verification, data content verification and data security verification, the data content verification including: verifying whether the ID of the key value information is from a legal device, whether the key value information is within a preset range and whether the update time of the key value information is within a preset time period.
6. A data storage device of a smart home device, characterized by, comprise: a first determining unit configured to determine a plurality of RAID levels according to data importance of a plurality of message packages in a target service and a performance requirement level of each of the message packages on a server, and configure the server with hard disk groups satisfying each of the RAID levels, the performance requirement level including: a requirement level of read-write rate and a requirement level of delay rate, the server being configured to execute the target service, and one of the hard disk groups including at least one hard disk; a second determining unit configured to, in a case where the server receives a target message package sent by a device end, determine a security level index according to data importance, data access frequency and data recovery time target of the target message package, the security level index being an index for evaluating a required security level of the message package, the target message package being part of the plurality of message packages; a storage unit configured to determine a target RAID level from the plurality of RAID levels according to the security level index, determine a target hard disk group corresponding to the target RAID level as a target hard disk group, and store the target message package by using the target hard disk group, the target RAID level being one of the plurality of RAID levels, the second determining unit comprising: a first determining module configured to determine, according to a first correspondence relationship, a first score as a score corresponding to an importance degree range in which the data importance of the target message package is located, the first correspondence relationship being a correspondence relationship between importance degree ranges and scores; a second determining module configured to determine, according to a second correspondence relationship, a second score as a score corresponding to a frequency range in which the data access frequency of the target message package is located, the second correspondence relationship being a correspondence relationship between frequency ranges and scores; a third determining module, configured to determine, according to a third correspondence relationship, a third score corresponding to a time range in which a data recovery time target of the target message package is located, the third correspondence relationship being a correspondence relationship between a time range and a score; a fourth determining module, configured to determine the security level index as a sum of the first score, the second score and the third score.
7. A computer readable storage medium characterized by The computer readable storage medium comprises a stored program, wherein the program, when executed, controls a device in which the computer readable storage medium is located to perform the method of any one of claims 1 to 5.
8. A computer program product comprising computer instructions, characterized in that, The computer instructions, when executed by the processor, implement the method of any one of claims 1 to 5.
9. An electronic device, comprising: comprise: one or more processors, a memory, and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, and the one or more programs comprise a program for executing the method of any one of claims 1 to 5.
Citation Information
Patent Citations
Data storage method and system based on RAID (Redundant Array of Inexpensive Disk)
CN102033717A
Data processing method, device and equipment based on solid-state disk array and storage medium
CN111880745A