0

I have installed mongodb in one of our environments & this has been done using MongoDb Operations Manager. Though i have my PATH variable set correctly i'm unable to connect mongo shell with my user account but able to connect as a sudo. could someone help me if i'm missing anything here.

Details:

[user01@west.company.com@rhel01 /]$ echo $PATH
> /var/lib/mongodb-mms-automation/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/nfs/home/user01/.local/bin:/nfs/home/user01/bin 
[user01@west.company.com@rhel01 /]$ mongo
> -bash: mongo: command not found

[user01@west.company.com@rhel01 /]$ sudo -i 
[sudo] password for user01@west.company.com: 
[root@rhel01 ~]# echo $PATH
> /var/lib/mongodb-mms-automation/bin:/usr/local/sbin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin 
[root@rhel01 ~]# mongo 
> MongoDB shell
> version: 3.2.10 connecting to: test 
> MongoDB Enterprise MYMONGOREPLSET01:PRIMARY>

Which Mongo Output:

[user01@west.company.com@rhel01 /]$ which mongo
/usr/bin/which: no mongo in (/var/lib/mongodb-mms-automation/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/nfs/home/user01/.local/bin:/nfs/home/user01/bin)

[root@rhel01 ~]# which mongo
/var/lib/mongodb-mms-automation/bin/mongo

Observation:

i just noticed the bin location is set like this ...

[root@rhel01 mongodb-mms-automation]# pwd
/var/lib/mongodb-mms-automation
[root@rhel01 mongodb-mms-automation]# ls -la
total 32
drwxr-xr-x   3 mongod mongod  4096 Mar 30 13:58 .
drwxr-xr-x. 57 root   root    4096 Apr  1 03:23 ..
lrwxrwxrwx   1 mongod mongod    67 Nov  4 13:45 bin -> /var/lib/mongodb-mms-automation/mongodb-linux-x86_64-3.2.10-ent/bin
-rw-------   1 mongod mongod  1024 Mar 27 15:07 keyfile
-rw-------   1 mongod mongod 10686 Mar 30 13:58 mms-cluster-config-backup.json
drwxr-x---   4 mongod mongod  4096 Nov  4 13:45 mongodb-linux-x86_64-3.2.10-ent
4

2 回答 2

1

尝试这个

sudo chmod -R 777 /var/lib/mongodb-mms-automation/mongodb-linux-x86_64-3.2.10-ent/bin/
于 2017-04-02T05:38:30.323 回答
0

将此添加到路径 /var/lib/mongodb-mms-automation/mongodb-linux-x86_64-3.2.10-ent/bin

于 2017-04-01T19:56:33.413 回答