Adhesive Q & A-Mongodb Data Service

Source: Internet
Author: User

Q: What is the use of Mongodb data service?

A: First, Mongodb is suitable for storing A large amount of non-business data. Therefore, the Adhesive framework advocates that non-very important non-business data (such as logs, exceptions, and status data in the Application Information Center, for example, the WCF call data of the WCF extension module, or various other business logs and monitoring logs are stored in Mongodb. Although the unstructured mode of Mongodb is suitable for storing various types of data, we have to repeat the development of various types of data to solve some problems:

1) a large amount of data is often requested to be asynchronously submitted by the backend queue, and the server and database must be tolerated for a short period of time unavailable. Therefore, a set of client and server dual-queue needs to be developed.

2) When saving data to the database, you need to consider the sub-tables and sub-databases. After saving the data, you need to consider the creation of indexes and the deletion of historical data.

3) The most important thing is that data is not saved. We also need to develop a set of backend for different data, involving permissions and various browsing methods.

In the past, we had to develop every business for a short period of one week and a long period of one month, develop a client to collect data, develop a server to submit data, and then develop a background program.

Now, the Mongodb Data Service is responsible for all this. To save custom data to Mongodb through the Mongodb data service, you only need

1) It takes about 10 minutes to involve custom classes and apply some features to the attributes to tell the Mongodb data service how to save and present the data.

2) It takes about 5 minutes to Configure permissions, clients, and servers.

3) It takes 10 seconds to call a row of statements to store data.

No matter what program logs or business logs, you can view data in various ways in the background of the Mongdb data service in less than 20 minutes.

 

Q: What are the highlights of Mongodb data service?

A: In addition to the above description, it can save development time. Other highlights are as follows:

1) You can perform simple configuration to complete relatively complex composite queries, for example, to implement a search of the type:

You only need to define metadata:

[Export dbpersistenceitem (export dbindexoption = export dbindexoption. ascending)] [MongodbPresentationItem (DisplayName = "borrower", ShowInTableView = true, MongodbFilterOption = MongodbFilterOption. textBoxFilter)] public string UserName {get; set;} [MongodbPersistenceItem (MongodbIndexOption = MongodbIndexOption. ascending)] [MongodbPresentationItem (DisplayName = "state change", ShowInTableView = true, MongodbFilterOption = MongodbFilterOption. dropDownListFilter)] public Status {get; set;} [MongodbPersistenceItem (MongodbIndexOption = MongodbIndexOption. ascending)] [MongodbPresentationItem (DisplayName = "", ShowInTableView = true, MongodbFilterOption = MongodbFilterOption. checkBoxListFilter)] public string Category {get; set ;}

For example, we want to record an operation log:

Metadata is defined as follows:

[Export dbpersistenceitem (ColumnName = "A", export dbindexoption = export dbindexoption. ascending)] [MongodbPresentationItem (DisplayName = "behavior", ShowInTableView = true, MongodbFilterOption = MongodbFilterOption. dropDownListFilter)] public string Action {get; set;} [MongodbPersistenceItem (ColumnName = "C", MongodbIndexOption = MongodbIndexOption. ascending)] [MongodbPresentationItem (DisplayName = "category", ShowInTableView = true, MongodbCascadeFilterOption = MongodbCascadeFilterOption. levelOne)] public string CategoryName {get; set;} [MongodbPersistenceItem (ColumnName = "D", MongodbIndexOption = MongodbIndexOption. ascending)] [MongodbPresentationItem (DisplayName = "Database", ShowInTableView = true, MongodbCascadeFilterOption = MongodbCascadeFilterOption. levelTwo)] public string DatabaseName {get; set;} [MongodbPersistenceItem (ColumnName = "TN", MongodbIndexOption = MongodbIndexOption. ascending)] [MongodbPresentationItem (DisplayName = "", ShowInTableView = true, MongodbCascadeFilterOption = MongodbCascadeFilterOption. levelThree)] public string TableName {get; set ;}

We can see that these search controls are displayed in the background and the content is also filled. Due to performance considerations, the Distinct data is not completed through the Distinct function of Mongodb, but is collected when the data is inserted and regularly synchronized to the metabase table in Mongodb in two directions:

2) rich query methods:

List:

Data Volume statistics:

Group statistics:

Details:

Whether you want to view the list, data volume statistics, data group statistics, or detailed data, you are not allowed to develop a line of code.

3) The system processes the sub-tables, sub-databases, expired data, indexes, caches, queues, and so on...

 

Q: Where is the application scope of Mongodb data service?

A: Generally, Mongodb is suitable for storing non-business data. Because the Mongodb data service module uses A dual queue between the client and the server, even if the data volume is large, it will not affect normal business operations, however, data may be lost when the service is unavailable and the queue is full. Therefore, it is suitable for storing program logs, business logs, operation logs, monitoring data, exception information, and feedback information. Note that all logs of the application information center module of the Adhesive framework and the WCF distributed service module are saved using the Mongodb data service.

 

Q: How do I customize objects and use Mongodb data services?

A: see article http://www.cnblogs.com/lovecindywang/archive/2011/10/28/2227808.html

 

Q: What if the metadata configured on the custom object is changed?

A: On the client side, each type of metadata will be submitted to the server with the first data and only once. Therefore, if you change the metadata, the system must be restarted. After the system is started, the new metadata will be saved to the database. From the server side, the metadata will not be retrieved from the database every time, it is only synchronized once during maintenance. The default maintenance time is 1 minute. Therefore, you can see the effect in the background one minute after the metadata is modified.

1) if a column is deleted, the metadata of the column will be lost, and the column may not be seen in the background, but the old data will not be lost.

2) If the metadata of the column is added, the value of the related column may be null for the old data, and a new column will only appear in the new data.

3) If you want to modify the metadata of an existing column, you cannot modify the ColumnName of MongodbPersistenceItem, that is, the column name in the database. Otherwise, the old data will not be displayed.

 

Q: What is the structure of Mongodb data service?

A: The Mongodb Data Service writes data as follows: insert data to the client queue-retrieve data from the client queue extract metadata for data restructuring-submit data to the server Queue-server Queue retrieve data through the WCF distributed service module for Index Update -The server Queue submits data to the database.

The process for Mongodb data service to read data is as follows: use the WCF distributed service module to connect to the server to read data-the server extracts actual data from the database-the server obtains metadata from the memory-the server merges actual data and metadata and returns the result to the client.

The Mongodb Data Service server has a very important maintenance service. Its work is as follows:

1) synchronize metadata

2) synchronize the index data of a column (such as the content of the advanced data filtering drop-down box and multiple selection box)

3) Clear historical data (if the Expiration days are set)

4) obtain the actual status of the database server, database, table, and index from the database.

5) Create an index

 

Q: What should I pay attention to when configuring the Mongodb data service?

A: Note:

1) configure data items in the configuration service after the new custom type. Otherwise, data cannot be submitted to the server or to the database.

2) define the characteristics of columns to note conflicts and constraints. Try

3) Clear and modify the default parameters (such as the number of batch submissions and the maximum number of data records) to improve performance.

 

Q: How do I configure Mongodb FOR THE Mongodb data service?

A: We can configure different Server clusters for each type, so we can achieve convenient resizing to A certain extent:

Taking into account the pressure shared, the system supports read (background query) write (submit data and maintain) Separation by default, so you can configure the MASTER-SALVE Mongodb

It should be noted that in theory, no table scan is performed for all operations performed in the background, and no related search control is displayed if the index is not created, therefore, you can configure Mongodb to not allow table scanning:

 

Q: Can I use an old Mongodb cluster for Mongodb data service?

A: Yes. The Mongodb Data Service uses the Metadata database to know which databases are their own. Other databases are not managed, and cannot be seen in the background.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.