未找到或未安装Mongo shell

时间:2015-09-08 15:07:11

标签: mongodb installation

未找到或未安装Mongo shell

我使用

安装了mongodb
sudo yum install -y mongodb-org

安装成功,我完成了所需的RHEL端口配置,并启动了mongod服务。

[root@host mongodb]# service mongod status
mongod (pid 1761) is running...

但是,当我查找mongo shell时,我无法使用'locate'命令找到它:

locate mongo
/etc/yum.repos.d/mongodb-org-3.0.repo
/usr/share/vim/vim72/keymap/mongolian_utf-8.vim
/var/mongodb

根据mongo文档,这是你启动shell的方法: 要启动mongo shell并使用默认端口连接到在localhost上运行的MongoDB实例:

  1. 转到:cd
  2. 键入./bin/mongo以启动mongo:./ bin / mongo
  3. 问题

    1. {mongodb installation dir}是什么? / var / mongodb没有任何内容
    2. 安装mongo shell有什么问题吗?安装以下内容。
    3. sudo yum install -y mongodb-org

                  Loaded plugins: fastestmirror, refresh-packagekit, security
                  Determining fastest mirrors
                   * base: centos.bhs.mirrors.ovh.net
                   * extras: centos.bhs.mirrors.ovh.net
                   * updates: centos.bhs.mirrors.ovh.net
                  base                                                                                                           | 3.7 kB     00:00
                  base/primary_db                                                                                                | 4.6 MB     00:02
                  extras                                                                                                         | 3.4 kB     00:00
                  extras/primary_db                                                                                              |  27 kB     00:00
                  mongodb-org-3.0                                                                                                |  951 B     00:00
                  mongodb-org-3.0/primary                                                                                        | 8.6 kB     00:00
                  mongodb-org-3.0                                                                                                                 45/45
                  updates                                                                                                        | 3.4 kB     00:00
                  updates/primary_db                                                                                             | 1.3 MB     00:00
                  Setting up Install Process
                  Resolving Dependencies
                  --> Running transaction check
                  ---> Package mongodb-org.x86_64 0:3.0.6-1.el6 will be installed
                  --> Processing Dependency: mongodb-org-shell = 3.0.6 for package: mongodb-org-3.0.6-1.el6.x86_64
                  --> Processing Dependency: mongodb-org-tools = 3.0.6 for package: mongodb-org-3.0.6-1.el6.x86_64
                  --> Processing Dependency: mongodb-org-server = 3.0.6 for package: mongodb-org-3.0.6-1.el6.x86_64
                  --> Processing Dependency: mongodb-org-mongos = 3.0.6 for package: mongodb-org-3.0.6-1.el6.x86_64
                  --> Running transaction check
                  ---> Package mongodb-org-mongos.x86_64 0:3.0.6-1.el6 will be installed
                  ---> Package mongodb-org-server.x86_64 0:3.0.6-1.el6 will be installed
                  ---> Package mongodb-org-shell.x86_64 0:3.0.6-1.el6 will be installed
                  ---> Package mongodb-org-tools.x86_64 0:3.0.6-1.el6 will be installed
                  --> Finished Dependency Resolution
      
                  Dependencies Resolved
      
                  ======================================================================================================================================
                   Package                              Arch                     Version                        Repository                         Size
                  ======================================================================================================================================
                  Installing:
                   mongodb-org                          x86_64                   3.0.6-1.el6                    mongodb-org-3.0                   4.6 k
                  Installing for dependencies:
                   mongodb-org-mongos                   x86_64                   3.0.6-1.el6                    mongodb-org-3.0                   3.9 M
                   mongodb-org-server                   x86_64                   3.0.6-1.el6                    mongodb-org-3.0                   8.3 M
                   mongodb-org-shell                    x86_64                   3.0.6-1.el6                    mongodb-org-3.0                   4.1 M
                   mongodb-org-tools                    x86_64                   3.0.6-1.el6                    mongodb-org-3.0                    31 M
      
                  Transaction Summary
                  ======================================================================================================================================
                  Install       5 Package(s)
      
                  Total download size: 48 M
                  Installed size: 149 M
                  Downloading Packages:
                  (1/5): mongodb-org-3.0.6-1.el6.x86_64.rpm                                                                      | 4.6 kB     00:00
                  (2/5): mongodb-org-mongos-3.0.6-1.el6.x86_64.rpm                                                               | 3.9 MB     00:03
                  (3/5): mongodb-org-server-3.0.6-1.el6.x86_64.rpm                                                               | 8.3 MB     00:04
                  (4/5): mongodb-org-shell-3.0.6-1.el6.x86_64.rpm                                                                | 4.1 MB     00:04
                  (5/5): mongodb-org-tools-3.0.6-1.el6.x86_64.rpm                                                                |  31 MB     00:05
                  --------------------------------------------------------------------------------------------------------------------------------------
                  Total                                                                                                 2.4 MB/s |  48 MB     00:20
                  Running rpm_check_debug
                  Running Transaction Test
                  Transaction Test Succeeded
                  Running Transaction
                    Installing : mongodb-org-server-3.0.6-1.el6.x86_64                                                                              1/5
                    Installing : mongodb-org-shell-3.0.6-1.el6.x86_64                                                                               2/5
                    Installing : mongodb-org-mongos-3.0.6-1.el6.x86_64                                                                              3/5
                    Installing : mongodb-org-tools-3.0.6-1.el6.x86_64                                                                               4/5
                    Installing : mongodb-org-3.0.6-1.el6.x86_64                                                                                     5/5
                    Verifying  : mongodb-org-tools-3.0.6-1.el6.x86_64                                                                               1/5
                    Verifying  : mongodb-org-mongos-3.0.6-1.el6.x86_64                                                                              2/5
                    Verifying  : mongodb-org-shell-3.0.6-1.el6.x86_64                                                                               3/5
                    Verifying  : mongodb-org-3.0.6-1.el6.x86_64                                                                                     4/5
                    Verifying  : mongodb-org-server-3.0.6-1.el6.x86_64                                                                              5/5
      
                  Installed:
                    mongodb-org.x86_64 0:3.0.6-1.el6
      
                  Dependency Installed:
                    mongodb-org-mongos.x86_64 0:3.0.6-1.el6     mongodb-org-server.x86_64 0:3.0.6-1.el6     mongodb-org-shell.x86_64 0:3.0.6-1.el6
                    mongodb-org-tools.x86_64 0:3.0.6-1.el6
      
      
                  Complete!
      

1 个答案:

答案 0 :(得分:0)

它是作为mongodb-org-shell软件包(已安装)的一部分安装的,以及您如何理解它:

[root@centos6 ~]# rpm -ql mongodb-org-shell-3.0.6-1
package mongodb-org-shell-3.0.6-1 is not installed
[root@centos6 ~]# rpm -ql mongodb-org-shell-3.0.6-1.el6
/usr/bin/mongo
/usr/share/man/man1/mongo.1
[root@centos6 ~]# ls -lah /usr/bin/mongo
-rwxr-xr-x. 1 root root 11M Aug 24 13:19 /usr/bin/mongo

所以,它在/usr/bin。如果您收到一条未找到的错误,我怀疑/usr/bin不在您的路径中(这会很奇怪),或者您有一些奇怪的权限问题。