码迷,mamicode.com
首页 > 数据库 > 详细

Centos7安装mongodb

时间:2021-01-14 10:53:10      阅读:0      评论:0      收藏:0      [点我收藏+]

标签:mongo   bye   mon   cti   install   sys   解决   bsp   start   

学习自:https://www.cnblogs.com/blackmanzhang/p/12677538.html

 

[root@vmcentos7-1 ~]#vim /etc/yum.repos.d/mongodb-org-4.2.repo

[mongodb-org-4.2]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/4.2/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-4.2.asc


[root@vmcentos7-1 ~]# yum install mongodb-org
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirrors.163.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
base | 3.6 kB 00:00:00
extras | 2.9 kB 00:00:00
mongodb-org-4.2 | 2.5 kB 00:00:00
updates | 2.9 kB 00:00:00
mongodb-org-4.2/7/primary_db | 51 kB 00:00:01
正在解决依赖关系
--> 正在检查事务
---> 软件包 mongodb-org.x86_64.0.4.2.11-1.el7 将被 安装
--> 正在处理依赖关系 mongodb-org-tools = 4.2.11,它被软件包 mongodb-org-4.2.11-1.el7.x86_64 需要
--> 正在处理依赖关系 mongodb-org-server = 4.2.11,它被软件包 mongodb-org-4.2.11-1.el7.x86_64 需要
--> 正在处理依赖关系 mongodb-org-shell = 4.2.11,它被软件包 mongodb-org-4.2.11-1.el7.x86_64 需要
--> 正在处理依赖关系 mongodb-org-mongos = 4.2.11,它被软件包 mongodb-org-4.2.11-1.el7.x86_64 需要
--> 正在检查事务
---> 软件包 mongodb-org-mongos.x86_64.0.4.2.11-1.el7 将被 安装
---> 软件包 mongodb-org-server.x86_64.0.4.2.11-1.el7 将被 安装
---> 软件包 mongodb-org-shell.x86_64.0.4.2.11-1.el7 将被 安装
---> 软件包 mongodb-org-tools.x86_64.0.4.2.11-1.el7 将被 安装
--> 解决依赖关系完成

依赖关系解决

=============================================================================================================================================================================================================================================
Package 架构 版本 源 大小
=============================================================================================================================================================================================================================================
正在安装:
mongodb-org x86_64 4.2.11-1.el7 mongodb-org-4.2 5.9 k
为依赖而安装:
mongodb-org-mongos x86_64 4.2.11-1.el7 mongodb-org-4.2 15 M
mongodb-org-server x86_64 4.2.11-1.el7 mongodb-org-4.2 26 M
mongodb-org-shell x86_64 4.2.11-1.el7 mongodb-org-4.2 17 M
mongodb-org-tools x86_64 4.2.11-1.el7 mongodb-org-4.2 62 M

事务概要
=============================================================================================================================================================================================================================================
安装 1 软件包 (+4 依赖软件包)

总下载量:119 M
安装大小:284 M
Is this ok [y/d/N]: y
Downloading packages:
警告:/var/cache/yum/x86_64/7/mongodb-org-4.2/packages/mongodb-org-4.2.11-1.el7.x86_64.rpm: 头V3 RSA/SHA1 Signature, 密钥 ID 058f8b6b: NOKEY ] 0.0 B/s | 0 B --:--:-- ETA
mongodb-org-4.2.11-1.el7.x86_64.rpm 的公钥尚未安装
(1/5): mongodb-org-4.2.11-1.el7.x86_64.rpm | 5.9 kB 00:00:01
(2/5): mongodb-org-server-4.2.11-1.el7.x86_64.rpm | 26 MB 00:00:08
(3/5): mongodb-org-shell-4.2.11-1.el7.x86_64.rpm | 17 MB 00:00:05
(4/5): mongodb-org-mongos-4.2.11-1.el7.x86_64.rpm | 15 MB 00:00:17
(5/5): mongodb-org-tools-4.2.11-1.el7.x86_64.rpm | 62 MB 00:00:14
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
总计 3.9 MB/s | 119 MB 00:00:30
从 https://www.mongodb.org/static/pgp/server-4.2.asc 检索密钥
导入 GPG key 0x058F8B6B:
用户ID : "MongoDB 4.2 Release Signing Key <packaging@mongodb.com>"
指纹 : e162 f504 a20c df15 827f 718d 4b7c 549a 058f 8b6b
来自 : https://www.mongodb.org/static/pgp/server-4.2.asc
是否继续?[y/N]:y
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
正在安装 : mongodb-org-server-4.2.11-1.el7.x86_64 1/5
Created symlink from /etc/systemd/system/multi-user.target.wants/mongod.service to /usr/lib/systemd/system/mongod.service.
正在安装 : mongodb-org-tools-4.2.11-1.el7.x86_64 2/5
正在安装 : mongodb-org-mongos-4.2.11-1.el7.x86_64 3/5
正在安装 : mongodb-org-shell-4.2.11-1.el7.x86_64 4/5
正在安装 : mongodb-org-4.2.11-1.el7.x86_64 5/5
验证中 : mongodb-org-shell-4.2.11-1.el7.x86_64 1/5
验证中 : mongodb-org-mongos-4.2.11-1.el7.x86_64 2/5
验证中 : mongodb-org-tools-4.2.11-1.el7.x86_64 3/5
验证中 : mongodb-org-server-4.2.11-1.el7.x86_64 4/5
验证中 : mongodb-org-4.2.11-1.el7.x86_64 5/5

已安装:
mongodb-org.x86_64 0:4.2.11-1.el7

作为依赖被安装:
mongodb-org-mongos.x86_64 0:4.2.11-1.el7 mongodb-org-server.x86_64 0:4.2.11-1.el7 mongodb-org-shell.x86_64 0:4.2.11-1.el7 mongodb-org-tools.x86_64 0:4.2.11-1.el7

完毕!

[root@vmcentos7-1 ~]# systemctl start mongod.service

[root@vmcentos7-1 ~]# systemctl status mongod.service

● mongod.service - MongoDB Database Server
Loaded: loaded (/usr/lib/systemd/system/mongod.service; enabled; vendor preset: disabled)
Active: active (running) since 三 2021-01-13 10:17:22 CST; 4s ago
Docs: https://docs.mongodb.org/manual
Process: 25176 ExecStart=/usr/bin/mongod $OPTIONS (code=exited, status=0/SUCCESS)
Process: 25174 ExecStartPre=/usr/bin/chmod 0755 /var/run/mongodb (code=exited, status=0/SUCCESS)
Process: 25172 ExecStartPre=/usr/bin/chown mongod:mongod /var/run/mongodb (code=exited, status=0/SUCCESS)
Process: 25168 ExecStartPre=/usr/bin/mkdir -p /var/run/mongodb (code=exited, status=0/SUCCESS)
Main PID: 25179 (mongod)
Tasks: 32
CGroup: /system.slice/mongod.service
└─25179 /usr/bin/mongod -f /etc/mongod.conf

1月 13 10:17:18 vmcentos7-1 systemd[1]: Starting MongoDB Database Server...
1月 13 10:17:19 vmcentos7-1 mongod[25176]: about to fork child process, waiting until server is ready for connections.
1月 13 10:17:19 vmcentos7-1 mongod[25176]: forked process: 25179
1月 13 10:17:22 vmcentos7-1 systemd[1]: Started MongoDB Database Server.

[root@vmcentos7-1 ~]# systemctl enable mongod.service

 

[root@vmcentos7-1 ~]# mongo
MongoDB shell version v4.2.11
connecting to: mongodb://127.0.0.1:27017/?compressors=disabled&gssapiServiceName=mongodb
Implicit session: session { "id" : UUID("a97369c0-ca34-462a-a7cf-225f46187c82") }
MongoDB server version: 4.2.11
Welcome to the MongoDB shell.
For interactive help, type "help".
For more comprehensive documentation, see
https://docs.mongodb.com/
Questions? Try the MongoDB Developer Community Forums
https://community.mongodb.com
Server has startup warnings:
2021-01-13T10:17:22.295+0800 I CONTROL [initandlisten]
2021-01-13T10:17:22.295+0800 I CONTROL [initandlisten] ** WARNING: Access control is not enabled for the database.
2021-01-13T10:17:22.295+0800 I CONTROL [initandlisten] ** Read and write access to data and configuration is unrestricted.
2021-01-13T10:17:22.295+0800 I CONTROL [initandlisten]
2021-01-13T10:17:22.296+0800 I CONTROL [initandlisten]
2021-01-13T10:17:22.296+0800 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/enabled is ‘always‘.
2021-01-13T10:17:22.296+0800 I CONTROL [initandlisten] ** We suggest setting it to ‘never‘
2021-01-13T10:17:22.296+0800 I CONTROL [initandlisten]
2021-01-13T10:17:22.296+0800 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is ‘always‘.
2021-01-13T10:17:22.296+0800 I CONTROL [initandlisten] ** We suggest setting it to ‘never‘
2021-01-13T10:17:22.296+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()
---

>exit

bye

 

Centos7安装mongodb

标签:mongo   bye   mon   cti   install   sys   解决   bsp   start   

原文地址:https://www.cnblogs.com/xwhgr/p/14270688.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有
迷上了代码!