当前位置:网站首页>环境搭建-MongoDB
环境搭建-MongoDB
2022-07-26 16:40:00 【wangmcn】
环境搭建-MongoDB
目录
- 1、简介
- 2、安装
- 3、启动与停止
本篇主要讲解在 CentOS 环境下安装 MongoDB。
1、简介
MongoDB 是一个基于分布式文件存储的数据库。由 C++ 语言编写。旨在为 Web 应用提供可扩展的高性能数据存储解决方案。
MongoDB 是一个介于关系数据库和非关系数据库之间的产品,是非关系数据库当中功能最丰富,最像关系数据库的。它支持的数据结构非常松散,是类似 json 的 bson 格式,因此可以存储比较复杂的数据类型。最大的特点是它支持的查询语言非常强大,其语法有点类似于面向对象的查询语言,几乎可以实现类似关系数据库单表查询的绝大部分功能,而且还支持对数据建立索引。
官网地址:
https://www.mongodb.com/
2、安装
1、安装依赖包
sudo yum install libcurl openssl2、下载
官网下载地址(社区版):
https://www.mongodb.com/try/download/community
选择相应的版本、平台、包,进行下载或者拷贝下载链接进行下载。
例如:下载mongodb-linux-x86_64-rhel70-5.0.5.tgz
并将已下载的文件上传到服务器上
或者直接输入命令,在服务器上进行下载
wget https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel70-5.0.5.tgz3、解压
tar -zxvf mongodb-linux-x86_64-rhel70-5.0.5.tgz解压后生成mongodb-linux-x86_64-rhel70-5.0.5目录
4、将解压包移动到指定目录下(/usr/local/),并命名为mongodb5
mv mongodb-linux-x86_64-rhel70-5.0.5 /usr/local/mongodb55、设置环境变量
(1)修改配置文件
vim /etc/profile(2)最后一行填写(mongodb文件路径以实际为准)
export PATH=$PATH:/usr/local/mongodb5/bin(3)使配置生效
source /etc/profile3、启动与停止
1、创建数据存储目录(/var/lib/mongodb),并授权
sudo mkdir -p /var/lib/mongodb
sudo chown 755 /var/lib/mongodb2、创建日志文件目录(/var/log/mongodb),并授权
sudo mkdir -p /var/log/mongodb
sudo chown 755 /var/log/mongodb3、启动服务
mongod --dbpath /var/lib/mongodb --logpath/var/log/mongodb/mongod.log --fork4、停止服务
方式一:
mongod --dbpath /var/lib/mongodb --logpath/var/log/mongodb/mongod.log --shutdown方式二:
输入mongo,进入mongo命令下
依次输入以下命令即可
use admin
db.shutdownServer()
exit边栏推荐
- [development tutorial 8] crazy shell · open source Bluetooth heart rate waterproof sports Bracelet - triaxial meter pace
- MySQL lock mechanism (example)
- About the difference between BigDecimal conversion string toengineeringstring, toplainstring and toString
- Definition and relationship of derivative, differential, partial derivative, total derivative, directional derivative and gradient
- UPC 2022 summer personal training game 07 (part)
- What kind of product is the Jetson nano? (how about the performance of Jetson nano)
- [classification] vgg16 training record
- Comparison between dimensional modeling and paradigm modeling
- Can TCP and UDP use the same port?
- Matlab paper illustration drawing template issue 40 - pie chart with offset sector
猜你喜欢

The principle of reliable transmission in TCP protocol

Can TCP and UDP use the same port?

Win11 how to close a shared folder

Idea Alibaba cloud multi module deployment

Avalanche subnets vs. polygon supernets of application chain
![[Development Tutorial 9] crazy shell arm function mobile phone-i2c tutorial](/img/9d/2a1deca934e6d56d729922b1d9e515.png)
[Development Tutorial 9] crazy shell arm function mobile phone-i2c tutorial

Stop using xshell and try this more modern terminal connection tool

OA项目之我的会议(会议排座&送审)

Chapter 1 Overview - Section 1 - 1.3 composition of the Internet

Win11系统如何一键进行重装?
随机推荐
Response对象-响应字符数据
[Luogu cf643f] bears and juice (conclusion)
Pass-19,20
【飞控开发基础教程2】疯壳·开源编队无人机-定时器(LED 航情灯、指示灯闪烁)
Avalanche subnets vs. polygon supernets of application chain
Advantages of time series database and traditional database
How to implement Devops with automation tools | including low code and Devops application practice
Concepts and differences of DQL, DML, DDL and DCL
“青出于蓝胜于蓝”,为何藏宝计划(TPC)是持币生息最后的一朵白莲花
Pyqt5 rapid development and practice 3.2 introduction to layout management and 3.3 practical application of QT Designer
Heavy! Zeng Xuezhong was promoted to vice chairman and CEO of zhanrui, and Chu Qingren was appointed as co CEO!
2022 software testing skills postman+newman+jenkins continuous integration practical tutorial
Implementing dropout with mxnet from zero sum
Data preprocessing of machine learning
Sharing of 40 completed projects of high-quality information management specialty [source code + Thesis] (VI)
After Oracle creates a table partition, the partition is not given during the query, but the value specified for the partition field will be automatically queried according to the partition?
营销指南 | 几种常见的微博营销打法
Stand aside with four and five rear cameras, LG or push the 16 rear camera mobile phone!
Thinkphp历史漏洞复现
Small application of C language using structure to simulate election