查看: 61|回覆: 0

MongoDB单机部署

[複製鏈接]

2

主題

0

回帖

0

積分

热心网友

金币
0
閲讀權限
220
精華
0
威望
0
贡献
0
在線時間
0 小時
註冊時間
2009-8-4
發表於 2020-8-2 15:53:00 | 顯示全部樓層 |閲讀模式

MongoDB单机部署

一、环境

系统:centos7.6

DB版本:mongodb-linux-x86_64-rhel62-4.2.1.tgz

官网地址:https://www.mongodb.com

wget https://repo.mongodb.org/yum/redhat/7/mongodb-org/4.4/x86_64/RPMS/mongodb-org-server-4.4.0-1.el7.x86_64.rpm

二、安装

[root@t1 ~]# tar -zxvf mongodb-linux-x86_64-rhel62-4.2.1.tgz  -C /app/
[root@t1 app]# cd /app && mv mongodb-linux-x86_64-rhel62-4.2.1/ mongodb && cd mongodb
#创建日志、数据、配置文件、pid目录
[root@t1 mongodb]# mkdir  {logs,data,config,pid}  
#创建启动配置文件
[root@t1 config]# vim mongodb.conf 
#端口号
port = 27017 
#数据目录
dbpath = /app/mongodb/data
#日志目录
logpath = /app/mongodb/logs/mongodb.log
#pid目录
pidfilepath = /app/mongodb/pid/mongodb.pid
#设置后台运行
fork = true
#日志输出方式
logappend = true
#开启认证
#auth = true
#本地ip
bind_ip=0.0.0.0

三、启动

[root@t1 bin]# ./mongod --config ../config/mongodb.conf  
about to fork child process, waiting until server is ready for connections.
forked process: 10134
child process started successfully, parent exiting
#检查是否启动成功
[root@t1 bin]# ps -ef|grep mongodb
root      10134      1  1 15:42 ?        00:00:01 ./mongod --config ../config/mongodb.conf 
[root@t1 bin]# ss -ntlp|grep 27017
LISTEN     0      128    *:27017    *:*   users:(("mongod",pid=10134,fd=11))

四、进入数据库

[root@t1 bin]# ./mongo
MongoDB shell version v4.2.1
connecting to: mongodb://127.0.0.1:27017/?compressors=disabled&gssapiServiceName=mongodb
Implicit session: session { "id" : UUID("0357cfa5-c9d8-4eca-a04e-f49fc137d420") }
MongoDB server version: 4.2.1
Welcome to the MongoDB shell.
For interactive help, type "help".
For more comprehensive documentation, see
        http://docs.mongodb.org/
Questions? Try the support group
        http://groups.google.com/group/mongodb-user
Server has startup warnings: 
2020-08-02T15:42:38.431+0800 I  CONTROL  [initandlisten] 
2020-08-02T15:42:38.431+0800 I  CONTROL  [initandlisten] ** WARNING: Access control is not enabled for the database.
2020-08-02T15:42:38.431+0800 I  CONTROL  [initandlisten] **          Read and write access to data and configuration is unrestricted.
2020-08-02T15:42:38.431+0800 I  CONTROL  [initandlisten] ** WARNING: You are running this process as the root user, which is not recommended.
2020-08-02T15:42:38.431+0800 I  CONTROL  [initandlisten] 
2020-08-02T15:42:38.431+0800 I  CONTROL  [initandlisten] 
2020-08-02T15:42:38.431+0800 I  CONTROL  [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/enabled is 'always'.
2020-08-02T15:42:38.431+0800 I  CONTROL  [initandlisten] **        We suggest setting it to 'never'
2020-08-02T15:42:38.431+0800 I  CONTROL  [initandlisten] 
2020-08-02T15:42:38.431+0800 I  CONTROL  [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is 'always'.
2020-08-02T15:42:38.431+0800 I  CONTROL  [initandlisten] **        We suggest setting it to 'never'
2020-08-02T15:42:38.431+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()
---

> 


来源:https://www.cnblogs.com/hsyw/p/13418985.html
回覆

使用道具 舉報

您需要登錄後才可以回帖 登錄 | 立即注册

本版積分規則

相关侵权、举报、投诉及建议等,请发 E-mail:qiongdian@foxmail.com

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部