[go: up one dir, main page]

CN109992488B - Statistical method based on MongoDB database - Google Patents

Statistical method based on MongoDB database Download PDF

Info

Publication number
CN109992488B
CN109992488B CN201910047905.7A CN201910047905A CN109992488B CN 109992488 B CN109992488 B CN 109992488B CN 201910047905 A CN201910047905 A CN 201910047905A CN 109992488 B CN109992488 B CN 109992488B
Authority
CN
China
Prior art keywords
database
data
server
authentication data
corresponding relation
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
CN201910047905.7A
Other languages
Chinese (zh)
Other versions
CN109992488A (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.)
Zhuhai Xishanju Digital Technology Co ltd
Zhuhai Kingsoft Digital Network Technology Co Ltd
Original Assignee
Zhuhai Xishanju Digital Technology Co ltd
Zhuhai Kingsoft Digital Network Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zhuhai Xishanju Digital Technology Co ltd, Zhuhai Kingsoft Digital Network Technology Co Ltd filed Critical Zhuhai Xishanju Digital Technology Co ltd
Priority to CN201910047905.7A priority Critical patent/CN109992488B/en
Publication of CN109992488A publication Critical patent/CN109992488A/en
Application granted granted Critical
Publication of CN109992488B publication Critical patent/CN109992488B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/34Recording or statistical evaluation of computer activity, e.g. of down time, of input/output operation ; Recording or statistical evaluation of user activity, e.g. usability assessment
    • G06F11/3452Performance evaluation by statistical analysis
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2201/00Indexing scheme relating to error detection, to error correction, and to monitoring
    • G06F2201/80Database-specific techniques

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Probability & Statistics with Applications (AREA)
  • Evolutionary Biology (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Computer Hardware Design (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Quality & Reliability (AREA)
  • General Physics & Mathematics (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention provides a statistical method based on a MongoDB database, which comprises the following steps: s100) defining IP addresses, port numbers, user names, passwords and database collection names to be counted of one or more servers to be accessed through instructions; s200) the client is connected with a remote server through an IP address, a port number, a user name and a password and accesses a database in one or more servers; s300) all database names in one or more servers are obtained, all databases are traversed to obtain attribute relation data of the database set containing all database set names to be counted under each database, the relation data corresponding to the database sets with the same database sets are accumulated to obtain corresponding relation data of the database sets, and the corresponding relation data are stored in a storage device; s400) displaying the corresponding relation data of the database set.

Description

Statistical method based on MongoDB database
Technical Field
The invention relates to the field of server side testing, in particular to a statistical method based on a MongoDB database.
Background
In a large business scene, the database and the table are bound to be divided. The adoption of MongoDB as a storage medium has been a very popular trend. However, the operation of the MongoDB on the aspect of library occupation is complex, and the required data can be obtained only after a machine is logged in, a library is entered, a command is executed and a series of operations are performed. This method of operation is inefficient and intolerable with large database data sets.
Another scenario is that data hot spots need to be found, i.e. distribution of database liveness, or proportion of different databases occupied. Therefore, necessary measures are taken aiming at different input and output bureau libraries, such as increasing the data cleaning force, dividing tables and the like.
Thus, a statistical method is needed in which the data of the MongoDB as a whole can be seen, the statistical data of specified categories can be seen, and the statistical method is the same as the statistical method in which a user logs in a machine and enters the MongoDB to execute various commands. The method has the advantages that not only can the whole data (index size, data number, physical occupied space, data size and the like) be obtained, but also the size sequencing of the data is expected to be visually seen, namely the data occupation ratio exists, and meanwhile, distributed monitoring is required, namely the data of a plurality of machines are remotely acquired instead of single-point acquisition.
Disclosure of Invention
The invention provides a statistical method based on a MongoDB database, aiming at the problem that cross-database statistics cannot be carried out aiming at one-time operation of multiple libraries and multiple tables in the prior art.
Firstly, the invention provides a statistical method based on a MongoDB database, which comprises the following steps:
s100) defining IP addresses, port numbers, user names, passwords and database set names to be counted of one or more servers and/or databases to be accessed through instructions;
s200) the client is connected with a remote server through an IP address, a port number, a user name and a password and accesses a database in one or more servers;
s300) obtaining all database names of the databases in one or more servers, traversing all databases to obtain attribute relation data of the database set containing all database set names to be counted under each database, accumulating the corresponding relation data of the database sets with the same database set to obtain corresponding relation data of the database sets, and storing the corresponding relation data in a storage device; the corresponding relation comprises at least one of the following items, data volume, file size ratio, data size ratio, storage size ratio, average object size, index number and index space size;
s400) displaying the corresponding relation data of the database set.
Further, in the method provided by the present invention, step S200 further includes the following sub-steps:
s201) the client sends an access request to a server and/or a database by using a communication method;
s202) the server and/or the database receives an access request sent by the client and judges whether the access request contains authorization information, if not, the server and/or the database sends unauthorized information with first authentication data generated by the server and/or the database to the client, and if so, the client is allowed to access the server and/or the database;
s203) the client receives unauthorized information sent by the server and/or the database, extracts the first authentication data, generates second authentication data by adopting a first algorithm and the first authentication data, a user name of the server and/or the database and a password of the server and/or the database, and sends the second authentication data to the server and/or the database;
s204) after the server and/or the database receives the second authentication data sent from the client, third authentication data are generated by adopting the first algorithm and the first authentication data, the server and/or the database user name and the server and/or the database password, whether the third authentication data are consistent with the second authentication data or not is judged, if yes, the client is allowed to access the server and/or the database, and if not, the access request is refused.
Specifically, in the method provided by the present invention, the first algorithm is a message digest algorithm.
Specifically, in the method provided by the present invention, the message digest algorithm is at least one of the following algorithms: MD algorithm, SHA algorithm, and MAC algorithm.
Further, in the method provided by the present invention, the first authentication data is random data generated by a server and/or a database.
Further, in the foregoing method provided by the present invention, the communication method includes at least one of: a wired communication method, a wireless communication method.
Further, in the above method provided by the present invention, the wireless communication method includes at least one of: 2G,3G,4G,5G and Wi-Fi.
Further, in the method provided by the present invention, step S300 further includes the following sub-steps:
and appointing one of the corresponding relations, and sorting the corresponding relation data of the database set according to an ascending method or a descending method according to the appointed corresponding relation.
Secondly, the invention provides a statistical device based on a MongoDB database, which comprises the following modules:
the definition module is used for defining the IP address, the port number, the user name, the password and the name of the database set to be counted of one or more servers and/or databases to be accessed through instructions;
the access module is used for connecting the client with the remote server through the IP address, the port number, the user name and the password and accessing the database in one or more servers;
the acquisition module is used for acquiring all database names of the databases in one or more servers, traversing all databases to obtain attribute relation data of the database set containing all database set names to be counted under each database, accumulating the corresponding relation data of the database sets with the same database set to obtain corresponding relation data of the database sets, and storing the corresponding relation data in the storage device; the corresponding relation comprises at least one of the following items, namely data volume, file size ratio, data size ratio, storage size ratio, average object size, index number and index space size;
and the display module is used for displaying the corresponding relation data of the database set.
Finally, the invention proposes a computer-readable storage medium having stored thereon computer instructions for executing the method described above.
The beneficial results of the invention are: the method provided by the invention can acquire each statistical data of the occupied resources of a plurality of tables in a plurality of databases in a remote database by one key, and obtain similar reports for research and development or DBA reference, namely observation of user data volume, and also can be used as a basis for data cleaning.
Drawings
Fig. 1 is a network topology diagram of a statistical method based on a MongoDB database proposed in the present application;
FIG. 2 is a flow chart of a first embodiment of the statistical method based on MongoDB database proposed in the present application;
FIG. 3 is a flow chart of a statistical method based on MongoDB database according to a second embodiment of the present invention;
FIG. 4 is a second embodiment of the statistical method based on MongoDB database according to the present application;
FIG. 5 is a statistical table of a MongoDB database-based statistical method according to a third embodiment of the present invention;
FIG. 6 is a data file structure of MongoDB database based on statistical method of MongoDB database proposed by the present application;
FIG. 7 is a statistical table of a MongoDB database-based statistical method according to a fourth embodiment of the present invention;
FIG. 8 is a statistical table of a MongoDB database-based statistical method according to a fifth embodiment of the present application;
FIG. 9 is a statistical pie chart of a fifth embodiment of the MongoDB database-based statistical method proposed in the present application;
fig. 10 is a frame diagram of a statistical device based on the MongoDB database according to the present application.
Detailed Description
The conception, the specific structure and the technical effects produced by the present invention will be clearly and completely described in conjunction with the embodiments and the attached drawings, so as to fully understand the objects, the schemes and the effects of the present invention. It should be noted that the embodiments and features of the embodiments in the present application may be combined with each other without conflict. The same reference numbers will be used throughout the drawings to refer to the same or like parts.
It should be noted that, unless otherwise specified, when a feature is referred to as being "fixed" or "connected" to another feature, it may be directly fixed or connected to the other feature or indirectly fixed or connected to the other feature. Furthermore, the descriptions of upper, lower, left, right, etc. used in this application are only relative to the positional relationship of the various elements of the application with respect to one another in the drawings. As used in this application and the appended claims, the singular forms "a", "an", and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise.
Furthermore, unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art. The terminology used in the description herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. As used herein, the term "and/or" includes any combination of one or more of the associated listed items.
Referring to fig. 1, a network topology diagram of a statistical method based on a MongoDB database is shown, in which N servers connected to a communication network through a router or a switch, that is, a server 1, a server 2 and a server N, and a client 1 and a client 2 connected to the network through the router or the switch are shown, where the communication network may be a local area network, may also be the internet, and may also be an enterprise private line, where a database and a database set are stored in storage devices in the N servers, on the other hand, the client may be a fixed device, such as a desktop computer, and may also be a mobile terminal, such as a mobile phone or a tablet computer, a laptop computer, etc., and the communication connection mode may be wired communication or wireless communication, and when a terminal device such as a mobile phone or a tablet computer without a network cable socket is used, a wireless communication means needs to be used to connect to the communication network, and the wireless communication means at least includes: 2G,3G,4G,5G and Wi-Fi.
Referring to fig. 2, a flow chart of a first embodiment of the statistical method based on the MongoDB database proposed by the present application shows the method steps of statistics of a set of the MongoDB database by accessing a server, including:
s100) defining IP addresses, port numbers, user names, passwords and database set names to be counted of one or more servers and/or databases to be accessed through instructions;
s200) the client is connected with the remote server through an IP address, a port number, a user name and a password and accesses a database in one or more servers;
s300) obtaining all database names of the databases in one or more servers, traversing all databases to obtain attribute relation data of the database set containing all database set names to be counted under each database, accumulating the corresponding relation data of the database sets with the same database set to obtain corresponding relation data of the database sets, and storing the corresponding relation data in a storage device; the corresponding relation comprises at least one of the following items, namely data volume, file size ratio, data size ratio, storage size ratio, average object size, index number and index space size;
s400) displaying the corresponding relation data of the database set.
Further, step S300 further includes the following sub-steps:
and appointing one of the corresponding relations, and sorting the corresponding relation data of the database set according to an ascending method or a descending method according to the appointed corresponding relation.
Specifically, in the method provided by the present invention, the specified manner includes at least one of the following manners, which is set by default and manually.
Further, step S300 further includes the following sub-steps:
and judging whether the data contained in the corresponding relation can be completely displayed in one row or not, and if not, displaying the data in different rows.
Specifically, the MongoDB is written by C + + language and is an open source database system based on distributed file storage. Under the condition of high load, more nodes are added, and the performance of the server can be ensured.
MongoDB stores data as one document, and the data structure is composed of key value (key = > value) pairs. The MongoDB document is similar to a JSON object. The field values may include other documents, arrays, and document arrays. The set is a document group of the mongoDB, similar to a table in an RDBMS (Relational Database Management System), the set exists in a Database, and the set has no fixed structure, which means that you can insert data of different formats and types into the set, but in general, the data inserted into the set has a certain relevance. Similarly, a set of MongoDB databases corresponds to a database table in SQL terminology. Moreover, a plurality of databases can be established in one MongoDB.
Further, since the server generally involves the problem of access security, the client needs to introduce an authentication means when accessing the server to ensure the security of data in the server. Referring to fig. 3, a flowchart of a second embodiment of a statistical method based on a MongoDB database is shown, in which a server authentication process using a username-password login method is shown, and the server authentication process includes the following steps:
s201) the client sends an access request to a server and/or a database by using a communication method;
s202) the server and/or the database receives an access request sent by the client and judges whether the access request contains authorization information, if not, the server and/or the database sends unauthorized information with first authentication data generated by the server and/or the database to the client, and if so, the client is allowed to access the server and/or the database;
s203) the client receives unauthorized information sent by the server and/or the database, extracts the first authentication data, generates second authentication data by adopting a first algorithm and the first authentication data, a user name of the server and/or the database and a password of the server and/or the database, and sends the second authentication data to the server and/or the database;
s204) after the server and/or the database receives second authentication data sent by the client, third authentication data is generated by adopting a first algorithm and the first authentication data and the server and/or the database user name and the server and/or the database password, and whether the third authentication data is consistent with the second authentication data or not is judged, if so, the client is allowed to access the server and/or the database, and if not, the access request is refused.
Specifically, in the method provided by the present invention, the first algorithm is a message digest algorithm.
Specifically, in the method provided by the present invention, the message digest algorithm is at least one of the following algorithms: MD algorithm (message digest algorithm), SHA algorithm (secure hash algorithm), and MAC algorithm (message authentication code algorithm).
Specifically, the MD algorithm family includes MD2, MD3, MD4, and MD5 algorithms, all of which require obtaining a random length of information and generating a 128-bit digest of the information. If the 128-bit binary abstract information is converted into hexadecimal, a 32-bit character string can be obtained, and the digital fingerprints of most of the daily MD5 algorithms are 32 hexadecimal character strings.
The Secure Hash Algorithm (Secure Hash Algorithm) is mainly applied to a Digital Signature Algorithm (Digital Signature Algorithm DSA) defined in the Digital Signature Standard (DSS). For messages with length less than 2^64 bits, SHA1 generates a 160-bit message digest. In the MAC algorithm, the hash value of a message is controlled by a secret key K known only to both parties of communication. The Hash value is then called MAC.
Further, the communication process can refer to the information flow diagram of the second embodiment of the statistical method based on the MongoDB database proposed in the present application as shown in fig. 4:
step 1, a client initiates an access request to a server;
step 2, the server receives the access request, judges whether the client has the right to access, if not, initiates an authentication process to the client, specifically, sends the information requiring authentication with the first authentication data generated by the server to the client;
step 3, after receiving the first authentication data, the client calculates second authentication data and sends the second authentication data to the server;
and 4, after receiving the second authentication data, the server calculates third authentication data by the same method and compares the third authentication data with the second authentication data, if the third authentication data is consistent with the second authentication data, the server allows the client to initiate a service request, and if the third authentication data is inconsistent with the second authentication data, the server refuses the access request of the client.
Further, in the method provided by the present invention, the first authentication data is random data generated by a server and/or a database.
Further, in the foregoing method provided by the present invention, the communication method includes at least one of: a wired communication method, a wireless communication method.
Further, in the above method provided by the present invention, the wireless communication method includes at least one of: 2G,3G,4G,5G and Wi-Fi.
Further, if the database is provided with the user name and the password, the corresponding database can be accessed only by performing corresponding authentication, and the specific authentication process can refer to the authentication process of the server.
Still further, in addition to using authentication methods, some measure of communication security may be used to ensure the security of data transmission, such as through an IPSEC VPN.
Specifically, the communication flow of one IPSec is as follows:
1. user A (on host A) sends a message to user B (on host B);
2. the IPSec driver on host a checks the IP filter to see if and what kind of protection the packet needs to be protected;
3. the driver informs the IKE to start security negotiation;
4. the IKE on the host B receives the request security negotiation notification;
5. two hosts establish a first-stage SA, and respectively generate shared 'master key' notes: if the two machines have already established the first-stage SA in the previous communication, the second-stage SA negotiation can be directly carried out;
6. negotiating to establish a second stage SA pair: an inbound SA and an outbound SA. The SA comprises a secret key and an SPI;
7. the IPSec driver on host a signs (integrity check) and/or encrypts the packet using the outbound SA.
(start sending data packets);
8. the driver delivers the data packet to the IP layer, and the IP layer forwards the data packet to the host B;
9. the host B network adapter driver receives the data packet and submits the data packet to the IPSec driver;
10. the IPSec driver on host B checks the integrity signature and/or decrypts the packet using the inbound SA;
11. the driver submits the decrypted data packet to an upper TCP/IP driver, and then the TCP/IP driver submits the data packet to a receiving application program of the host B.
After the authentication measures and the secure communication connection are established, the data in the server can be safely accessed.
Referring to fig. 5, a statistical table of a third embodiment of the statistical method based on the MongoDB database proposed by the present application is obtained by executing the following commands:
python MongoDB_stat_tool.py-h 10.11.81.62-u root-p root-c crash_raw_data。
in the command, the 'crash _ raw _ data' represents the name of a database set needing to be counted, the command counts the data condition of a set name of all the libraries on the 10.11.81.62 with a set of 'crash _ raw _ data', and the service condition of each library is counted. The lead is based on python, and the used technologies are mainly python, pymongo, psutil and the like
Specifically, pymongo is a driver, so that a python program can be written by using a Mongodb database and a python, the MongoClient in the pymongo database needs to be used when the MongoDB database is connected, generally, the IP address and the port of the MongoDB are set, the first parameter is an address host, the second parameter is a port, and the default of the port is 27017 if the MongoDB database is not connected.
import pymongo
client=pymongo.MongoClient(host='localhost',port=27017)
A MongoDB connection object can be created through the command. In addition, the first parameter host of MongoClient can also be directly transmitted to the connection character string of MongoDB, beginning with MongoDB,
the MongoDB is also divided into databases, and a database to be used needs to be specified in a program. Taking the example of accessing a database named data, by following the command,
db=client.data
returning to a test database by calling the test attribute of the client;
each MongoDB database contains many collections, similar to the tables in relational databases, so that the collections to be operated on need to be specified, and the following commands need to be utilized
Collection = db, wherein Collection is the set that needs access.
Specifically, in the table of fig. 5, it can be seen that the header fields include: the set name, number, data size ratio (%), data size, average object size, index number, index size, and storage data size, where the data size and the storage data size are completely the same, and to explain the difference between them, it is necessary to refer to fig. 6, which shows a data file structure of a montogdb database based on the statistical method of the montogdb database, where one montogdb database includes multiple sets Collection, and fig. 6 shows only the data file structure of one set of a certain database, so as to achieve the purpose of brief description.
In the aggregated data file, it can be seen that the data file is composed of two different extensions parts, montogb organizes the stored data of BSON document and B-tree index into a logical container "extension", and a file may have multiple extension parts, each extension only contains one aggregated data or index, for example, in fig. 6, extension 1 is an index file, extension 2 is a data file, and the same aggregated data or index may be distributed in multiple extensions. The several extensions can also be distributed in multiple files, and the same extension has no data and no index.
In each extension, there are multiple records, each of which contains a header and the mongoDB's BSON document, and some extra Padding space, as shown in FIG. 6. The Padding space is that MongoDB additionally allocates some unused space when inserting records, so that the document does not need to be migrated to other places when becoming larger in the future. The recording head starts with the size of the entire recording, including the position of the recording itself and the positions of the previous recording and the next recording. Thus, different data sizes are recorded.
The data size (dataSize) is a parameter closest to the real data size, and this parameter can be used to check how much data is. This size includes the sum of each record of the database (or collection). Note that each record has the overhead of a header and Padding in addition to the BSON document. The actual size will be slightly larger than the real data footprint.
When a document is deleted, this parameter becomes smaller because it is the sum of the sizes of all documents. If your document is not deleted, only the fields inside the document are deleted or reduced, there is no impact on the data size. The reason is because the document is still recorded and the whole record occupies no change, but the unused space in the record is increased.
Store size (storageSize) this parameter is equal to the sum of all used data extensions of the database or some collection. Note that this number will be larger than the data because there will be some fragmentation left in the extension after deleting the document, i.e. the deleted part shown in fig. 6.
The file size (fileSize) parameter is only valid on the database and refers to the size of the file used in the actual file system. It includes the sum of all data extensions, the sum of index extensions, and some unallocated space.
Referring to the last rows of the generated statistics table of FIG. 5, it can be seen that a single database occupies already more than 20G and a single set exceeds 5G, in which case separate optimization processes are performed for these table.
In addition, the psutil is a cross-platform library which can easily acquire information of a process of system operation and system utilization rate (including CPU, memory, disk, network and the like). The system is mainly used for system monitoring, performance analysis and process management. It implements the functions provided by equivalent command line tools, such as ps, top, lsof, netstat, ifconfig, who, df, kill, free, nice, ionice, iostat, iotop, uptime, pidef, tty, taskset, pmap, etc. Currently, 32-bit and 64-bit operating systems such as Linux, windows, OS X, freeBSD, and Sun Solaris are supported.
Referring to the fourth embodiment statistical table of the statistical method based on the MongoDB database proposed in the present application shown in fig. 7, it can be seen that the table is sorted in descending order according to the file size ratio of each set, and the statistical method proposed in the present application can support the ascending or descending order arrangement and display of any statistical field, for example, the fifth embodiment statistical table of the statistical method based on the MongoDB database proposed in the present application shown in fig. 8 is arranged in ascending order by using the stored data size ratio. In addition, the table also supports line-by-line display and display in different units.
Referring to the fifth embodiment of the statistical pie chart of the statistical method based on the MongoDB database proposed by the present application shown in fig. 9, the statistical method proposed by the present application can also support pie chart output, and automatically output the set with too small a proportion on the sub-chart.
Referring to fig. 10, a frame diagram of a statistical device based on the MongoDB database proposed in the present application includes the following modules:
the system comprises a definition module, a database collection module and a management module, wherein the definition module is used for defining an IP address, a port number, a user name, a password and a database collection name to be counted of one or more servers and/or databases to be accessed through an instruction;
the access module is used for connecting the client with the remote server through an IP address, a port number, a user name and a password and accessing a database in one or more servers;
the acquisition module is used for acquiring all database names of the databases in one or more servers, traversing all databases to obtain attribute relation data of the database set containing all database set names to be counted under each database, accumulating the corresponding relation data of the database sets with the same database set to obtain corresponding relation data of the database sets, and storing the corresponding relation data in the storage device; the corresponding relation comprises at least one of the following items, data volume, file size ratio, data size ratio, storage size ratio, average object size, index number and index space size;
and the display module is used for displaying the corresponding relation data of the database set.
Further, since the server generally involves the problem of access security, the client needs to introduce an authentication means when accessing the server to ensure the security of data in the server. Thus, the access module may also include the following sub-modules:
the request module is used for sending an access request to the server and/or the database by the client by using a communication method;
the judging module is used for receiving an access request sent by the client by the server and/or the database and judging whether the access request contains authorization information, if not, sending unauthorized information with first authentication data generated by the server and/or the database to the client, and if so, allowing the client to access the server and/or the database;
the authentication module is used for receiving unauthorized information sent from the server and/or the database by the client, extracting first authentication data, generating second authentication data by adopting a first algorithm and the first authentication data, a server and/or database user name and a server and/or database password, and sending the second authentication data to the server and/or the database;
and the authorization module is used for generating third authentication data by adopting the first algorithm and the first authentication data after the server and/or the database receives the second authentication data sent by the client, judging whether the third authentication data is consistent with the second authentication data or not, if so, allowing the client to access the server and/or the database, and if not, refusing the access request.
Specifically, in the above apparatus, the first authentication data is random data generated by a server and/or a database.
Further, in the above apparatus, the communication method includes at least one of: a wired communication method and a wireless communication method.
Further, in the above apparatus, the wireless communication method includes at least one of: 2G,3G,4G,5G and Wi-Fi.
Further, the obtaining module further comprises the following sub-modules:
and the sorting module is used for appointing one of the corresponding relations and sorting the corresponding relation data of the database set according to the appointed corresponding relation in an ascending or descending method.
Specifically, in the above modules, the specified manner includes at least one of the following manners, system default and manual setting.
Further, the obtaining module further comprises the following sub-modules:
and the line-dividing display module is used for judging whether the data contained in the corresponding relation can be completely displayed in one line or not, and if not, displaying in lines.
Finally, the invention proposes a computer-readable storage medium having stored thereon computer instructions for executing the method described above.
It will be understood that, although the terms first, second, third, etc. may be used herein to describe various elements, these elements should not be limited by these terms. These terms are only used to distinguish one element of the same type from another. For example, a first element could be termed a second element, and, similarly, a second element could be termed a first element, without departing from the scope of the present application. The word "if" as used herein may be interpreted as "at … …" or "at … …" depending on the context.
It should be recognized that embodiments of the present invention can be realized and implemented by computer hardware, a combination of hardware and software, or by computer instructions stored in a non-transitory computer readable memory. The methods may be implemented in a computer program using standard programming techniques, including a non-transitory computer-readable storage medium configured with the computer program, where the storage medium so configured causes a computer to operate in a specific and predefined manner, according to the methods and figures described in the detailed description. Each program may be implemented in a high level procedural or object oriented programming language to communicate with a computer system. However, the program(s) can be implemented in assembly or machine language, if desired. In any case, the language may be a compiled or interpreted language. Furthermore, the program can be run on a programmed application specific integrated circuit for this purpose.
Further, the method may be implemented in any type of computing platform operatively connected to a suitable interface, including but not limited to a personal computer, mini computer, mainframe, workstation, networked or distributed computing environment, separate or integrated computer platform, or in communication with a charged particle tool or other imaging device, and the like. Aspects of the invention may be implemented in machine-readable code stored on a non-transitory storage medium or device, whether removable or integrated onto a computing platform, such as a hard disk, optically read and/or write storage media, RAM, ROM, etc., so that it is readable by a programmable computer, which when read by the computer can be used to configure and operate the computer to perform the procedures described herein. Further, the machine-readable code, or portions thereof, may be transmitted over a wired or wireless network. The invention described herein includes these and other different types of non-transitory computer-readable storage media when such media include instructions or programs that implement the steps described above in conjunction with a microprocessor or other data processor. The invention also includes the computer itself when programmed according to the methods and techniques described herein.
Embodiments of this disclosure are described herein, including the best mode known to the inventors for carrying out the invention. Variations of those described embodiments may become apparent to those of ordinary skill in the art upon reading the foregoing description. The inventors expect skilled artisans to employ such variations as appropriate, and the inventors intend for the embodiments of the disclosure to be practiced otherwise than as specifically described herein. Accordingly, the scope of the present disclosure includes all modifications and equivalents of the subject matter recited in the claims appended hereto as permitted by applicable law. Moreover, the scope of the present disclosure encompasses any combination of the above-described elements in all possible variations thereof unless otherwise indicated herein or otherwise clearly contradicted by context.
While the present invention has been described in considerable detail and with particular reference to a few illustrative embodiments thereof, it is not intended to be limited to any such details or embodiments or any particular embodiments, but it is to be construed as effectively covering the intended scope of the invention by providing a broad, potential interpretation of such claims in view of the prior art with reference to the appended claims. Furthermore, the foregoing describes the invention in terms of embodiments foreseen by the inventor for which an enabling description was available, notwithstanding that insubstantial modifications of the invention, not presently foreseen, may nonetheless represent equivalent modifications thereto.
The specification and drawings are, accordingly, to be regarded in an illustrative sense rather than a restrictive sense. However, it will be apparent that: various modifications and changes may be made thereto without departing from the broader spirit and scope of the application as set forth in the claims.
Other variations are within the spirit of the present application. Accordingly, while the disclosed technology is susceptible to various modifications and alternative constructions, certain embodiments thereof have been shown in the drawings and have been described above in detail. It should be understood, however, that there is no intention to limit the application to the specific form or forms disclosed; on the contrary, the intention is to cover all modifications, alternative constructions, and equivalents falling within the spirit and scope of the application, as defined in the appended claims.

Claims (10)

1. A statistical method based on a MongoDB database is characterized by comprising the following steps:
s100) defining IP addresses, port numbers, user names, passwords and database set names to be counted of one or more servers and/or databases to be accessed through instructions;
s200) the client is connected with a remote server through an IP address, a port number, a user name and a password and accesses a database in one or more servers;
s300) acquiring all database names of the databases in one or more servers, traversing all databases to obtain attribute relation data of the database sets containing all database set names to be counted under each database, accumulating the corresponding relation data of the database sets with the same database sets to obtain corresponding relation data of the database sets, and storing the corresponding relation data in a storage device;
s400) displaying corresponding relation data of the database set;
wherein the correspondence comprises at least one of: data volume, file size ratio, data size ratio, storage size ratio, average object size, number of indexes, and index space size.
2. The method according to claim 1, wherein step S200 further comprises the sub-steps of:
s201) the client sends an access request to a server and/or a database by using a communication method;
s202) the server and/or the database receives an access request sent by the client and judges whether the access request contains authorization information, if not, the server and/or the database sends unauthorized information with first authentication data generated by the server and/or the database to the client, and if so, the client is allowed to access the server and/or the database;
s203) the client receives unauthorized information sent by the server and/or the database, extracts the first authentication data, generates second authentication data by adopting a first algorithm and the first authentication data, a user name of the server and/or the database and a password of the server and/or the database, and sends the second authentication data to the server and/or the database;
s204) after the server and/or the database receives the second authentication data sent from the client, third authentication data are generated by adopting the first algorithm and the first authentication data, the server and/or the database user name and the server and/or the database password, whether the third authentication data are consistent with the second authentication data or not is judged, if yes, the client is allowed to access the server and/or the database, and if not, the access request is refused.
3. The method of claim 2, wherein the first algorithm is a message digest algorithm.
4. The method of claim 3, wherein the message digest algorithm is at least one of the following: MD algorithm, SHA algorithm, and MAC algorithm.
5. The method according to claim 2, wherein the first authentication data is random data generated by a server and/or a database, and the second authentication data and the third authentication data are authentication data generated using the first authentication data.
6. The method of claim 2, wherein the communication method comprises at least one of: a wired communication method and a wireless communication method.
7. The method of claim 6, wherein the wireless communication method comprises at least one of: 2G,3G,4G,5G and Wi-Fi.
8. The method according to claim 1, wherein step S300 further comprises the sub-steps of:
and appointing one of the corresponding relations, and sorting the corresponding relation data of the database set according to an ascending method or a descending method according to the appointed corresponding relation.
9. A statistical device based on a MongoDB database is characterized by comprising the following modules:
the definition module is used for defining the IP address, the port number, the user name, the password and the name of the database set to be counted of one or more servers and/or databases to be accessed through instructions;
the access module is used for connecting the client with the remote server through the IP address, the port number, the user name and the password and accessing the database in one or more servers;
the acquisition module is used for acquiring all database names of the databases in one or more servers, traversing all databases to obtain attribute relation data of the database sets containing all database set names to be counted under each database, accumulating the corresponding relation data of the database sets with the same database sets to obtain corresponding relation data of the database sets, and storing the corresponding relation data in the storage device; the corresponding relation comprises at least one of the following items, namely data volume, file size ratio, data size ratio, storage size ratio, average object size, index number and index space size;
and the display module is used for displaying the corresponding relation data of the database set.
10. A computer-readable storage medium having stored thereon computer instructions for performing the method of any of claims 1-8.
CN201910047905.7A 2019-01-18 2019-01-18 Statistical method based on MongoDB database Active CN109992488B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910047905.7A CN109992488B (en) 2019-01-18 2019-01-18 Statistical method based on MongoDB database

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910047905.7A CN109992488B (en) 2019-01-18 2019-01-18 Statistical method based on MongoDB database

Publications (2)

Publication Number Publication Date
CN109992488A CN109992488A (en) 2019-07-09
CN109992488B true CN109992488B (en) 2023-01-03

Family

ID=67130061

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910047905.7A Active CN109992488B (en) 2019-01-18 2019-01-18 Statistical method based on MongoDB database

Country Status (1)

Country Link
CN (1) CN109992488B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111274085A (en) * 2020-01-14 2020-06-12 中科驭数(北京)科技有限公司 Database monitoring system and method
CN112395293B (en) * 2020-11-27 2024-03-01 浙江诺诺网络科技有限公司 Database and table dividing method, database and table dividing device, database and table dividing equipment and storage medium
CN117033484A (en) * 2023-08-10 2023-11-10 哈尔滨电气科学技术有限公司 Data real-time integration method based on stream processing task and timing task

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101005505A (en) * 2006-01-20 2007-07-25 国际商业机器公司 Systems and methods for communication with database client users
CN103678442A (en) * 2012-08-30 2014-03-26 国际商业机器公司 Method and system of database table format conversion based on user data access patterns
CN104657491A (en) * 2015-03-06 2015-05-27 成都维远艾珏信息技术有限公司 Method for transmitting data to client
CN105550333A (en) * 2015-12-22 2016-05-04 歌尔声学股份有限公司 MongoDB-based test data storage query method and system
CN108573029A (en) * 2018-03-20 2018-09-25 咪咕文化科技有限公司 Method, device and storage medium for acquiring network access relation data

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10713280B2 (en) * 2010-12-23 2020-07-14 Mongodb, Inc. Systems and methods for managing distributed database deployments

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101005505A (en) * 2006-01-20 2007-07-25 国际商业机器公司 Systems and methods for communication with database client users
CN103678442A (en) * 2012-08-30 2014-03-26 国际商业机器公司 Method and system of database table format conversion based on user data access patterns
CN104657491A (en) * 2015-03-06 2015-05-27 成都维远艾珏信息技术有限公司 Method for transmitting data to client
CN105550333A (en) * 2015-12-22 2016-05-04 歌尔声学股份有限公司 MongoDB-based test data storage query method and system
CN108573029A (en) * 2018-03-20 2018-09-25 咪咕文化科技有限公司 Method, device and storage medium for acquiring network access relation data

Also Published As

Publication number Publication date
CN109992488A (en) 2019-07-09

Similar Documents

Publication Publication Date Title
CN114398427B (en) System and method for improving search capabilities of privately encrypted data
CN109992488B (en) Statistical method based on MongoDB database
US10541983B1 (en) Secure storage and searching of information maintained on search systems
US8555362B2 (en) Lightweight directory access protocol (LDAP) proxy
JP5711840B1 (en) Kernel program, method and apparatus incorporating relational database
US7278021B2 (en) Information processing device, information processing system, authentication method, storage medium and program
US9781109B2 (en) Method, terminal device, and network device for improving information security
EP3547202A1 (en) Method and system for access to anonymised data
US9898618B1 (en) Securing a remote database
EP3211825A1 (en) Trusted terminal verification method and apparatus
US8087071B2 (en) Authentication method and system
US20120011165A1 (en) Methods of encapsulating information in records from two or more disparate databases
CN112511599B (en) Civil air defense data sharing system and method based on block chain
WO2020233012A1 (en) Distributed smart api asynchronous callback method, device, client terminal, service terminal, and storage medium
CN113010904A (en) Data processing method and device and electronic equipment
CN113590719A (en) Data synchronization method, device, equipment and storage medium
CN114547209A (en) Data sharing interaction method and system based on block chain
CN114756887A (en) Method and device for encrypting and storing sensitive information block in file
CN110263008B (en) Terminal off-line log management system, method, device and storage medium
JP4594078B2 (en) Personal information management system and personal information management program
US20170235924A1 (en) System and Network for Controlling Content and Accessibility
CN106650359A (en) System and method for collecting object information and matching information
CN115270189A (en) Data reading method, device and equipment based on identity authority and storage medium
CN113360568A (en) Method and system for shielding alliance link data and computer readable storage medium
CN114389842A (en) SSL VPN-based data security transmission channel establishment method and device

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
CB02 Change of applicant information
CB02 Change of applicant information

Address after: 519000 Room 102, 202, 302 and 402, No. 325, Qiandao Ring Road, Tangjiawan Town, high tech Zone, Zhuhai City, Guangdong Province, Room 102 and 202, No. 327 and Room 302, No. 329

Applicant after: Zhuhai Jinshan Digital Network Technology Co.,Ltd.

Applicant after: Zhuhai Xishanju Digital Technology Co.,Ltd.

Address before: Building 3, Jinshan Software Park, 325 Qiandao Ring Road, Tangjiawan Town, high tech Zone, Zhuhai, Guangdong 519000

Applicant before: ZHUHAI KINGSOFT ONLINE GAME TECHNOLOGY Co.,Ltd.

Applicant before: ZHUHAI SEASUN MOBILE GAME TECHNOLOGY Co.,Ltd.

GR01 Patent grant
GR01 Patent grant