文档章节

yum安装Mongodb-server

王孟君
 王孟君
发布于 2017/02/15 09:32
字数 1411
阅读 929
收藏 0

本文记录一下在CentOS 6.7上,yum安装Mongodb-server

安装Mongodb-server

使用yum install mongodb-server命令安装mongodb server~~~

[root@dev18 ~]# yum install mongodb-server
Loaded plugins: fastestmirror, security
Setting up Install Process
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package mongodb-server.x86_64 0:2.4.14-4.el6 will be installed
--> Processing Dependency: v8 for package: mongodb-server-2.4.14-4.el6.x86_64
--> Processing Dependency: libv8.so.3()(64bit) for package: mongodb-server-2.4.14-4.el6.x86_64
--> Processing Dependency: libtcmalloc.so.4()(64bit) for package: mongodb-server-2.4.14-4.el6.x86_64
--> Processing Dependency: libboost_thread-mt.so.5()(64bit) for package: mongodb-server-2.4.14-4.el6.x86_64
--> Processing Dependency: libboost_system-mt.so.5()(64bit) for package: mongodb-server-2.4.14-4.el6.x86_64
--> Processing Dependency: libboost_program_options-mt.so.5()(64bit) for package: mongodb-server-2.4.14-4.el6.x86_64
--> Processing Dependency: libboost_iostreams-mt.so.5()(64bit) for package: mongodb-server-2.4.14-4.el6.x86_64
--> Processing Dependency: libboost_filesystem-mt.so.5()(64bit) for package: mongodb-server-2.4.14-4.el6.x86_64
--> Running transaction check
---> Package boost-filesystem.x86_64 0:1.41.0-27.el6 will be installed
---> Package boost-iostreams.x86_64 0:1.41.0-27.el6 will be installed
---> Package boost-program-options.x86_64 0:1.41.0-27.el6 will be installed
---> Package boost-system.x86_64 0:1.41.0-27.el6 will be installed
---> Package boost-thread.x86_64 0:1.41.0-27.el6 will be installed
---> Package gperftools-libs.x86_64 0:2.0-11.el6.3 will be installed
--> Processing Dependency: libunwind.so.8()(64bit) for package: gperftools-libs-2.0-11.el6.3.x86_64
---> Package v8.x86_64 1:3.14.5.10-25.el6 will be installed
--> Processing Dependency: libicuuc.so.42()(64bit) for package: 1:v8-3.14.5.10-25.el6.x86_64
--> Processing Dependency: libicui18n.so.42()(64bit) for package: 1:v8-3.14.5.10-25.el6.x86_64
--> Processing Dependency: libicudata.so.42()(64bit) for package: 1:v8-3.14.5.10-25.el6.x86_64
--> Running transaction check
---> Package libicu.x86_64 0:4.2.1-12.el6 will be installed
---> Package libunwind.x86_64 0:1.1-3.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

===========================================================================================================================
 Package                              Arch                  Version                              Repository           Size
===========================================================================================================================
Installing:
 mongodb-server                       x86_64                2.4.14-4.el6                         epel                5.1 M
Installing for dependencies:
 boost-filesystem                     x86_64                1.41.0-27.el6                        ISO                  47 k
 boost-iostreams                      x86_64                1.41.0-27.el6                        ISO                  39 k
 boost-program-options                x86_64                1.41.0-27.el6                        ISO                 108 k
 boost-system                         x86_64                1.41.0-27.el6                        ISO                  26 k
 boost-thread                         x86_64                1.41.0-27.el6                        ISO                  43 k
 gperftools-libs                      x86_64                2.0-11.el6.3                         epel                246 k
 libicu                               x86_64                4.2.1-12.el6                         ISO                 4.9 M
 libunwind                            x86_64                1.1-3.el6                            epel                 55 k
 v8                                   x86_64                1:3.14.5.10-25.el6                   epel                3.0 M

Transaction Summary
===========================================================================================================================
Install      10 Package(s)

Total download size: 14 M
Installed size: 46 M
Is this ok [y/N]: y

输入y

Is this ok [y/N]: y
Downloading Packages:
(1/10): gperftools-libs-2.0-11.el6.3.x86_64.rpm                                                     | 246 kB     00:00     
(2/10): libunwind-1.1-3.el6.x86_64.rpm                                                              |  55 kB     00:00     
(3/10): mongodb-server-2.4.14-4.el6.x86_64.rpm                                                      | 5.1 MB     00:00     
(4/10): v8-3.14.5.10-25.el6.x86_64.rpm                                                              | 3.0 MB     00:00     
(5/10): boost-iostreams-1.41.0-27.el6.x86_64.rpm                                                    |  39 kB     00:00     
(6/10): boost-filesystem-1.41.0-27.el6.x86_64.rpm                                                   |  47 kB     00:00     
(7/10): boost-thread-1.41.0-27.el6.x86_64.rpm                                                       |  43 kB     00:00     
(8/10): boost-program-options-1.41.0-27.el6.x86_64.rpm                                              | 108 kB     00:00     
(9/10): boost-system-1.41.0-27.el6.x86_64.rpm                                                       |  26 kB     00:00     
(10/10): libicu-4.2.1-12.el6.x86_64.rpm                                                             | 4.9 MB     00:00     
---------------------------------------------------------------------------------------------------------------------------
Total                                                                                      4.8 MB/s |  14 MB     00:02     
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : boost-system-1.41.0-27.el6.x86_64                                                                      1/10 
  Installing : boost-filesystem-1.41.0-27.el6.x86_64                                                                  2/10 
  Installing : libicu-4.2.1-12.el6.x86_64                                                                             3/10 
  Installing : 1:v8-3.14.5.10-25.el6.x86_64                                                                           4/10 
  Installing : boost-program-options-1.41.0-27.el6.x86_64                                                             5/10 
  Installing : boost-thread-1.41.0-27.el6.x86_64                                                                      6/10 
  Installing : boost-iostreams-1.41.0-27.el6.x86_64                                                                   7/10 
  Installing : libunwind-1.1-3.el6.x86_64                                                                             8/10 
  Installing : gperftools-libs-2.0-11.el6.3.x86_64                                                                    9/10 
  Installing : mongodb-server-2.4.14-4.el6.x86_64                                                                    10/10 
  Verifying  : mongodb-server-2.4.14-4.el6.x86_64                                                                     1/10 
  Verifying  : gperftools-libs-2.0-11.el6.3.x86_64                                                                    2/10 
  Verifying  : libunwind-1.1-3.el6.x86_64                                                                             3/10 
  Verifying  : 1:v8-3.14.5.10-25.el6.x86_64                                                                           4/10 
  Verifying  : boost-iostreams-1.41.0-27.el6.x86_64                                                                   5/10 
  Verifying  : boost-filesystem-1.41.0-27.el6.x86_64                                                                  6/10 
  Verifying  : boost-thread-1.41.0-27.el6.x86_64                                                                      7/10 
  Verifying  : boost-program-options-1.41.0-27.el6.x86_64                                                             8/10 
  Verifying  : boost-system-1.41.0-27.el6.x86_64                                                                      9/10 
  Verifying  : libicu-4.2.1-12.el6.x86_64                                                                            10/10 

Installed:
  mongodb-server.x86_64 0:2.4.14-4.el6                                                                                     

Dependency Installed:
  boost-filesystem.x86_64 0:1.41.0-27.el6                         boost-iostreams.x86_64 0:1.41.0-27.el6                   
  boost-program-options.x86_64 0:1.41.0-27.el6                    boost-system.x86_64 0:1.41.0-27.el6                      
  boost-thread.x86_64 0:1.41.0-27.el6                             gperftools-libs.x86_64 0:2.0-11.el6.3                    
  libicu.x86_64 0:4.2.1-12.el6                                    libunwind.x86_64 0:1.1-3.el6                             
  v8.x86_64 1:3.14.5.10-25.el6                                   

Complete!

可以看到安装Complete!

启动mongodb-server

使用service mongod start命令来启动mongo-server。

[root@dev18 ~]# service mongod start
Starting mongod:                                           [  OK  ]
[root@dev18 ~]# 

验证MongoDB是否成功启动

我们可以检查日志内容来看,MongoDB是否成功启动~~

日志文件路径/var/log/mongodb/mongod.log,如果可以看到类似如下的结果:

[initandlisten] waiting for connections on port <port>

则表明MongoDB已经成功启动。

Wed Feb 15 08:16:08.784 [initandlisten] MongoDB starting : pid=4782 port=27017 dbpath=/var/lib/mongodb 64-bit host=dev18.gzhl.zhhl
Wed Feb 15 08:16:08.784 [initandlisten] db version v2.4.14
Wed Feb 15 08:16:08.784 [initandlisten] git version: nogitversion
Wed Feb 15 08:16:08.784 [initandlisten] build info: Linux buildvm-11.phx2.fedoraproject.org 4.7.2-201.fc24.x86_64 #1 SMP Fri Aug 26 15:58:40 UTC 2016 x86_64 BOOST_LIB_VERSION=1_41
Wed Feb 15 08:16:08.784 [initandlisten] allocator: tcmalloc
Wed Feb 15 08:16:08.784 [initandlisten] options: { bind_ip: "127.0.0.1", command: [ "run" ], config: "/etc/mongodb.conf", dbpath: "/var/lib/mongodb", fork: "true", journal: "true", logpath: "/var/log/mongodb/mongodb.log", nohttpinterface: "true", pidfilepath: "/var/run/mongodb/mongodb.pid", port: 27017, quiet: true }
Wed Feb 15 08:16:08.787 [initandlisten] journal dir=/var/lib/mongodb/journal
Wed Feb 15 08:16:08.787 [initandlisten] recover : no journal files present, no recovery needed
Wed Feb 15 08:16:08.863 [initandlisten] allocating new ns file /var/lib/mongodb/local.ns, filling with zeroes...
Wed Feb 15 08:16:08.909 [FileAllocator] allocating new datafile /var/lib/mongodb/local.0, filling with zeroes...
Wed Feb 15 08:16:08.909 [FileAllocator] creating directory /var/lib/mongodb/_tmp
Wed Feb 15 08:16:08.912 [FileAllocator] done allocating datafile /var/lib/mongodb/local.0, size: 64MB,  took 0 secs
Wed Feb 15 08:16:08.913 [initandlisten] waiting for connections on port 27017

通过上述的日志文件内容,我们可以知道MongoDB已经成功启动~~

GUI工具连接MongoDB

本文采用mongobooster可视化工具来连接MongoDB,输入相关的ip地址,localhost改成MongoDB安装的机器ip即可。

遇到连接Mongo服务失败的错误信息。

遇到如上信息是因为mongodb的配置文件中bind_ip的默认ip地址为127.0.0.1,而我的客户端和mongo服务器不是同一台机器,最终导致失败~~

可以通过vim /etc/mongodb.conf命令来打开配置文件查看。

为了方便测试,我们先注释掉bind_ip。不过在实际使用中,为了安全性,不应该注释掉这个配置项~~~

注释掉bind_ip之后,我们可以重启服务~~

[root@dev18 usr]# service mongod stop
Stopping mongod:                                           [  OK  ]
[root@dev18 usr]# service mongod start
Starting mongod:                                           [  OK  ]
[root@dev18 usr]# 

重新连接,连接成功~~~

 

 

 

© 著作权归作者所有

共有 人打赏支持
王孟君

王孟君

粉丝 223
博文 94
码字总数 221044
作品 0
杭州
高级程序员
私信 提问
使用yum安装MongoDB及服务器端配置

安装MongoDB的方法有很多种,可以源代码安装,在CentOS也可以用yum源安装的方法。由于MongoDB更新得比较快,我比较喜欢用yum源安装的方法。64位Centos下的安装步骤如下: 1、准备工作 运行y...

SunnyWu
2014/11/06
0
0
centos 安装mongodb

1.配置MongoDB的yum源 创建yum源文件: vim /etc/yum.repos.d/mongodb-org-3.4.repo 添加以下内容: [mongodb-org-3.4] name=MongoDB Repository baseurl=https://repo.mongodb.org/yum/red......

littlemesieV
09/21
0
0
centos7安装MongoDB3.4

centos7安装MongoDB3.4 简介 MongoDB 是一个介于关系数据库和非关系数据库之间的产品,是非关系数据库当中功能最丰富,最像关系数据库的。他支持的数据结构非常松散,是类似json的bson格式,...

linjin200
12/05
0
0
CentOS 6 nodejs mongodb 安装

wget http://nodejs.org/dist/v0.8.7/node-v0.8.7.tar.gz (稳定版) //wget http://nodejs.org/dist/v0.10.22/node-v0.10.22.tar.gz (最新版) 2、解压 tar -xvf node-v0.10.22-linux-x64.t......

千山万水
2015/05/06
0
0
CentOS7下使用yum安装Mongodb3.4

1.创建mongodb3.4的yum源文件 在yum源文件目录中创建mongodb-org-3.4.repo 写入仓库文件 2.验证yum源文件是否有效 查看mongodb所需安装文件 3.安装mongodb所需包 MongoDB提供的官方安装文件包...

hengbao5
08/07
0
0

没有更多内容

加载失败,请刷新页面

加载更多

EOS docker开发环境

使用eos docker镜像是部署本地EOS开发环境的最轻松愉快的方法。使用官方提供的eos docker镜像,你可以快速建立一个eos开发环境,可以迅速启动开发节点和钱包服务器、创建账户、编写智能合约....

汇智网教程
28分钟前
0
0
《唐史原来超有趣》的读后感优秀范文3700字

《唐史原来超有趣》的读后感优秀范文3700字: 作者:花若离。我今天分享的内容《唐史原来超有趣》这本书的读后感,我将这本书看了一遍之后就束之高阁了,不过里面的内容一直在在脑海中回放,...

原创小博客
53分钟前
5
0
IC-CAD Methodology知识图谱

CAD (Computer Aided Design),计算机辅助设计,指利用计算机及其图形设备帮助设计人员进行设计工作,这个定义同样可以用来近似描述IC公司CAD工程师这个岗位的工作。 早期IC公司的CAD岗位最初...

李艳青1987
今天
6
0
CompletableFuture get方法一直阻塞或抛出TimeoutException

问题描述 最近刚刚上线的服务突然抛出大量的TimeoutException,查询后发现是使用了CompletableFuture,并且在执行future.get(5, TimeUnit.SECONDS);时抛出了TimeoutException异常,导致接口响...

xiaolyuh
今天
5
0
dubbo 搭建与使用

官网:http://dubbo.apache.org/en-us/ 一,安装监控中心(可以不安装) admin管理控制台,monitor监控中心 下载 bubbo ops 这个是新版的,需要node.js环境,我没有就用老版的了...

小兵胖胖
今天
6
0

没有更多内容

加载失败,请刷新页面

加载更多

返回顶部
顶部