前言: 场景,linux shell环境,仅安装mongo.sh客户端,连接远程数据库,验证可访问性。(centos为例)

1. 获取shell 二进制文件

wget https://repo.mongodb.org/yum/redhat/7/mongodb-org/4.0/x86_64/RPMS/mongodb-org-shell-4.0.5-1.el7.x86_64.rpm

2. 安装shell客户端

rpm -ivh mongodb-org-shell-4.0.5-1.el7.x86_64.rpm

3.连接

mongo admin --username user1  --host 192.168.99.100 --port 27017 --password

其中 admin 值得是认证数据库。