Problem Description:
On the newly installed CentOS7, install the MongoDB3.4, mount a large data disk, modify the/etc/mongo.conf, put the log and data directory in the configuration file under the new data disk, and modify the file access rights.
the concept of a replica set
A replica set is a set of servers, one of which is the primary server (primary), used to process client requests, and multiple backup servers (secondary) to hold data replicas of the primary server. If the primary
Connect MONGO
$connection = new mongoclient (); Connect to localhost:27017
$connection = new mongoclient ( "mongodb://example.com" ); Connect to a remote server (using the default port: 27017)
$connection = new mongoclient ( "mongodb://
A new requirement was received in the previous two days to monitor the maximum number of MongoDB connections, memory usage, etc. in the Linux shell script.
But I do not understand the Linux Shel, just a few simple common Linux operations, as long as
Information about the MongoDB is now less, and most of the English web site, the above content mostly by the author translation from the official website, please translate or understand the wrong place please testify. After the author will continue
1. Review: The previous study of MongoDB's basic command learning
2. This article will learn to use the MongoDB C # drivers to implement add-delete and check
3. Preparation:
3.1 C # drivers support situation
In the face of the current learning,
Http://www.cnblogs.com/5ishare/p/5708863.html
Previously added to the MongoDB as a service, today mainly understand the database management, before the operation of the MongoDB service open.
A. Display Database list
You can use show DBS if you
Map/reduce in MongoDB makes some compound queries, because MongoDB does not support group by queries, and MapReduce is similar to SQL's group by, so it can be thought that MapReduce is the MongoDB version of group B Y
The command is as follows:
Before we know the Mongod start command to specify some parameters to start the service, this section we configure the configuration file configuration of these parameters load configuration.
./bin/mongod--config./conf/mongodb.conf (or./bin/mongod-f.
MongoDB Account Management (user name password settings) By default does not require the account password, in/etc/mongodb.conf set auth = True after restarting the account permission function. 1, create the admin Super Privilege: MONGO www.2cto.com
In a few simple steps, you can configure your MongoDB connection and then manipulate the data using Mongotemplate:
1, the introduction of dependency:
org.springframework.boot
Spring-boot-starter-data-mongodb
2. Configure connection
Dockerfile
#base images from
ubuntu:latest
maintainer yao.3.li@uconn.edu
#install mongodb
RUN apt-get Update
RUN apt-get-y Install Curl
Run Curl-o https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-3.0.6.tgz
run TAR-ZXVF mongodb-linux-x86_ 64-3.0
Data backup:
Open a command prompt and go to the installed MongoDB Bin directory:
The location is as follows:
Input command:mongodump-h 127.0.0.1:27017-d runoob-o D:\mongo\data\dump
which
-H:MONGDB the server address, for example: 127.0.0.1, you
In MongoDB, you can use the Db.collection.explain ("executionstats") statement to analyze query performance.
Create the table inventory in MongoDB and insert the test data, the initial data in addition to the ID field is not indexed.
{"_id": 1,
A warning appears when connecting to MONGO: MongoDB access control is not enabled for the database
In fact, this is the problem of MONGO permissions, we have a lower privilege when connecting mongo.exe, this warning can be ignored. You can also
Brief introductionMongoDB is a product between a relational database and a non-relational database, and is the most versatile and most like relational database in a non-relational database. The data structure he supports is very loose and is a
Error contentCom.mongodb.MongoTimeoutException:Timed out after 30000 MS and waiting for a server that matches Readpreferenceserverse Lector{readpreference=primary}. Client view of cluster state is {type=unknown, servers=[{address=127.0.0.1:27017,
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.