gpt4 book ai didi

mongodb - 通过 docker-composer 将 --wiredTigerCacheSizeGB 存储到 mongod.conf

转载 作者:行者123 更新时间:2023-12-02 18:04:47 30 4
gpt4 key购买 nike

我创建了 docker-compose.yml 来创建 mongo 容器:

version: '3'
services :
mongo:
image: mongo:4.2.0
command: mongod --wiredTigerCacheSizeGB 1.5
volumes:
- d:/datadir/mongo:/data/configdb
ports:
- "27018:27017"

我限制了wireTigerCach。但是在 up之后当我进入 etc/容器内的目录,我找不到 mongo.config 文件?
root@038321c42774:/# ls -a /etc/
. apt debconf.conf fstab gss issue ldap logrotate.d networks passwd rc2.d resolv.conf shadow- sysctl.conf
.. bash.bashrc debian_version gai.conf host.conf issue.net legal lsb-release nsswitch.conf passwd- rc3.d rmt shells sysctl.d
.pwd.lock bindresvport.blacklist default group hostname kernel libaudit.conf machine-id opt profile rc4.d securetty skel systemd
X11 ca-certificates deluser.conf group- hosts ld.so.cache localtime mke2fs.conf os-release profile.d rc5.d security ssl terminfo
adduser.conf ca-certificates.conf dpkg gshadow init.d ld.so.conf logcheck mongod.conf.orig pam.conf rc0.d rc6.d selinux subgid timezone
alternatives cron.daily environment gshadow- inputrc ld.so.conf.d login.defs mtab pam.d rc1.d rcS.d shadow subuid update-motd.d
root@038321c42774:/#

mongod.conf.orig但在哪里 mongod.conf以及存放地点 --wiredTigerCacheSizeGB 1.5 ?

最佳答案

来自 Docs

For a more complicated configuration setup, you can still use the MongoDB configuration file. mongod does not read a configuration file by default, so the --config option with the path to the configuration file needs to be specified. Create a custom configuration file and put it in the container by either creating a custom Dockerfile FROM mongo or mounting it from the host machine to the container. See the MongoDB manual for a full list of configuration file options.

For example, /my/custom/mongod.conf is the path to the custom configuration file. Then start the MongoDB container like the following:


docker run --name some-mongo -v /my/custom:/etc/mongo -d mongo --config /etc/mongo/mongod.conf

或尝试设置 flags像这样:
version: '3'
services :
mongo:
image: mongo:4.2.0
volumes:
- d:/datadir/mongo:/data/configdb
ports:
- "27018:27017"
command: --wiredTigerCacheSizeGB 1.5

configs没有存储在任何文件中,它们将作为您的命令的标志运行,检查 docker ps查看您的 container 的命令

关于mongodb - 通过 docker-composer 将 --wiredTigerCacheSizeGB 存储到 mongod.conf,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57783656/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com