ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、视频、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
# ubuntu 18.04 安装指定版本 进入mongodb官方网站,点击docs-->选择server-->选择版本-->Legacy Documentation-->mongodb server -->选择对应版本的文档 # 已经安装了的mongo `sudo apt list --installed | grep mongo` # 配置,3.0以上 ``` systemLog: destination: file path: "/var/log/mongodb/mongod.log" logAppend: true storage: dbPath: /var/lib/mongodb directoryperdb: true journal: enabled: true engine: wiredTiger wiredTiger: engineConfig: cacheSizeGB: 0.5 processManagement: fork: true net: bindIp: 0.0.0.0 port: 27017 security: authorization: enabled ``` # mongodb 3.6配置,和其他配置文件格式不一样,所以记录下 3.2以上默认开启wiredtiger ``` # Where to store the data. dbpath=/var/lib/mongodb #where to log logpath=/var/log/mongodb/mongodb.log logappend=true bind_ip = 0.0.0.0 port = 27017 directoryperdb=true #库以文件夹形式存在 wiredTigerCacheSizeGB=0.5 maxConns = 16384 # Enable journaling, http://www.mongodb.org/display/DOCS/Journaling journal=true # Turn on/off security. Off is currently the default #noauth = true auth = true ``` # mongodb 3.6系列mongod使用说明 ``` Options: General options: -h [ --help ] show this usage information --version show version information -f [ --config ] arg configuration file specifying additional options -v [ --verbose ] [=arg(=v)] be more verbose (include multiple times for more verbosity e.g. -vvvvv) --quiet quieter output --port arg specify port number - 27017 by default --bind_ip arg comma separated list of ip addresses to listen on - localhost by default --bind_ip_all bind to all ip addresses --ipv6 enable IPv6 support (disabled by default) --listenBacklog arg (=4096) set socket listen backlog size --maxConns arg max number of simultaneous connections - 1000000 by default --logpath arg log file to send write to instead of stdout - has to be a file, not directory --syslog log to system's syslog facility instead of file or stdout --syslogFacility arg syslog facility used for mongodb syslog message --logappend append to logpath instead of over-writing --logRotate arg set the log rotation behavior (rename|reopen) --timeStampFormat arg Desired format for timestamps in log messages. One of ctime, iso8601-utc or iso8601-local --pidfilepath arg full path to pidfile (if not set, no pidfile is created) --timeZoneInfo arg full path to time zone info directory, e.g. /usr/share/zoneinfo --keyFile arg private key for cluster authentication --noauth run without security --setParameter arg Set a configurable parameter --transitionToAuth For rolling access control upgrade. Attempt to authenticate over outgoing connections and proceed regardless of success. Accept incoming connections with or without authentication. --clusterAuthMode arg Authentication mode used for cluster authentication. Alternatives are (keyFile|sendKeyFile|sendX509|x509) --nounixsocket disable listening on unix sockets --unixSocketPrefix arg alternative directory for UNIX domain sockets (defaults to /tmp) --filePermissions arg permissions to set on UNIX domain socket file - 0700 by default --fork fork server process --networkMessageCompressors [=arg(=disabled)] (=snappy) Comma-separated list of compressors to use for network messages --auth run with security --clusterIpSourceWhitelist arg Network CIDR specification of permitted origin for `__system` access. --slowms arg (=100) value of slow for profile and console log --slowOpSampleRate arg (=1) fraction of slow ops to include in the profile and console log --profile arg 0=off 1=slow, 2=all --cpu periodically show cpu and iowait utilization --sysinfo print some diagnostic system information --noIndexBuildRetry don't retry any index builds that were interrupted by shutdown --noscripting disable scripting engine --notablescan do not allow table scans --shutdown kill a running server (for init scripts) Storage options: --storageEngine arg what storage engine to use - defaults to wiredTiger if no data files present --dbpath arg directory for datafiles - defaults to /data/db --directoryperdb each database will be stored in a separate directory --noprealloc disable data file preallocation - will often hurt performance --nssize arg (=16) .ns file size (in MB) for new databases --quota limits each database to a certain number of files (8 default) --quotaFiles arg number of files allowed per db, implies --quota --smallfiles use a smaller default file size --syncdelay arg (=60) seconds between disk syncs (0=never, but not recommended) --upgrade upgrade db if needed --repair run repair on all dbs --repairpath arg root directory for repair files - defaults to dbpath --journal enable journaling --nojournal disable journaling (journaling is on by default for 64 bit) --journalOptions arg journal diagnostic options --journalCommitInterval arg how often to group/batch commit (ms) WiredTiger options: --wiredTigerCacheSizeGB arg maximum amount of memory to allocate for cache; defaults to 1/2 of physical RAM --wiredTigerJournalCompressor arg (=snappy) use a compressor for log records [none|snappy|zlib] --wiredTigerDirectoryForIndexes Put indexes and data in different directories --wiredTigerCollectionBlockCompressor arg (=snappy) block compression algorithm for collection data [none|snappy|zlib] --wiredTigerIndexPrefixCompression arg (=1) use prefix compression on row-store leaf pages ```