神奇工具
我是不是省略了mingodb的安装部署?嗯,是的,因为我有现成的环境,哈哈!
这里介绍一下第三方工具的使用,让你的操作更方便哦!
MongoDB的客户端工具–nosqlbooster,下载地址:
https://nosqlbooster.com/downloads
为什么要用客户端工具?当然是为了方便啦!哈哈
连接
我的mongodb是没有带认证的,所以上面的配置完全满足连接需求,相应的,我的配置文件如下:
查看配置
cat /etc/mongod.conf
配置如下:
# mongod.conf
# for documentation of all options, see:
# http://docs.mongodb.org/manual/reference/configuration-options/
# where to write logging data.
systemLog:
destination: file
logAppend: true
path: /var/log/mongodb/mongod.log
# Where and how to store data.
storage:
dbPath: /var/lib/mongo
journal:
enabled: true
# engine:
# wiredTiger:
# how the process runs
processManagement:
fork: true # fork and run in background
pidFilePath: /var/run/mongodb/mongod.pid # location of pidfile
timeZoneInfo: /usr/share/zoneinfo
# network interfaces
net:
port: 27017
bindIp: 0.0.0.0 # Enter 0.0.0.0,:: to bind to all IPv4 and IPv6 addresses or, alternatively, use the net.bindIpAll setting.
#security:
#operationProfiling:
#replication:
#sharding:
## Enterprise-Only Options
#auditLog:
#snmp:
如上,采取的是默认配置,只是修改了bindIp,使得他支持外部IP连接。
重启mongodb,使得配置生效:
systemctl restart mongod
使用
如此一來,就可以在客戶端擼代碼了。