• 首页 首页 icon
  • 工具库 工具库 icon
    • IP查询 IP查询 icon
  • 内容库 内容库 icon
    • 快讯库 快讯库 icon
    • 精品库 精品库 icon
    • 问答库 问答库 icon
  • 更多 更多 icon
    • 服务条款 服务条款 icon

MongoDB解决ProxmoxVE下CentOS7虚拟机安装MongoDB6后启动失败的问题

武飞扬头像
cindysz110
帮助1

目录

安装步骤:

2.1 配置yum源

2.2 安装MongoDB

2.3 启

动MongoDB


ProxmoxVE上新装的CentOS7.4虚拟机,安装MongoDB6。

安装步骤:

2.1 配置yum源

  1.  
    # 创建mongodb yum源(https://www.mongodb.com/docs/manual/tutorial/install-mongodb-on-red-hat/))
  2.  
    [root@host ~]# cd /etc/yum.repos.d/
  3.  
    [root@host yum.repos.d]# vi mongodb-org-6.0.repo
  4.  
    写入
  5.  
    [mongodb-org-6.0]
  6.  
    name=MongoDB Repository
  7.  
    baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/6.0/x86_64/
  8.  
    gpgcheck=1
  9.  
    enabled=1
  10.  
    gpgkey=https://www.mongodb.org/static/pgp/server-6.0.asc

2.2 安装MongoDB

[root@host yum.repos.d]# yum install -y mongodb-org

2.3 启

动MongoDB

[root@host yum.repos.d]# systemctl start mongod

启动MongoDB,测试mongosh连接时连接报错

  1.  
    [root@host yum.repos.d]# mongosh
  2.  
    Current Mongosh Log ID: 64d1c1a5ad16cdb9245f8893
  3.  
    Connecting to: mongodb://127.0.0.1:27017/?directConnection=true&serverSelectionTimeoutMS=2000&appName=mongosh 1.10.3
  4.  
    MongoNetworkError: connect ECONNREFUSED 127.0.0.1:27017
  5.  
    [root@host yum.repos.d]#

参照MongoDB官方文档,将CPU模式改为SandyBridge

学新通

重启服务器后,再次启动mongo,成功

  1.  
    [root@host ~]# mongosh
  2.  
    Current Mongosh Log ID: 64d0b3d80866e4ace3bc9c6f
  3.  
    Connecting to: mongodb://127.0.0.1:27017/?directConnection=true&serverSelectionTimeoutMS=2000&appName=mongosh 1.10.3
  4.  
    Using MongoDB: 6.0.8
  5.  
    Using Mongosh: 1.10.3
  6.  
     
  7.  
    For mongosh info see: https://docs.mongodb.com/mongodb-shell/
  8.  
     
  9.  
     
  10.  
    To help improve our products, anonymous usage data is collected and sent to MongoDB periodically (https://www.mongodb.com/legal/privacy-policy).
  11.  
    You can opt-out by running the disableTelemetry() command.
  12.  
     
  13.  
    ------
  14.  
    The server generated these startup warnings when booting
  15.  
    2023-08-07T17:03:37.033 08:00: Access control is not enabled for the database. Read and write access to data and configuration is unrestricted
  16.  
    2023-08-07T17:03:37.033 08:00: /sys/kernel/mm/transparent_hugepage/enabled is 'always'. We suggest setting it to 'never'
  17.  
    2023-08-07T17:03:37.033 08:00: /sys/kernel/mm/transparent_hugepage/defrag is 'always'. We suggest setting it to 'never'
  18.  
    2023-08-07T17:03:37.033 08:00: vm.max_map_count is too low
  19.  
    ------
  20.  
     
  21.  
    test>
学新通

消除2个错误提示

  1.  
    [root@host ~]# echo "never" > /sys/kernel/mm/transparent_hugepage/enabled
  2.  
    [root@host ~]# echo "never" > /sys/kernel/mm/transparent_hugepage/defrag
  3.  
    [root@host ~]# systemctl stop mongod
  4.  
    [root@host ~]# systemctl start mongod

完成。

这篇好文章是转载于:学新通技术网

  • 版权申明: 本站部分内容来自互联网,仅供学习及演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,请提供相关证据及您的身份证明,我们将在收到邮件后48小时内删除。
  • 本站站名: 学新通技术网
  • 本文地址: /boutique/detail/tanhhibjih
系列文章
更多 icon
同类精品
更多 icon
继续加载