mongo --help
[mongodb@bssdb01 ~]$mongo --version
MongoDB shell version v3.6.4
git version: d0181a711f7e7f39e60b5aeb1dc7097bf6ae5856
OpenSSL version: OpenSSL 1.0.1e-fips 11 Feb 2013
allocator: tcmalloc
modules: enterprise
build environment:
distmod: rhel70
distarch: x86_64
target_arch: x86_64
[mongodb@bssdb01 ~]$mongo
MongoDB shell version v3.6.4
connecting to: mongodb://127.0.0.1:27017
mongo 132.120.2.134:21000/mongos
mongo 132.120.2.134:21000
默认连test
show dbs;
"errmsg" : "not master and slaveOk=false",
secondary不允许读写。
https://www.cnblogs.com/heiing/archive/2012/08/04/2622953.html
MongoDB Enterprise config:SECONDARY> db.getName();
test
use test
db.getMongo()
db
db.createCollection('a')
"errmsg" : "not master",
# 用这个,其他是内部的,不用
mongo 132.120.2.134:20000
Error: couldn't add user: User "uop_ui@gduidb" already exists :
db.createCollection('a')
show collections;
db.getCollectionNames()
db.a.insert({name:'oy'});
WriteResult({ "nInserted" : 1 })
默认端口 27017
mongo入门
- https://www.cnblogs.com/clsn/p/8214194.html
MongoDB Enterprise mongos> db.a.find()
{ "_id" : ObjectId("5d4a884a60a2b8c3da437aa7"), "name" : "od" }
转载于:https://my.oschina.net/u/2464371/blog/3084968