CN110347652B - Multi-machine database synchronization realization method for power quality management system - Google Patents

Multi-machine database synchronization realization method for power quality management system Download PDF

Info

Publication number
CN110347652B
CN110347652B CN201910629675.5A CN201910629675A CN110347652B CN 110347652 B CN110347652 B CN 110347652B CN 201910629675 A CN201910629675 A CN 201910629675A CN 110347652 B CN110347652 B CN 110347652B
Authority
CN
China
Prior art keywords
files
file
management system
data
quality management
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201910629675.5A
Other languages
Chinese (zh)
Other versions
CN110347652A (en
Inventor
陈欢
张振华
张�浩
崔金旭
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tianjin Keyvia Electric Co ltd
Original Assignee
Tianjin Keyvia Electric Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tianjin Keyvia Electric Co ltd filed Critical Tianjin Keyvia Electric Co ltd
Priority to CN201910629675.5A priority Critical patent/CN110347652B/en
Publication of CN110347652A publication Critical patent/CN110347652A/en
Application granted granted Critical
Publication of CN110347652B publication Critical patent/CN110347652B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/16File or folder operations, e.g. details of user interfaces specifically adapted to file systems
    • G06F16/162Delete operations
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/17Details of further file system functions
    • G06F16/172Caching, prefetching or hoarding of files
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/17Details of further file system functions
    • G06F16/178Techniques for file synchronisation in file systems

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Human Computer Interaction (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Power Sources (AREA)
  • Remote Monitoring And Control Of Power-Distribution Networks (AREA)

Abstract

The invention provides a method for realizing the synchronization of a plurality of databases of a power quality management system, which comprises the steps of S1, arranging a plurality of servers, wherein each server runs the same set of power quality management system software, and a master control module in the power quality management system is used for monitoring the state of each server; and S2, dividing the server roles into a host machine and a standby machine, operating the main control module process, monitoring the role change among the servers, and controlling the servers to perform role switching work. The invention adopts the data file which can be conveniently written into the sqlite type of the database to carry out data synchronous transmission, avoids a large amount of communication message analysis work and frequent data writing, further does not need to carry out any role transformation operation on the database, ensures that the roles of the databases running in all servers are consistent, further avoids database problems and improves the stability of the power quality management system.

Description

Multi-machine database synchronization realization method for power quality management system
Technical Field
The invention belongs to the field of multi-machine database synchronization of an electric energy quality management system, and particularly relates to a method for realizing multi-machine database synchronization of the electric energy quality management system.
Background
In the traditional multi-computer synchronization mode, two modes are basically provided, one mode is that a synchronization scheme provided by a selected database is adopted to set the related roles of a main machine and a standby machine, database software automatically synchronizes the contents of the databases, and the scheme is complex in configuration and needs an additional coordination program to control the roles of the databases. The second scheme is to transmit data to the standby machine through communication messages, and the scheme has huge communication data volume and needs to analyze the messages and perform frequent database writing operation
Disclosure of Invention
In view of the above, the present invention provides a method for implementing multi-machine database synchronization in an electric energy quality management system, which aims to overcome the above-mentioned defects in the prior art.
In order to achieve the purpose, the technical scheme of the invention is realized as follows:
a method for realizing synchronization of a plurality of databases of a power quality management system comprises the following steps:
s1, setting a plurality of servers, wherein each server runs the same set of power quality management system software, and monitoring the state of each server by using a main control module in the power quality management system;
s2, dividing the server roles into a host and a standby, operating the main control module process, monitoring the role change among the servers, and controlling the servers to perform role switching work;
s3, the server starts a file receiving module and a file sending module, and the main control module judges whether the running power quality management system server is in a host role or not;
s4, when the main control module judges that the server is the host, starting the acquisition module and sending the data file to the standby file receiving module;
and S5, when the main control module judges that the server is the standby machine, the standby machine file receiving module receives the data file from the host machine.
Further, in step S2, a data caching folder Doc1, a data sending folder Doc2, and a database warehousing folder Doc3 are created in the server.
Further, the specific method of step S4 is as follows:
s401, generating a database file and putting the database file into Doc 3;
s402, the storage module sequentially writes the files into a local database from Doc3, copies the files and stores the files into Doc1, and then deletes the files in Doc 3;
s403, the master control module copies the files in the Doc1 to the Doc2 and deletes the files in the Doc 1;
s404, the file sending module sends the Doc2 file to all standby machines.
Further, in step S401, the acquisition module performs data acquisition on the underlying device, generates different data files according to different data types after analyzing the acquired data, and puts the generated data files into Doc3, where the data files are sql lite type files.
Further, in step S404, the file sending module in the power quality management system detects that a data file exists in Doc2, and immediately obtains all files and sequentially sends the files to the file receiving modules of other servers.
Further, the specific method of step S5 is as follows:
s501, the file receiving module puts the received data file into Doc 3;
s502, the storage module sequentially writes the files into a local database from the Doc3, copies the files to the Doc1, and then deletes the files in the Doc 3;
s503, the main control module deletes all files in the Doc 1.
Compared with the prior art, the invention has the following advantages:
the invention provides a method for realizing the synchronization of a plurality of machine databases of an electric energy quality management system, which adopts a proprietary file sending module and a proprietary file receiving module to finish the synchronization work of data files between a main server and a standby server, and can freely and flexibly configure the information of a connection server; in addition, in the operation scheme of writing a large amount of data into the database, data synchronous transmission is carried out by adopting a data file which can be conveniently written into the sqlite type of the database, so that a large amount of communication message analysis work is avoided, frequent data writing is avoided, further, the method does not need to carry out any role transformation operation on the database, the roles of the databases running in all servers are consistent, database problems are further avoided, and the stability of the power quality management system is improved.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments of the invention and, together with the description, serve to explain the invention without limitation. In the drawings:
fig. 1 is a flowchart of a method for implementing database synchronization of a power quality management system according to an embodiment of the present invention;
fig. 2 is a communication structure diagram of the main server and the standby server in the embodiment of the invention;
fig. 3 is a schematic diagram of data file interaction of a power quality management system according to an embodiment of the present invention.
Detailed Description
It should be noted that the embodiments and features of the embodiments of the present invention may be combined with each other without conflict.
In the description of the present invention, it is to be understood that the terms "central," "longitudinal," "lateral," "upper," "lower," "front," "rear," "left," "right," "vertical," "horizontal," "top," "bottom," "inner," "outer," and the like are used in the orientation or positional relationship indicated in the drawings, which are merely for convenience in describing the invention and to simplify the description, and are not intended to indicate or imply that the referenced device or element must have a particular orientation, be constructed and operated in a particular orientation, and are therefore not to be construed as limiting the invention. Furthermore, the terms "first", "second", etc. are used for descriptive purposes only and are not to be construed as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first," "second," etc. may explicitly or implicitly include one or more of that feature. In the description of the invention, the meaning of "a plurality" is two or more unless otherwise specified.
In the description of the invention, it is to be noted that, unless otherwise explicitly specified or limited, the terms "mounted", "connected" and "connected" are to be construed broadly, e.g. as being fixed or detachable or integrally connected; can be mechanically or electrically connected; they may be connected directly or indirectly through intervening media, or they may be interconnected between two elements. The specific meaning of the above terms in the creation of the present invention can be understood by those of ordinary skill in the art through specific situations.
The invention will be described in detail with reference to the following embodiments with reference to the attached drawings.
As shown in fig. 2, the communication structure of the active/standby server in the embodiment of the present invention is as follows:
1. power quality management system server > =2 stations.
2. The main control module is a module which is mainly responsible for monitoring role changes among servers and implementing role switching work of the servers in the existing power quality management system.
3. The server role is divided into a host machine and a standby machine.
4. The data files collected and generated by the host are stored in a local database warehousing folder Doc3, and the storage module is mainly used for acquiring the data files from the Doc3 and sequentially writing the data files into the database.
5. During the process of writing into the database, the data file is copied to the data cache folder Doc1, and the file in the original Doc3 is deleted.
6. When the server is in the role of the host, the master control module copies the data files in the Doc1 to the data sending folder Doc2 and deletes the files in the Doc 1.
7. When the server role is the standby machine, only the file in the Doc1 is deleted, and at this time, no data file exists in the Doc2, so the file sending module cannot send the data file to other servers until the server role changes from the standby machine to the host machine, and the file sending module does not detect that the data file sent to other servers exists in the Doc 2.
8. Each server runs a file sending module and a file receiving module process. The file sending module regularly detects whether a file exists in Doc2, and immediately sends the file to all other servers if the file exists. The file receiving module is used for receiving the data files sent from all other servers and then placing the data files into the Doc 3.
As shown in fig. 3, the data file interaction structure of the power quality management system in the embodiment of the present invention is formed as follows:
1. and a file sending module and a file receiving module are operated in each server. The file sending module in the server is connected with the receiving modules of all other servers; the file receiving module in the server is also connected with the sending modules in all other servers; the connection information configures the ip and the port numbers of all servers before the power quality management system operates; the power quality management system loads the configuration information after being started, and the file sending module and the file receiving module acquire the configuration information and establish connection with other modules for sending and receiving data files.
2. The solid line in fig. 3 is the connection of the real transmission data file and the reception data file of the system. The dotted line is that a connection has been established but no actual data file is sent and received.
3. In fig. 3, not only the case of one host and two standby devices is limited, but also a case of one host and a plurality of standby devices may be provided.
As shown in fig. 1, a specific method for implementing synchronization of databases of the power quality management system in the embodiment of the present invention is as follows:
1. and the master control module runs the process. All servers run the same set of power quality management system software, the master control module monitors the states of all servers of the power quality management system in real time, and when the servers need to switch roles, the master control module switches the roles of the servers. The main control module is responsible for coordinating and completing data synchronization operation of the server.
2. A data caching folder Doc1, a data sending folder Doc2, and a database warehousing folder Doc3 are created. Doc1 is mainly an intermediate folder for data synchronization between a host and a standby host, and only the host can further send data to be synchronized to other server receiving modules, so that repeated cyclic sending of data files among multiple servers is prevented, and the load of a power quality management system is increased to affect use.
3. The file receiving module and the file sending module are started. The ip and port numbers of all servers are configured by the power quality management system, and connection between the file sending module and the file receiving module between the servers is respectively established, which is shown in detail in fig. 3.
4. And judging whether the running power quality management system server is in a host role or not. If the host is the host, the process proceeds to step 5, and if the standby is the standby, the process proceeds to step 10.
5. And starting the acquisition module for the first time. If the power quality management system is in initial operation, the acquisition module is started under the condition that the power quality management system is judged to be configured as the host, and the acquisition module is a module used for acquiring data of bottom equipment in the existing power quality management system.
6. The resulting database file is placed in Doc 3. The acquisition module carries out data acquisition on the bottom equipment, then generates different data files according to different data types after analyzing the acquired data, and the data files are sqlite type files, so that the data files can be conveniently written into a database. The collection module places the generated data file into Doc 3. Doc3 is a folder for the power quality management system to obtain data files for writing into the database.
7. The storage module writes the files from Doc3 into the local database in sequence, copies the files to Doc1, and deletes the files in Doc 3. The storage module is responsible for writing data files from Doc3 to the native database, then copying the data files to Doc1, and deleting the post-database files in Doc 3.
8. The master module copies the files in Doc1 to Doc2 and deletes the files in Doc 1. When the power quality management system judges that the local computer is in the host role, the power quality management system regularly detects whether data files exist in Doc1 in the local computer, if so, the files in Doc1 are all copied into Doc2, and the files in Doc1 are deleted.
9. The file sending module sends the Doc2 file to all standby machines. And the file sending module in the power quality management system detects that the data file exists in the Doc2, immediately acquires all the files and sequentially sends the files to the file receiving modules of other servers.
10. The database file receiving module receives a file. At the moment, the server of the power quality management system takes the role of a standby machine. The standby file receiving module continuously receives data files from the host.
11. Put into the database repository folder Doc 3. The file receiving module places the received data file into Doc 3.
12. The storage module writes the file from Doc3 to the database for storage in Doc1 and deletes the file in Doc 3; the storage module is a module used for reading and writing data in the existing power quality management system.
13. The master control module deletes all files in Doc 1. When the power quality management system detects that the local machine has the role of a standby machine, the data files in the Doc1 are completely deleted, and the operation of assigning the Doc1 to the Doc2 in the host machine is not performed, so that the data files generated by the acquisition module can be sent to other servers only under the condition of the host machine.
The invention provides a method for realizing the synchronization of a plurality of databases of an electric energy quality management system, which is mainly completed by a main control module, a storage module, a file sending module and a file receiving module of the electric energy quality management system, wherein the main control module is mainly responsible for coordinating and controlling the work of each process module of a server and completing the role task of each server, and the independent file sending module and the independent file receiving module are adopted, so that the data interaction work among the servers can be flexibly customized and completed, and meanwhile, the data interaction is carried out by adopting a sqlite file mode, so that the data volume sending and the data analysis work of the system are reduced, the work load of the server is lightened, the data interaction efficiency is improved, and the data synchronization work of the main server and the standby server is ensured.
The invention provides a method for realizing the synchronization of a plurality of machine databases of an electric energy quality management system, which adopts a proprietary file sending module and a proprietary file receiving module to finish the synchronization work of data files between a main server and a standby server, and can freely and flexibly configure the information of a connection server; in addition, in the operation scheme of writing a large amount of data into the database, data synchronous transmission is carried out by adopting a data file which can be conveniently written into the sqlite type of the database, so that a large amount of communication message analysis work is avoided, frequent data writing is avoided, further, the method does not need to carry out any role transformation operation on the database, the roles of the databases running in all servers are consistent, database problems are further avoided, and the stability of the power quality management system is improved.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and should not be taken as limiting the invention, so that any modifications, equivalents, improvements and the like, which are within the spirit and principle of the present invention, should be included in the scope of the present invention.

Claims (2)

1. A method for realizing synchronization of a plurality of databases of a power quality management system is characterized by comprising the following steps:
s1, setting a plurality of servers, wherein each server runs the same set of power quality management system software, and monitoring the state of each server by using a main control module in the power quality management system;
s2, dividing the server roles into a host and a standby, operating the main control module process, monitoring the role change among the servers, and controlling the servers to perform role switching work, wherein the specific method comprises the following steps: creating a data caching folder Doc1, a data sending folder Doc2 and a database warehousing folder Doc3 in the server;
s3, the server starts a file receiving module and a file sending module, and the main control module judges whether the running power quality management system server is in a host role or not;
s4, when the main control module judges that the server is the host, the acquisition module is started to send the data file to the standby file receiving module, and the specific method is as follows:
s401, generating a database file and putting the database file into a Doc3, in the step S401, performing data acquisition on bottom equipment by an acquisition module, analyzing acquired data, generating different data files according to different data types, and putting the generated data files into a Doc3, wherein the data files are sqlite type files;
s402, the storage module sequentially writes the files into a local database from Doc3, copies the files and stores the files into Doc1, and then deletes the files in Doc 3;
s403, the master control module copies the files in the Doc1 to the Doc2 and deletes the files in the Doc 1;
s404, the file sending module sends the Doc2 file to all the standby machines, in the step S404, the file sending module in the power quality management system detects that the data file exists in the Doc2, immediately obtains all the files and sequentially sends the files to the file receiving modules of other servers;
and S5, when the main control module judges that the server is the standby machine, the standby machine file receiving module receives the data file from the host machine.
2. The method for implementing synchronization of multiple databases in power quality management system according to claim 1, wherein in step S5, the specific method is as follows:
s501, the file receiving module puts the received data file into Doc 3;
s502, the storage module sequentially writes the files into a local database from the Doc3, copies the files to the Doc1, and then deletes the files in the Doc 3;
s503, the main control module deletes all files in the Doc 1.
CN201910629675.5A 2019-07-12 2019-07-12 Multi-machine database synchronization realization method for power quality management system Active CN110347652B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910629675.5A CN110347652B (en) 2019-07-12 2019-07-12 Multi-machine database synchronization realization method for power quality management system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910629675.5A CN110347652B (en) 2019-07-12 2019-07-12 Multi-machine database synchronization realization method for power quality management system

Publications (2)

Publication Number Publication Date
CN110347652A CN110347652A (en) 2019-10-18
CN110347652B true CN110347652B (en) 2022-03-18

Family

ID=68175089

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910629675.5A Active CN110347652B (en) 2019-07-12 2019-07-12 Multi-machine database synchronization realization method for power quality management system

Country Status (1)

Country Link
CN (1) CN110347652B (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103020242A (en) * 2012-12-19 2013-04-03 中国人民解放军第二炮兵装备研究院第四研究所 Data synchronization method based on oracle database
CN104331425A (en) * 2014-10-20 2015-02-04 许继电气股份有限公司 Data synchronization method for real-time database of power grid monitoring system
CN105516292A (en) * 2015-12-03 2016-04-20 国家电网公司 Hot standby method of cloud platform of intelligent substation
CN106599061A (en) * 2016-11-16 2017-04-26 成都九洲电子信息系统股份有限公司 SQLite-based embedded database synchronization method

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7062515B1 (en) * 2001-12-28 2006-06-13 Vignette Corporation System and method for the synchronization of a file in a cache
AU2016100635A4 (en) * 2015-05-18 2016-06-16 Certainedge Pty Ltd Software creation system

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103020242A (en) * 2012-12-19 2013-04-03 中国人民解放军第二炮兵装备研究院第四研究所 Data synchronization method based on oracle database
CN104331425A (en) * 2014-10-20 2015-02-04 许继电气股份有限公司 Data synchronization method for real-time database of power grid monitoring system
CN105516292A (en) * 2015-12-03 2016-04-20 国家电网公司 Hot standby method of cloud platform of intelligent substation
CN106599061A (en) * 2016-11-16 2017-04-26 成都九洲电子信息系统股份有限公司 SQLite-based embedded database synchronization method

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
电能质量监测及管理系统;聂晶晶等;《电力自动化设备》;20051031;第25卷(第10期);全文 *

Also Published As

Publication number Publication date
CN110347652A (en) 2019-10-18

Similar Documents

Publication Publication Date Title
US10944628B2 (en) Network operation support system and network device management method
CN102970328B (en) Data on-line migration method of typical production system in power industry
CN107368369B (en) Distributed container management method and system
CN102035862A (en) Configuration node fault transfer method and system in SVC cluster
CN103077242A (en) Method for hot standby of dual database servers
CN102710665A (en) Mobile terminal, and data synchronization method of server and mobile terminal
CN103200247B (en) A kind of data download method and PC download client
CN103237075A (en) Data synchronizing method, device and system
CN104914770A (en) UPS (uninterruptible power supply) monitoring system
CN108140035A (en) The database copy method and device of distributed system
CN102945260A (en) Conflict detection method based on user-level file two-way synchronization
CN104516795A (en) Data access method and system
CN105227399A (en) Based on network equipment Debugging message acquisition methods and the system of User space
CN101820356A (en) Network fault diagnosis system based on ARM-Linux
CN110347652B (en) Multi-machine database synchronization realization method for power quality management system
CN102122430B (en) Device and method for collecting agricultural product information
CN109491679A (en) A kind of CPLD online upgrading method and device
CN108762992B (en) Main/standby switching method and device, computer equipment and storage medium
CN109165228A (en) Smart grid Dispatching Control System real-time data base monitoring system and method
CN111209652B (en) Method and device for constructing time sequence of static equipment model of power system
CN115729164B (en) Industrial communication system management method and device and industrial communication system
CN101610225A (en) A kind of synchronization processing method, system and device
CN109684611A (en) A kind of dictionary code-transferring method, device, storage medium and terminal
CN115630122A (en) Data synchronization method and device, storage medium and computer equipment
CN115776175A (en) Dispatching automation data acquisition method and system based on security access area

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
PE01 Entry into force of the registration of the contract for pledge of patent right

Denomination of invention: A Method for Implementing Multi machine Database Synchronization in Power Quality Management System

Effective date of registration: 20230615

Granted publication date: 20220318

Pledgee: Bank of Beijing Limited by Share Ltd. Tianjin branch

Pledgor: TIANJIN KEYVIA ELECTRIC Co.,Ltd.

Registration number: Y2023980044280

PE01 Entry into force of the registration of the contract for pledge of patent right
PC01 Cancellation of the registration of the contract for pledge of patent right

Granted publication date: 20220318

Pledgee: Bank of Beijing Limited by Share Ltd. Tianjin branch

Pledgor: TIANJIN KEYVIA ELECTRIC Co.,Ltd.

Registration number: Y2023980044280

PC01 Cancellation of the registration of the contract for pledge of patent right