Recently, the security team detected that some Aliyun users exist MongoDB database unauthorized access vulnerabilities, vulnerabilities serious, easy to lead to database leaks. In order to ensure your business and application of security, please the
Index: A special data structure that stores a small portion of the data in a table to enable quick queries
Advantages:
1, greatly reducing the amount of data the server needs to scan
2, the index can help the server avoid sorting or use temporary
The example of this article for everyone to share the Mongodb3.3 database for Gridfs additions and deletions, for your reference, the specific contents are as follows
The Program.cs code is as follows:
Internal class Program {private static
Principle:
1. First query the total number of records in the table
2. Random get Offset is 0~ total record number-1
3. Skip offset at query, and get 1 records
Because I test the environment PHP has upgraded to more than 7.0, MongoDB extended Use
Why do you want to slice1. Reduce the number of single machine requests, reduce the single load, improve the total load2. Reduce the storage space of single machine, improve the total memory space.
Common MongoDB sharding Server architecture
Using Gridfs file to MongoDB, return a Mongoid object, usually we need to save the $id value in this object in a string form to the database, as the identity of the file, then how does PHP take out the ID string value of the Mongoid object?
Find
Command-line query:
1, you can use. * To fuzzy query, the following is the query surname Chen user.
Db.customers.find ({name:/Chen */i});2, also can not carry * number
Db.fs.files.find ({filename:/install_mongo.sh/i})
PHP Query:
$query =array ("
Master/slave master-slave replicationmaster-slave replication MongoDB a common way, if you want to achieve a master-slave replication should have at least two MongoDB instance, one is responsible for the client request as the primary node, and the
MongoDB as a document database, support shard storage, scale-out, cluster automatic switch, the following summary configuration steps summarized as follows:Several important concepts:Database: Collection--record--cursor (tag ordinal at
InstallationDownload and install https://www.mongodb.com/on official websiteConfigurationMy Computer, right-click Properties, Advanced Program settings, environment variables in the list on the left Click Path Put your MongoDB file path in the
TODO:MONGODB MySQL Database backup1. MongoDB Using command BackupMongodump for the entire database backup, the main use of the command parameters:
-D database to back up
-O Output path
./mongodump–d Databasename–o/data/dbbak
Document Purposein the Install Mongodb application on Linux system and set basic security permissions to ensure database securityBasic KnowledgeMongoDB is based on a database for Distributed file storage . Written by the C + + language. Designed
First download the next MongoDB, the official website download, Https://www.mongodb.com/download-center?jmp=nav, according to their own system selection download,Then unzip: There will be this folder \mongodb\mongodb-src-r3.2.11\bin, the following
centos5.6 32bitPHP 5.2.17PHP Installation Path/usr/local/phpPhpize Path/usr/binPhp-config Path/usr/binPHP.ini Path/etc/1. First download the PHP mongodb extensionDownload the MongoDB extension source package from the
I. Index and its optimization
Overview of Indexes
The index of a database is like a directory in front of a book that speeds up data queries.
Appropriate places to increase the index, unreasonable place to delete suboptimal
Log on to MongoDB shell and switch to the admin databaseMongoUse adminCreate administrator userDb. createUser ( {User: "yourusername ",Pwd: "password ",Roles: [{role: "userAdminAnyDatabase", db: "admin"}] })Modify/etc/init. d/mongod and restart
Creating an index sometimes blocks new connections.When establishing a connection with the mongodb replica set, the driver first tries to connect and verify each non-hidden node in the cluster. If a node is in the "down" status, it will be skipped.
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.