the transactions in the key set are executed on the leading node. Therefore, G-Store transactions do not need to execute the distributed commit protocol during transaction execution. The key here is that G-Store still must execute distributed collaboration, but the collaboration process is completed before the transaction is executed-before the transaction isolation needs to be considered. Once the collaboration process is completed, the transaction will be completed soon, and concurrent transa
built-in permissions. You can also define roles and permissions by yourself. You need to assign permissions based on your business needs:
Description of built-in roles (generally, built-in roles can basically meet the needs of the production environment ):
Https://docs.mongodb.org/manual/core/security-built-in-roles/
Description of user-defined roles:
Https://docs.mongodb.org/manual/core/security-user-defined-roles/
User Management Configuration description
Https://docs.mongodb.org/manual/refer
", "tags": ["mongodb", "database", "NoSQL"], "likes ": 100}>
We can also define the data as a variable, as shown below:
> Document = ({title: 'mongodb ', description: 'mongodb is a Nosql database', by: 'cainiao ', url: 'http: // www.runoob.com ', tags: ['mongodb ', 'database', 'nosql'], likes: 100 });
The result is as follows:
{"Title": "MongoDB tutorial", "description": "MongoDB is a Nosql Database", "by": "cainiao tutorial", "url": "http://www.runoob.com ", "tags": ["mongodb", "database", "No
/mongod
-- Dbpath/data/db
-- Fork
-- Port 27017
-- Logpath =/usr/local/mongodb/log/mongodb. log
-- Logappend
Add/Etc/rc. localMedium.
For more MongoDB tutorials, see the following:
CentOS compilation and installation of php extensions for MongoDB and mongoDB
CentOS 6 install MongoDB and server configuration using yum
Install MongoDB2.4.3 in Ubuntu 13.04
MongoDB beginners must read (both concepts and practices)
MongoDB Installation Guide for Ubunu
update is successful.
W = n
Add the {w: n} driver to the getLastError command. It is applied to safe = true.
WtimeoutMS = MS
Driver add {wtimeout: MS} To getlasterror command. Applied to safe = true.
Fsync = true | false
True: add the {fsync: true} driver to the getlasterror command. It is applied to safe = true.
False: the driver is not added to the getLastError command.
Journal = true | false
If this parameter is set to true
to the master server1.1 use testDb. user. insert ({_ id: 1, name: "maybo "})
1.2 open the slave service client./Mongo -- port 12351.3 QueryUse testDb. user. find ("{})It is found that slaveOk = false the current node needs to specify the slave Node1.4 rs. slaveOk ()Show collectionsIt indicates that the master-slave replication is successful, but the master-slave replication takes one time.
For more MongoDB tutorials, see the following:
CentOS compilation and installation of php extensions for M
}}).pretty()
where likes > 50
Greater than or equal
{
db.col.find({"likes":{$gte:50}}).pretty()
where likes >= 50
Not equal
{
db.col.find({"likes":{$ne:50}}).pretty()
where likes != 50
Mongodb AND condition: the find () method of mongodb can input multiple keys. Each key is separated by a comma. The syntax format is as follows:
Db. col. find ({key1: value1, key2: value2}). pretty ()
Example: db. mycol. find ({'name': 'tes1', 'sex': 'formale '}). prett
information.
4. Add shard
Use admin
Db. runCommand ({addshard: "localhost: 55555 "})
Db. runCommand ({addshard: "localhost: 55556 "})
Db. runCommand ({addshard: "localhost: 55557 "})
Db. runCommand ({enablesharding: "test"}) // The database test has the sharding capability.
Db. runCommand ({shardcollection: "test. log ", key: {id: 1, time: 1}) // specify the partitions used by the table corresponding to the database in the document. in test, the log table is sharded Based on the id and time.
. loglogappend = truefork = trueslave = true # slave database source = 172.16.225.111: 27017 # master database IP address and port dbpath =/data0/mongodbpidfilepath =/var/run/mongodb/mongod. pidbind_ip = 172.16.59.20.auth = true
4. The Master/Slave server starts the mongodb service.
/etc/init.d/mongod start
For more MongoDB tutorials, see the following:
CentOS compilation and installation of php extensions for MongoDB and mongoDB
CentOS 6 install MongoDB and server configuration using yum
Insta
backup, such as test2.
-- Directoryperdb:The location where the backup data is located, for example, c: \ data \ dump \ test. Why should I add another test instead of dump during Backup? Check the prompt for yourself!
-- Drop:When restoring, delete the current data first, and then restore the backup data. That is to say, after the restoration, all the data added and modified after the backup will be deleted. Use it with caution!
Run the following command:
>mongorestore
The output result is a
log fileLogappend = true # whether to continue writing under the same Log FileFork = true # whether to create a background daemonPort = 27017 # Listening to the client portPidfilepath =/var/run/mongodb/mongod. pid # The file that stores the pid of the mongod ProcessBind_ip = 192.168.12.179 # access restriction. Only this address can be accessed by a client. If you want to access it from another machine, comment out
In addition, several configurations are required to build a replica Set cluster:
followed by the Set Name col, which can be changed by yourself. This is equivalent to the table name, which will be automatically created if it does not exist.
Db. col. insert ({title: 'mongodb tutorial ', description: 'mongodb is a Nosql database', tags: ['mongodb', 'database', 'nosql '], likes: 100 })
If you want to find these documents, you can use the find method of the corresponding set.
Db. col. find () or display more direct db. col. find (). pretty ()
For more MongoDB tutorials, see the
.
When you enter the mongoDB background, it will be linked to the test document (database) by default ):
$ cd /usr/local/mongodb/bin$ ./mongoMongoDB shell version:3.0.6connecting to: testWelcome to the MongoDB shell.……
Because it is a JavaScript shell, you can run some simple arithmetic operations:
>2+24>3+69
Now let's insert some simple data and search the inserted data:
> db.runoob.insert({x:10})WriteResult({"nInserted":1})> db.runoob.find(){"_id":ObjectId("5604ff74a274a611b0c990aa"),"x":10}>
process and switch to the admin database for configuration.Configure shard cluster
Step 5: Activate database and set shardingCreate a database and set, and activate it as needed.Example: test. testActivate database and set shards
So far, mongodb (mongodb, mongos, config server) based on centos7 has been deployed. Although it is difficult, it is still a bit of a sense of accomplishment!
For more MongoDB tutorials, see the following:
CentOS compilation and installation of php extensions for Mongo
the document and the field order in the document.
For more MongoDB tutorials, see the following:
CentOS compilation and installation of php extensions for MongoDB and mongoDB
CentOS 6 install MongoDB and server configuration using yum
Install MongoDB2.4.3 in Ubuntu 13.04
MongoDB beginners must read (both concepts and practices)
MongoDB Installation Guide for Ubunu 14.04
MongoDB authoritative Guide (The Definitive Guide) in English [PDF]
Nagios monito
. printShardingStatus ()
Print Server Information:Db. serverStatus ()
Create a table index:Db. resume_meta_data.ensureIndex ({"org_name": 1 },{ "background": true })
View table indexes:Db. resume_meta_data.getIndexes ()
Print the information here.
Sort out common MongoDB operation commands
MongoDB 3.0 official version released and downloaded
CentOS compilation and installation of MongoDB
CentOS compilation and installation of php extensions for MongoDB and mongoDB
CentOS 6 install MongoDB and se
installation of MongoDB
CentOS compilation and installation of php extensions for MongoDB and mongoDB
CentOS 6 install MongoDB and server configuration using yum
Install MongoDB2.4.3 in Ubuntu 13.04
MongoDB beginners must read (both concepts and practices)
MongoDB Installation Guide for Ubunu 14.04
MongoDB authoritative Guide (The Definitive Guide) in English [PDF]
Nagios monitoring MongoDB sharded cluster service practice
Build MongoDB Service Based
> Db. runCommand ({addshard: "shardtwo. mongodb. local: 27018", name: "shardtwo "})> Db. runCommand ({addshard: "shardthree. mongodb. local: 27018", name: "shardthree "})
Partition servers should resolve domain names as much as possible to avoid future Server IP address changes
4. Start sharding and add a partition key to the database.> Db. runCommand ({"enablesharding": "mc_visit "})> Db. runCommand ({"shardcollection": "mc_visit.mc_visit", "key": {"visitdate":-1, "virus": 1 }})
5. Modify the p
.3. MongoDB is not violent, just because I don't understand it.
CentOS compilation and installation of MongoDB
CentOS compilation and installation of php extensions for MongoDB and mongoDB
CentOS 6 install MongoDB and server configuration using yum
Install MongoDB2.4.3 in Ubuntu 13.04
MongoDB beginners must read (both concepts and practices)
MongoDB Installation Guide for Ubunu 14.04
MongoDB authoritative Guide (The Definitive Guide) in English [PDF]
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.