Manjaro安装mongodb

1.用yay安装

yay -S mongodb-bin

2.按照个人喜好配置设置(以下是我的设置)

配置文件位置:/etc/mongodb.conf

# mongod.conf

# for documentation of all options, see:
#   http://docs.mongodb.org/manual/reference/configuration-options/

# Where and how to store data.
storage:
  dbPath: /home/ronald/DBS/Mongodb/Data
  journal:
    enabled: true
#  engine:
#  mmapv1:
#  wiredTiger:

# where to write logging data.
systemLog:
  destination: file
  logAppend: true
  path: /home/ronald/DBS/Mongodb/Logs/mongod.log

# network interfaces
net:
  port: 27017
  bindIp: 127.0.0.1


# how the process runs
processManagement:
  timeZoneInfo: /usr/share/zoneinfo

#security:

#operationProfiling:

#replication:

#sharding:

## Enterprise-Only Options:

#auditLog:

#snmp:

服务文件位置 : /usr/lib/systemd/system/mongodb.service

[Unit]
Description=MongoDB Database Server
Documentation=https://docs.mongodb.org/manual
After=network-online.target
Wants=network-online.target

[Service]
User=ronald
Group=ronald
ExecStart=/usr/bin/mongod --quiet --config /etc/mongodb.conf
PIDFile=/run/mongodb/mongod.pid
# file size
LimitFSIZE=infinity
# cpu time
LimitCPU=infinity
# virtual memory size
LimitAS=infinity
# open files
LimitNOFILE=64000
# processes/threads
LimitNPROC=64000
# locked memory
LimitMEMLOCK=infinity
# total threads (user+kernel)
TasksMax=infinity
TasksAccounting=false
# Make systemd wait as long as it takes for MongoDB to start
# If MongoDB needs a long time to start, prevent systemd from
# restarting it every 90 seconds
# See: https://jira.mongodb.org/browse/SERVER-38086
TimeoutStartSec=infinity
Restart=always
RestartSec=10
# Recommended limits for mongod as specified in
# https://docs.mongodb.com/manual/reference/ulimit/#recommended-ulimit-settings

[Install]
WantedBy=multi-user.target

3.启动服务

启动服务时遇到的坑 记住一定要给文件加权限  Service中的User和Group改成用户名

sudo chown -Rc ronald /home/ronald/DBS/Mongodb
sudo chown -Rc ronald /usr/bin/mongod
sudo chown -Rc ronald /etc/mongodb.conf   
sudo chown -Rc ronald /tmp/mongodb-27017.sock

启动服务

systemctl start mongodb

开机启动

sudo systemctl enable mongodb

查看状态

sudo systemctl status mongodb

4.进入mongo shell

sudo vim /etc/profile
# 添加一行
export PATH=$PATH:/bin/mongo
 
 
#使环境变量立即生效
source /etc/profile

mongo

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值