mongodb学习笔记

2021年02月07日 未雨晴空 0评论 1111阅读 0喜欢

linux下载安装

MongoDB Community Server社区版本提供了灵活的文档模型以及临时查询,索引编制和实时聚合,以提供强大的方式来访问和分析数据。

MongoDB Community Server

MongoDB Community Server版本

安装mongodb前一定要清楚自己需要在什么类型的机器上安装,不然就要踩坑了。

# 下载
wget https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel70-4.4.3.tgz

# 解压
tar -zxvf mongodb-linux-x86_64-rhel70-4.4.3.tgz

# 编辑/etc/profile文件,配置mongodb可执行路径
vim /etc/profile

# 下面是需要添加的内容
export PATH=/root/soft/mongodb-linux-x86_64-rhel70-4.4.3/bin:$PATH

# 重新读取环境变量
source /etc/profile

# 切换到mongodb的目录下
cd /root/soft/mongodb-linux-x86_64-rhel70-4.4.3

# 创建数据目录和日志目录
mkdir data logs

# 创建日志文件
touch logs/mongodb.log

# 切换路径
cd /root/soft/mongodb-linux-x86_64-rhel70-4.4.3/bin

# 新建mongodb配置文件
vi mongodb.conf

# 下面是配置文件的内容
port=27017
bind_ip=127.0.0.1
dbpath=/root/soft/mongodb-linux-x86_64-rhel70-4.4.3/data
logpath=/root/soft/mongodb-linux-x86_64-rhel70-4.4.3/logs/mongodb.log
fork=true

# 启动mongodb
mongod --config mongodb.conf

发表评论 取消回复

电子邮件地址不会被公开。

请输入以http或https开头的URL,格式如:https://oneisall.top