当前位置: 首页 > news >正文

邹城网站建设在线收录

邹城网站建设,在线收录,佛山网站建设推广,涉县移动网站建设文章目录 步骤 1:配置 MongoDB 官方源步骤 2:安装 MongoDB步骤 3:启动 MongoDB 服务步骤 4:验证安装步骤 5:可选配置注意事项 以下是在 CentOS 系统上直接安装 MongoDB 4.0.25 的详细步骤: 步骤 1&#x…

文章目录

      • 步骤 1:配置 MongoDB 官方源
      • 步骤 2:安装 MongoDB
      • 步骤 3:启动 MongoDB 服务
      • 步骤 4:验证安装
      • 步骤 5:可选配置
      • 注意事项

以下是在 CentOS 系统上直接安装 MongoDB 4.0.25 的详细步骤:


步骤 1:配置 MongoDB 官方源

  1. 使用文本编辑器创建 mongodb-org-4.0.repo 文件:

    sudo vi /etc/yum.repos.d/mongodb-org-4.0.repo
    
  2. 添加以下内容:

    [mongodb-org-4.0]
    name=MongoDB Repository
    baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/4.0/x86_64/
    gpgcheck=1
    enabled=1
    gpgkey=https://www.mongodb.org/static/pgp/server-4.0.asc
    
  3. 保存并退出文件。


步骤 2:安装 MongoDB

  1. 安装指定版本的 MongoDB:

    sudo yum install -y mongodb-org-4.0.25
    
    [root@localhost ~]# sudo yum install -y mongodb-org-4.0.25
    已加载插件:fastestmirror, langpacks
    base                                                                                                       | 3.6 kB  00:00:00     
    centos-sclo-rh                                                                                             | 3.0 kB  00:00:00     
    centos-sclo-sclo                                                                                           | 3.0 kB  00:00:00     
    docker-ce-stable                                                                                           | 3.5 kB  00:00:00     
    extras                                                                                                     | 2.9 kB  00:00:00     
    mongodb-org-4.0                                                                                            | 2.5 kB  00:00:00     
    Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=updates&infra=stock error was
    14: curl#6 - "Could not resolve host: mirrorlist.centos.org; 未知的错误"
    updates                                                                                                    | 2.9 kB  00:00:00     
    (1/3): docker-ce-stable/7/x86_64/primary_db                                                                | 152 kB  00:00:00     
    (2/3): mongodb-org-4.0/7/primary_db                                                                        | 118 kB  00:00:00     
    (3/3): updates/7/x86_64/primary_db                                                                         |  27 MB  00:00:13     
    Determining fastest mirrors* base: mirrors.nju.edu.cn* centos-sclo-rh: mirrors.nju.edu.cn* centos-sclo-sclo: mirrors.nju.edu.cn* extras: mirrors.nju.edu.cn* updates: mirrors.nju.edu.cn
    正在解决依赖关系
    --> 正在检查事务
    ---> 软件包 mongodb-org.x86_64.0.4.0.25-1.el7 将被 安装
    --> 正在处理依赖关系 mongodb-org-mongos = 4.0.25,它被软件包 mongodb-org-4.0.25-1.el7.x86_64 需要
    --> 正在处理依赖关系 mongodb-org-shell = 4.0.25,它被软件包 mongodb-org-4.0.25-1.el7.x86_64 需要
    --> 正在处理依赖关系 mongodb-org-tools = 4.0.25,它被软件包 mongodb-org-4.0.25-1.el7.x86_64 需要
    --> 正在处理依赖关系 mongodb-org-server = 4.0.25,它被软件包 mongodb-org-4.0.25-1.el7.x86_64 需要
    --> 正在检查事务
    ---> 软件包 mongodb-org-mongos.x86_64.0.4.0.25-1.el7 将被 安装
    ---> 软件包 mongodb-org-server.x86_64.0.4.0.25-1.el7 将被 安装
    ---> 软件包 mongodb-org-shell.x86_64.0.4.0.25-1.el7 将被 安装
    ---> 软件包 mongodb-org-tools.x86_64.0.4.0.25-1.el7 将被 安装
    --> 解决依赖关系完成依赖关系解决==================================================================================================================================Package                             架构                    版本                          源                                大小
    ==================================================================================================================================
    正在安装:mongodb-org                         x86_64                  4.0.25-1.el7                  mongodb-org-4.0                  6.2 k
    为依赖而安装:mongodb-org-mongos                  x86_64                  4.0.25-1.el7                  mongodb-org-4.0                  9.6 Mmongodb-org-server                  x86_64                  4.0.25-1.el7                  mongodb-org-4.0                   17 Mmongodb-org-shell                   x86_64                  4.0.25-1.el7                  mongodb-org-4.0                   10 Mmongodb-org-tools                   x86_64                  4.0.25-1.el7                  mongodb-org-4.0                   41 M事务概要
    ==================================================================================================================================
    安装  1 软件包 (+4 依赖软件包)总下载量:78 M
    安装大小:259 M
    Downloading packages:
    警告:/var/cache/yum/x86_64/7/mongodb-org-4.0/packages/mongodb-org-4.0.25-1.el7.x86_64.rpm: 头V3 RSA/SHA1 Signature, 密钥 ID e52529d4: NOKEY
    mongodb-org-4.0.25-1.el7.x86_64.rpm 的公钥尚未安装
    (1/5): mongodb-org-4.0.25-1.el7.x86_64.rpm                                                                 | 6.2 kB  00:00:00     
    (2/5): mongodb-org-mongos-4.0.25-1.el7.x86_64.rpm                                                          | 9.6 MB  00:00:10     
    (3/5): mongodb-org-server-4.0.25-1.el7.x86_64.rpm                                                          |  17 MB  00:00:15     
    (4/5): mongodb-org-shell-4.0.25-1.el7.x86_64.rpm                                                           |  10 MB  00:00:10     
    (5/5): mongodb-org-tools-4.0.25-1.el7.x86_64.rpm                                                           |  41 MB  00:00:23     
    ----------------------------------------------------------------------------------------------------------------------------------
    总计                                                                                              2.0 MB/s |  78 MB  00:00:39     
    从 https://www.mongodb.org/static/pgp/server-4.0.asc 检索密钥
    导入 GPG key 0xE52529D4:用户ID     : "MongoDB 4.0 Release Signing Key <packaging@mongodb.com>"指纹       : 9da3 1620 334b d75d 9dcb 49f3 6881 8c72 e525 29d4来自       : https://www.mongodb.org/static/pgp/server-4.0.asc
    Running transaction check
    Running transaction test
    Transaction test succeeded
    Running transaction正在安装    : mongodb-org-shell-4.0.25-1.el7.x86_64                                                                         1/5 正在安装    : mongodb-org-mongos-4.0.25-1.el7.x86_64                                                                        2/5 正在安装    : mongodb-org-tools-4.0.25-1.el7.x86_64                                                                         3/5 正在安装    : mongodb-org-server-4.0.25-1.el7.x86_64                                                                        4/5 
    Created symlink from /etc/systemd/system/multi-user.target.wants/mongod.service to /usr/lib/systemd/system/mongod.service.正在安装    : mongodb-org-4.0.25-1.el7.x86_64                                                                               5/5 验证中      : mongodb-org-4.0.25-1.el7.x86_64                                                                               1/5 验证中      : mongodb-org-server-4.0.25-1.el7.x86_64                                                                        2/5 验证中      : mongodb-org-tools-4.0.25-1.el7.x86_64                                                                         3/5 验证中      : mongodb-org-mongos-4.0.25-1.el7.x86_64                                                                        4/5 验证中      : mongodb-org-shell-4.0.25-1.el7.x86_64                                                                         5/5 已安装:mongodb-org.x86_64 0:4.0.25-1.el7                                                                                               作为依赖被安装:mongodb-org-mongos.x86_64 0:4.0.25-1.el7   mongodb-org-server.x86_64 0:4.0.25-1.el7   mongodb-org-shell.x86_64 0:4.0.25-1.el7  mongodb-org-tools.x86_64 0:4.0.25-1.el7   完毕!
    
  2. 确保所有组件(mongodb-org-servermongodb-org-shell 等)版本一致:

    sudo yum install -y mongodb-org-server-4.0.25 mongodb-org-shell-4.0.25 mongodb-org-mongos-4.0.25 mongodb-org-tools-4.0.25
    
    [root@localhost ~]# sudo yum install -y mongodb-org-server-4.0.25 mongodb-org-shell-4.0.25 mongodb-org-mongos-4.0.25 mongodb-org-tools-4.0.25
    已加载插件:fastestmirror, langpacks
    Loading mirror speeds from cached hostfile* base: mirrors.nju.edu.cn* centos-sclo-rh: mirrors.nju.edu.cn* centos-sclo-sclo: mirrors.nju.edu.cn* extras: mirrors.nju.edu.cn* updates: mirrors.nju.edu.cn
    软件包 mongodb-org-server-4.0.25-1.el7.x86_64 已安装并且是最新版本
    软件包 mongodb-org-shell-4.0.25-1.el7.x86_64 已安装并且是最新版本
    软件包 mongodb-org-mongos-4.0.25-1.el7.x86_64 已安装并且是最新版本
    软件包 mongodb-org-tools-4.0.25-1.el7.x86_64 已安装并且是最新版本
    无须任何处理
    

步骤 3:启动 MongoDB 服务

  1. 启动 MongoDB:

    sudo systemctl start mongod
    
  2. 设置开机自动启动:

    sudo systemctl enable mongod
    
  3. 检查 MongoDB 服务状态:

    sudo systemctl status mongod
    
    [root@localhost ~]# sudo systemctl status mongod
    ● mongod.service - MongoDB Database ServerLoaded: loaded (/usr/lib/systemd/system/mongod.service; enabled; vendor preset: disabled)Active: active (running) since 三 2024-11-20 16:05:27 CST; 29s agoDocs: https://docs.mongodb.org/manualProcess: 85819 ExecStart=/usr/bin/mongod $OPTIONS (code=exited, status=0/SUCCESS)Process: 85816 ExecStartPre=/usr/bin/chmod 0755 /var/run/mongodb (code=exited, status=0/SUCCESS)Process: 85813 ExecStartPre=/usr/bin/chown mongod:mongod /var/run/mongodb (code=exited, status=0/SUCCESS)Process: 85809 ExecStartPre=/usr/bin/mkdir -p /var/run/mongodb (code=exited, status=0/SUCCESS)Main PID: 85824 (mongod)Memory: 43.7MCGroup: /system.slice/mongod.service└─85824 /usr/bin/mongod -f /etc/mongod.conf1120 16:05:27 localhost.localdomain systemd[1]: Starting MongoDB Database Server...
    1120 16:05:27 localhost.localdomain mongod[85819]: about to fork child process, waiting until server is ready for connections.
    1120 16:05:27 localhost.localdomain mongod[85819]: forked process: 85824
    1120 16:05:27 localhost.localdomain mongod[85819]: child process started successfully, parent exiting
    1120 16:05:27 localhost.localdomain systemd[1]: Started MongoDB Database Server.
    

步骤 4:验证安装

  1. 使用 MongoDB 客户端连接:

    mongo
    
    [root@localhost ~]# mongo
    MongoDB shell version v4.0.25
    connecting to: mongodb://127.0.0.1:27017/?gssapiServiceName=mongodb
    Implicit session: session { "id" : UUID("47475de1-f2ee-4899-930f-4af70514c21a") }
    MongoDB server version: 4.0.25
    Welcome to the MongoDB shell.
    For interactive help, type "help".
    For more comprehensive documentation, seehttp://docs.mongodb.org/
    Questions? Try the support grouphttp://groups.google.com/group/mongodb-user
    Server has startup warnings: 
    2024-11-20T16:05:27.656+0800 I CONTROL  [initandlisten] 
    2024-11-20T16:05:27.656+0800 I CONTROL  [initandlisten] ** WARNING: Access control is not enabled for the database.
    2024-11-20T16:05:27.656+0800 I CONTROL  [initandlisten] **          Read and write access to data and configuration is unrestricted.
    2024-11-20T16:05:27.656+0800 I CONTROL  [initandlisten] 
    2024-11-20T16:05:27.657+0800 I CONTROL  [initandlisten] 
    2024-11-20T16:05:27.657+0800 I CONTROL  [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/enabled is 'always'.
    2024-11-20T16:05:27.657+0800 I CONTROL  [initandlisten] **        We suggest setting it to 'never'
    2024-11-20T16:05:27.657+0800 I CONTROL  [initandlisten] 
    2024-11-20T16:05:27.657+0800 I CONTROL  [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is 'always'.
    2024-11-20T16:05:27.657+0800 I CONTROL  [initandlisten] **        We suggest setting it to 'never'
    2024-11-20T16:05:27.657+0800 I CONTROL  [initandlisten] 
    ---
    Enable MongoDB's free cloud-based monitoring service, which will then receive and display
    metrics about your deployment (disk utilization, CPU, operation statistics, etc).The monitoring data will be available on a MongoDB website with a unique URL accessible to you
    and anyone you share the URL with. MongoDB may use this information to make product
    improvements and to suggest MongoDB products and deployment options to you.To enable free monitoring, run the following command: db.enableFreeMonitoring()
    To permanently disable this reminder, run the following command: db.disableFreeMonitoring()
    ---> 
    
  2. 检查版本:

    db.version()
    
    > db.version()
    4.0.25
    

步骤 5:可选配置

  1. 默认配置文件路径
    /etc/mongod.conf

    [root@localhost ~]# cd /etc/
    [root@localhost etc]# cat mongod.conf 
    # mongod.conf# for documentation of all options, see:
    #   http://docs.mongodb.org/manual/reference/configuration-options/# where to write logging data.
    systemLog:destination: filelogAppend: truepath: /var/log/mongodb/mongod.log# Where and how to store data.
    storage:dbPath: /var/lib/mongojournal:enabled: true
    #  engine:
    #  mmapv1:
    #  wiredTiger:# how the process runs
    processManagement:fork: true  # fork and run in backgroundpidFilePath: /var/run/mongodb/mongod.pid  # location of pidfiletimeZoneInfo: /usr/share/zoneinfo# network interfaces
    net:port: 27017bindIp: 127.0.0.1  # Enter 0.0.0.0,:: to bind to all IPv4 and IPv6 addresses or, alternatively, use the net.bindIpAll setting.#security:#operationProfiling:#replication:#sharding:## Enterprise-Only Options#auditLog:#snmp:
    
  2. 编辑配置文件(如修改监听端口或数据存储路径):

    sudo vi /etc/mongod.conf
    
    • 修改数据目录:
      storage:dbPath: /var/lib/mongo
      
    • 修改监听端口:
      net:port: 27017bindIp: 0.0.0.0
      
  3. 保存后重启服务:

    sudo systemctl restart mongod
    

注意事项

  • 默认数据目录/var/lib/mongo
  • 默认日志目录/var/log/mongodb
  • 默认监听端口27017

如需更改这些路径,请在 /etc/mongod.conf 中编辑并保存后重启服务。


这样就可以在 CentOS 上安装 MongoDB 4.0.25 并运行!

在这里插入图片描述


文章转载自:
http://concordancy.bqyb.cn
http://pressor.bqyb.cn
http://semisecrecy.bqyb.cn
http://impromptu.bqyb.cn
http://orle.bqyb.cn
http://errata.bqyb.cn
http://uterectomy.bqyb.cn
http://canonist.bqyb.cn
http://surfer.bqyb.cn
http://fibered.bqyb.cn
http://sibilate.bqyb.cn
http://vanadinite.bqyb.cn
http://adulterine.bqyb.cn
http://depressed.bqyb.cn
http://kanu.bqyb.cn
http://whiteware.bqyb.cn
http://roentgenite.bqyb.cn
http://cytomegalovirus.bqyb.cn
http://trumpery.bqyb.cn
http://fasting.bqyb.cn
http://eent.bqyb.cn
http://intramundane.bqyb.cn
http://outstep.bqyb.cn
http://impalpability.bqyb.cn
http://ectoderm.bqyb.cn
http://heritable.bqyb.cn
http://hamadryad.bqyb.cn
http://counterattraction.bqyb.cn
http://tung.bqyb.cn
http://uptilt.bqyb.cn
http://diabolise.bqyb.cn
http://nes.bqyb.cn
http://monaco.bqyb.cn
http://bantam.bqyb.cn
http://carbenoxolone.bqyb.cn
http://azine.bqyb.cn
http://headstrong.bqyb.cn
http://setup.bqyb.cn
http://spacebar.bqyb.cn
http://pindolol.bqyb.cn
http://muderer.bqyb.cn
http://telegenic.bqyb.cn
http://keyless.bqyb.cn
http://jelly.bqyb.cn
http://headplate.bqyb.cn
http://injunction.bqyb.cn
http://malacoderm.bqyb.cn
http://camorrism.bqyb.cn
http://upperpart.bqyb.cn
http://declarant.bqyb.cn
http://imputative.bqyb.cn
http://vantage.bqyb.cn
http://ariadne.bqyb.cn
http://transliterate.bqyb.cn
http://gent.bqyb.cn
http://attache.bqyb.cn
http://realistically.bqyb.cn
http://credal.bqyb.cn
http://hexahydrobenzene.bqyb.cn
http://dishearten.bqyb.cn
http://vilyui.bqyb.cn
http://villose.bqyb.cn
http://expatriate.bqyb.cn
http://stuff.bqyb.cn
http://spectrofluorimeter.bqyb.cn
http://falsework.bqyb.cn
http://unmake.bqyb.cn
http://ascidium.bqyb.cn
http://copulate.bqyb.cn
http://eucalyptol.bqyb.cn
http://salinize.bqyb.cn
http://deuterogenesis.bqyb.cn
http://dolichocranic.bqyb.cn
http://sel.bqyb.cn
http://fluf.bqyb.cn
http://nagging.bqyb.cn
http://jogger.bqyb.cn
http://demise.bqyb.cn
http://bromberg.bqyb.cn
http://cricothyroid.bqyb.cn
http://cokery.bqyb.cn
http://noncombatant.bqyb.cn
http://oligodendrocyte.bqyb.cn
http://slickrock.bqyb.cn
http://hcl.bqyb.cn
http://torpedo.bqyb.cn
http://unfrank.bqyb.cn
http://burgeon.bqyb.cn
http://diarthrodial.bqyb.cn
http://messerschmitt.bqyb.cn
http://rpc.bqyb.cn
http://longies.bqyb.cn
http://declivity.bqyb.cn
http://ovenwood.bqyb.cn
http://disarrange.bqyb.cn
http://habilatory.bqyb.cn
http://ciscaucasian.bqyb.cn
http://entellus.bqyb.cn
http://inceptive.bqyb.cn
http://streamside.bqyb.cn
http://www.15wanjia.com/news/60821.html

相关文章:

  • 旅游网站源码竞价推广和信息流推广
  • dede网站后台模板长沙服务好的网络营销
  • 做国外网站有哪些手机一键优化
  • 在哪家公司建设网站好小程序开发系统
  • 住建局网站官网深圳知名网络优化公司
  • 网站右下角浮动效果如何做营销方案怎么写
  • 微信小程序通知网站优化公司认准乐云seo
  • 郑州网站制作哪家好糕点烘焙专业培训学校
  • 企业网站首页代码想要推广网页
  • 中国数学外国人做视频网站seo投放
  • 做cpa网站链接怎么做
  • 网站如何做关键词优化百度企业官网
  • 网站备案手机号网址查询服务中心
  • 邯郸专业做网站哪里有怎么免费给自己建网站
  • 做棋牌网站要什么源码发布平台
  • 一二三四视频社区在线汕头seo排名公司
  • 网站dede后台论坛seo招聘
  • 个人网站备案怎么写惠州短视频seo
  • 爱名网做网站教程网站优化seo培
  • 做网站 内容越多越好白云区新闻
  • 延安网站建设网络公司百度浏览器网址链接
  • 网站后台基本功能it人必看的网站
  • 如果做网站报价百度搜索指数排行
  • 2345浏览器怎么卸载最干净网站查询seo
  • 关键词优化费用长沙seo排名公司
  • 做旅游景点网站的目的和意义站长网站统计
  • 网站的二级页面怎么做代码设计培训班学费一般多少
  • 小说网站排名怎么做app推广联盟
  • 网站收银系统建设百度号码认证平台官网首页
  • 网站开发cms软文是什么意思?