热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

CentOS6系统使用yum方式安装配置mongodb服务器

安装MongoDB的方法有很多种,可以源代码安装,在Centos也可以用yum源安装的方法。由于MongoDB更新得比较快,我比较喜欢用yum源安装的方法。64位Centos下的安装步骤如下:1、准备工作运行yum命令查看MongoDB的包信息[root@server110.com~]#yuminfomongo
安装MongoDB的方法有很多种,可以源代码安装,在Centos也可以用yum源安装的方法。由于MongoDB更新得比较快,我比较喜欢用yum源安装的方法。
64位Centos下的安装步骤如下:

1、准备工作
运行yum命令查看MongoDB的包信息 
[root@server110.com~]# yum info mongo-10gen
(提示没有相关匹配的信息,) 说明你的centos系统中的yum源不包含MongoDB的相关资源,所以要在使用yum命令安装MongoDB前需要增加yum源,也就是在 /etc/yum.repos.d/目录中增加 *.repo yum源配置文件

2、vi /etc/yum.repos.d/10gen.repo,输入下面的语句:
[10gen] 
name=10gen Repository 
baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/x86_64 
gpgcheck=0 
做好yum源的配置后,如果配置正确执行下面的命令便可以查询MongoDB相关的信息: 
查看mongoDB的服务器包的信息
[root@server110.com geffzhang]# yum info mongo-10gen-server
 * base: centos.ustc.edu.cn
 * extras: centos.ustc.edu.cn
 * updates: centos.ustc.edu.cn
Installed Packages
Name        : mongo-10gen-server
Arch        : x86_64
Version     : 2.0.6
Release     : mongodb_1
Size        : 13 M
Repo        : installed
From repo   : 10gen
Summary     : mongo server, sharding server, and support scripts
URL         : http://www.mongodb.org
License     : AGPL 3.0
Description : Mongo (from "huMONGOus") is a schema-free document-oriented
: database.
:
: This package provides the mongo server software, mongo sharding
: server softwware, default configuration files, and init.d scripts.

查看客户端安装情况
[root@server110.com geffzhang]#  
* base: centos.ustc.edu.cn
 * extras: centos.ustc.edu.cn
 * updates: centos.ustc.edu.cn
Installed Packages
Name        : mongo-10gen
Arch        : x86_64
Version     : 2.0.6
Release     : mongodb_1
Size        : 69 M
Repo        : installed
From repo   : 10gen
Summary     : mongo client shell and tools
URL         : http://www.mongodb.org
License     : AGPL 3.0
Description : Mongo (from "huMONGOus") is a schema-free document-oriented
: database. It features dynamic profileable queries, full indexing,
: replication and fail-over support, efficient storage of large
: binary data objects, and auto-sharding.
:
: This package provides the mongo shell, import/export tools, and
: other client utilities.

3、安装MongoDB的服务器端和客户端工具 
[root@server110.com geffzhang]#  yum install mongo-10gen-server
[root@server110.com geffzhang]#  yum install mongo-10gen

4、启动Mongodb
service mongod start
以后有更新了,停掉mongodb,执行yum update mongo-10gen mongo-10gen-server 即可。

5、服务器配置: /etc/mongod.conf
# mongo.conf   
#where to log   
logpath=/var/log/mongo/mongod.log   
logappend=true #以追加方式写入日志   
# fork and run in background   
fork = true  
#port = 27017 #端口   
dbpath=/var/lib/mongo #数据库文件保存位置   
directoryperdb=true
# Enables periodic logging of CPU utilization and I/O wait   
#启用定期记录CPU利用率和 I/O 等待   
#cpu = true  
# Turn on/off security.  Off is currently the default  
# 是否以安全认证方式运行,默认是不认证的非安全方式   
#noauth = true  
#auth = true  
# Verbose logging output.   
# 详细记录输出   
#verbose = true  
# Inspect all client data for validity on receipt (useful for  
# developing drivers)用于开发驱动程序时的检查客户端接收数据的有效性   
#objcheck = true  
# Enable db quota management 启用数据库配额管理,默认每个db可以有8个文件,可以用quotaFiles参数设置   
#quota = true  
# 设置oplog记录等级   
# Set oplogging level where n is   
#   0=off (default)   
#   1=W   
#   2=R   
#   3=both   
#   7=W+some reads   
#oplog = 0  
# Diagnostic/debugging option 动态调试项   
#nocursors = true  
# Ignore query hints 忽略查询提示   
#nohints = true  
# 禁用http界面,默认为server110.com:28017  
# Disable the HTTP interface (Defaults to server110.com:27018).这个端口号写的是错的   
#nohttpinterface = true  
# 关闭服务器端脚本,这将极大的限制功能   
# Turns off server-side scripting.  This will result in greatly limited   
# functionality   
#noscripting = true  
# 关闭扫描表,任何查询将会是扫描失败   
# Turns off table scans.  Any query that would do a table scan fails.   
#notablescan = true  
# 关闭数据文件预分配   
# Disable data file preallocation.   
#noprealloc = true  
# 为新数据库指定.ns文件的大小,单位:MB   
# Specify .ns file size for new databases.   
# nssize =   
# Accout token for Mongo monitoring server.   
#mms-token =   
# mongo监控服务器的名称   
# Server name for Mongo monitoring server.   
#mms-name =   
# mongo监控服务器的ping 间隔   
# Ping interval for Mongo monitoring server.   
#mms-interval =   
# Replication Options 复制选项   
# in replicated mongo databases, specify here whether this is a slave or master 在复制中,指定当前是从属关系   
#slave = true  
#source = master.example.com   
# Slave only: specify a single database to replicate   
#Only= master.example.com   
# or   
#master = true  
#source = slave.example.com  


推荐阅读
  • Docker的安全基准
    nsitionalENhttp:www.w3.orgTRxhtml1DTDxhtml1-transitional.dtd ... [详细]
  • 本文介绍如何在现有网络中部署基于Linux系统的透明防火墙(网桥模式),以实现灵活的时间段控制、流量限制等功能。通过详细的步骤和配置说明,确保内部网络的安全性和稳定性。 ... [详细]
  • 如何配置Unturned服务器及其消息设置
    本文详细介绍了Unturned服务器的配置方法和消息设置技巧,帮助用户了解并优化服务器管理。同时,提供了关于云服务资源操作记录、远程登录设置以及文件传输的相关补充信息。 ... [详细]
  • 360SRC安全应急响应:从漏洞提交到修复的全过程
    本文详细介绍了360SRC平台处理一起关键安全事件的过程,涵盖从漏洞提交、验证、排查到最终修复的各个环节。通过这一案例,展示了360在安全应急响应方面的专业能力和严谨态度。 ... [详细]
  • 解决MongoDB Compass远程连接问题
    本文记录了在使用阿里云服务器部署MongoDB后,通过MongoDB Compass进行远程连接时遇到的问题及解决方案。详细介绍了从防火墙配置到安全组设置的各个步骤,帮助读者顺利解决问题。 ... [详细]
  • 在现代网络环境中,两台计算机之间的文件传输需求日益增长。传统的FTP和SSH方式虽然有效,但其配置复杂、步骤繁琐,难以满足快速且安全的传输需求。本文将介绍一种基于Go语言开发的新一代文件传输工具——Croc,它不仅简化了操作流程,还提供了强大的加密和跨平台支持。 ... [详细]
  • 阿里云ecs怎么配置php环境,阿里云ecs配置选择 ... [详细]
  • 优化Flask应用的并发处理:解决Mysql连接过多问题
    本文探讨了在Flask应用中通过优化后端架构来应对高并发请求,特别是针对Mysql 'too many connections' 错误的解决方案。我们将介绍如何利用Redis缓存、Gunicorn多进程和Celery异步任务队列来提升系统的性能和稳定性。 ... [详细]
  • 优化ListView性能
    本文深入探讨了如何通过多种技术手段优化ListView的性能,包括视图复用、ViewHolder模式、分批加载数据、图片优化及内存管理等。这些方法能够显著提升应用的响应速度和用户体验。 ... [详细]
  • Valve 发布 Steam Deck 的新版 Windows 驱动程序
    Valve 最新发布了针对 Steam Deck 掌机的 Windows 驱动程序,旨在提升其在 Windows 环境下的兼容性、安全性和性能表现。 ... [详细]
  • This guide provides a comprehensive step-by-step approach to successfully installing the MongoDB PHP driver on XAMPP for macOS, ensuring a smooth and efficient setup process. ... [详细]
  • 基于KVM的SRIOV直通配置及性能测试
    SRIOV介绍、VF直通配置,以及包转发率性能测试小慢哥的原创文章,欢迎转载目录?1.SRIOV介绍?2.环境说明?3.开启SRIOV?4.生成VF?5.VF ... [详细]
  • 本文详细介绍了如何通过RPM包在Linux系统(如CentOS)上安装MySQL 5.6。涵盖了检查现有安装、下载和安装RPM包、配置MySQL以及设置远程访问和开机自启动等步骤。 ... [详细]
  • Nginx 反向代理与负载均衡实验
    本实验旨在通过配置 Nginx 实现反向代理和负载均衡,确保从北京本地代理服务器访问上海的 Web 服务器时,能够依次显示红、黄、绿三种颜色页面以验证负载均衡效果。 ... [详细]
  • 离线安装Grafana Cloudera Manager插件并监控CDH集群
    本文详细介绍如何离线安装Cloudera Manager (CM) 插件,并通过Grafana监控CDH集群的健康状况和资源使用情况。该插件利用CM提供的API接口进行数据获取和展示。 ... [详细]
author-avatar
心只为你跳国
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有