暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

Centos安装MongoDB数据库

DevOps架构实战 2021-01-12
624

MongoDB 是一个基于分布式文件存储的数据库。由 C++ 语言编写。旨在为 WEB 应用提供可扩展的高性能数据存储解决方案。

MongoDB 是一个介于关系数据库和非关系数据库之间的产品,是非关系数据库当中功能最丰富,最像关系数据库的。

关闭防火墙

[root@docker02 yum.repos.d]# systemctl stop firewalld

[root@docker02 yum.repos.d]# systemctl disable firewalld

1、解压

[root@docker02 ~]# tar -zxvf mongodb-linux-x86_64-rhel70-4.4.2.tgz 

[root@docker02 ~]# mv mongodb-linux-x86_64-rhel70-4.4.2 opt/mongodb

root@docker02 bin]# vim etc/profile

export PATH=$PATH:/opt/mongodb/bin

[root@docker02 bin]# source etc/profile

[root@docker02 bin]# ls

install_compass  mongo  mongod  mongos

2、创建数据库存放目录和日志

[root@docker02 mongodb]# mkdir data/db -p

[root@docker02 data]# touch logs

[root@docker02 data]# ls

db  logs

[root@docker02 mongodb]# ls

bin  data  LICENSE-Community.txt  MPL-2  README  THIRD-PARTY-NOTICES

3、修改配置文件

[root@docker02 mongodb]# vim mongodb.conf

[root@docker02 ~]# vim opt/mongodb/mongodb.conf 

 # mongod.conf

# for documentation of all options, see:

# where to write logging data.

 systemLog:

   destination: file

   logAppend: true

   path: /opt/mongodb/data/logs

# Where and how to store data.

 storage:

   dbPath: /opt/mongodb/data/db

   journal:

     enabled: true

 #  engine:

 #  wiredTiger:

# how the process runs

 processManagement:

   fork: true  # fork and run in background

   pidFilePath: /mongo/mongod.pid  # location of pidfile

   timeZoneInfo: /usr/share/zoneinfo

# network interfaces

 net:

   port: 27017

   bindIp: 0.0.0.0

注意修改:

dbPath: /opt/mongodb/data/db

path: /opt/mongodb/data/logs

 port: 27017

  bindIp: 0.0.0.0

4、启动mongodb

[root@docker02 bin]# ./mongod -f ../mongodb.conf

或者后台启动

[root@docker02 bin]# mongod --dbpath /opt/mongodb/data/db --logpath /opt/mongodb/data/logs --fork

about to fork child process, waiting until server is ready for connections.

forked process: 8132

child process started successfully, parent exiting

相关阅读:

1、Mysqlbinlog日志的清理与切换

2、mysqldump+binlog恢复被删除的数据

3、Mysql8.0 主从复制

4、Mysql8.0安装实战



文章转载自DevOps架构实战,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论