目录

内建帮助文档线路

兼容性

Itemlinks
README filesmongodb-linux-x86_64-rhel70-4.2.3-46-g2503dfb
Binaries Download from : https://www.mongodb.org/dl/linux/x86_64-rhel70 ↓↓
install-mongodb-on-red-hathttps://docs.mongodb.com/manual/tutorial/install-mongodb-on-red-hat/
administration/install-on-linuxhttps://docs.mongodb.com/manual/administration/install-on-linux/

install

Download

yum repo & apt deb

HowToGetlinks
version 3.0~latest https://repo.mongodb.org/yum/redhat/7Server/mongodb-org/
rpm autoconfigure download https://repo.mongodb.org/yum/redhat/

程序目录tree介绍

#以官方已编译提供的二进制包为例
[root@centos76 mongodb-linux-x86_64-rhel70-4.2.3-46-g2503dfb]# tree ./
./
├── bin
│   ├── bsondump
│   ├── install_compass
│   ├── mongo
│   ├── mongod
│   ├── mongodump
│   ├── mongoexport
│   ├── mongofiles
│   ├── mongoimport
│   ├── mongoreplay
│   ├── mongorestore
│   ├── mongos
│   ├── mongostat
│   └── mongotop
├── LICENSE-Community.txt
├── MPL-2
├── README    ---------------------------->> # [ 必读 ] 目录介绍、服务快速安装、官方在线文档链接
├── THIRD-PARTY-NOTICES
└── THIRD-PARTY-NOTICES.gotools

1 directory, 18 files
[root@centos76 mongodb-linux-x86_64-rhel70-4.2.3-46-g2503dfb]#

install by Yum

yum repo configure

[mongodb-org-4.2]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/4.2/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-4.2.asc

https://docs.mongodb.com/manual/tutorial/install-mongodb-on-red-hat/

# To install the latest stable version of MongoDB
yum install -y mongodb-org  

#To install the specified version of MongoDB
yum install -y mongodb-org-4.2.3 mongodb-org-server-4.2.3 mongodb-org-shell-4.2.3 mongodb-org-mongos-4.2.3 mongodb-org-tools-4.2.3 
#如果安装的特定版本,在更新mongodb时,Add below to /etc/yum.conf
exclude=mongodb-org,mongodb-org-server,mongodb-org-shell,mongodb-org-mongos,mongodb-org-tools

systemctl {start|status|restart} mongod

系统参数优化准备

https://docs.mongodb.com/manual/reference/ulimit/

manual installation

相关目录说明

MongoDB启动前必须提前创建数据目录与日志目录和分配权限(root用户可以不用chown)。

#By default, MongoDB runs using the mongod user account and uses the following default directories:

/var/lib/mongo (the data directory)
/var/log/mongodb (the log directory)

#mkdir default directories
sudo mkdir -p /var/lib/mongo
sudo mkdir -p /var/log/mongodb

#
sudo chown -R mongod:mongod <directory>

Use Non-Default Directories

https://docs.mongodb.com/manual/reference/configuration-options/#storage.dbPath
#To use a data directory and/or log directory other than the default directories:
#Create the new directory or directories.
#Edit the the configuration file  /etc/mongod.conf  and modify the following fields accordingly:
        storage.dbPath to specify a new data directory path (e.g. /some/data/directory)
        systemLog.path to specify a new log file path (e.g. /some/log/directory/mongod.log)
    Ensure that the user running MongoDB has access to the directory or directories:
    
sudo chown -R mongod:mongod <directory>

Install MongoDB Using tarball

#Use the following command to install the dependencies required for the MongoDB Community .tgz tarball
yum install libcurl openssl

#Download & untar the MongoDB .tgz tarball. 
tar -zxvf mongodb-linux-*-4.2.3.tgz

#Add PATH environment variable
sudo cp /path/to/the/mongodb-linux-*-4.2.3/bin/* /usr/local/bin/
  #or
sudo ln -s  /path/to/the/mongodb-linux-*-4.2.3/bin/* /usr/local/bin/
  #or
export PATH=/path/to/the/mongodb-linux-*-4.2.3/bin:$PATH

#同样创建目录。(说明:如果使用yum安装,以下目录将自动创建并指定mongod用户权限。
#tarball安装需要手动操作。
#/var/lib/mongo (the data directory)
#/var/log/mongodb (the log directory)
sudo mkdir -p /var/lib/mongo
sudo mkdir -p /var/log/mongodb
chown -R mongod:mongod /var/lib/mongo /var/log/mongodb

#Run MongoDB
# --fork : Don't output log at console,but to logfile
mongod --dbpath /var/lib/mongo --logpath /var/log/mongodb/mongod.log --fork
#启动日志,参考

#Verify that MongoDB has started successfully by checking the process output for the following line in the log file /var/log/mongodb/mongod.log:

[initandlisten] waiting for connections on port 27017


#Begin using MongoDB,use Mongodb client to connect MongoDB,
mongo

配置文件

# mongod.conf

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

# where to write logging data.
systemLog:
  destination: file
  logAppend: true
  path: /var/log/mongodb/mongod.log

# Where and how to store data.
storage:
  dbPath: /var/lib/mongo
  journal:
    enabled: true
#  engine:
#  wiredTiger:

# how the process runs
processManagement:
  fork: true  # fork and run in background
  pidFilePath: /var/run/mongodb/mongod.pid  # location of pidfile
  timeZoneInfo: /usr/share/zoneinfo

# network interfaces
net:
  port: 27017
  bindIp: 127.0.0.1  # Enter 0.0.0.0,:: to bind to all IPv4 and IPv6 addresses or, alternatively, use the net.bindIpAll setting.


#security:

#operationProfiling:

#replication:

#sharding:

## Enterprise-Only Options

#auditLog:

#snmp:

默认端口

--port <port>
Default:
27017 if mongod is not a shard member or a config server member
27018 if mongod is a shard member
27019 if mongod is a config server member
The TCP port on which the MongoDB instance listens for client connections.

Mongodb systemd

官方参考: https://github.com/mongodb/mongo/blob/master/rpm/mongod.service 另有init.d见 https://github.com/mongodb/mongo/blob/master/rpm/

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

[Service]
#User=mongod
#Group=mongod
Environment="OPTIONS=-f /etc/mongod.conf"
#EnvironmentFile=-/etc/sysconfig/mongod
ExecStartPre=/usr/bin/echo never > /sys/kernel/mm/transparent_hugepage/enabled
ExecStartPre=/usr/bin/echo never > /sys/kernel/mm/transparent_hugepage/defrag
#ExecStart=/usr/local/mongodb/bin/mongod  --dbpath /var/lib/mongo --logpath /var/log/mongodb/mongod.log --fork
#ExecStart=/usr/bin/mongod  --dbpath /var/lib/mongo --logpath /var/log/mongodb/mongod.log --fork
ExecStart=/usr/bin/numactl --interleave=all /usr/local/mongodb/bin/mongod $OPTIONS --fork
#ExecStartPre=/usr/bin/mkdir -p /var/run/mongodb
#ExecStartPre=/usr/bin/chown mongod:mongod /var/run/mongodb
#ExecStartPre=/usr/bin/chmod 0755 /var/run/mongodb
#PermissionsStartOnly=true
#PIDFile=/var/run/mongodb/mongod.pid
Type=forking
# 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
# Recommended limits for for mongod as specified in
# http://docs.mongodb.org/manual/reference/ulimit/#recommended-settings

[Install]
WantedBy=multi-user.target

Debug

–verbose, -v Increases the amount of internal reporting returned on standard output or in log files. Increase the verbosity with the -v form by including the option multiple times, (e.g. -vvvvv.)

Starting in version 4.2, MongoDB includes the Debug verbosity level (1-5) in the log messages. For example, if the verbosity level is 2, MongoDB logs D2. In previous versions, MongoDB log messages only specified D for Debug level.

Quote & Appendix

MongoDB README

MongoDB README

Welcome to MongoDB!

COMPONENTS

  mongod - The database server.
  mongos - Sharding router.
  mongo  - The database shell (uses interactive javascript).

UTILITIES

  mongodump         - Create a binary dump of the contents of a database.
  mongorestore      - Restore data from the output created by mongodump.
  mongoexport       - Export the contents of a collection to JSON or CSV.
  mongoimport       - Import data from JSON, CSV or TSV.
  mongofiles        - Put, get and delete files from GridFS.
  mongostat         - Show the status of a running mongod/mongos.
  bsondump          - Convert BSON files into human-readable formats.
  mongoreplay       - Traffic capture and replay tool.
  mongotop          - Track time spent reading and writing data.
  install_compass   - Installs MongoDB Compass for your platform.

BUILDING

  See docs/building.md.

RUNNING

  For command line options invoke:

    $ ./mongod --help

  To run a single server database:

    $ sudo mkdir -p /data/db
    $ ./mongod
    $
    $ # The mongo javascript shell connects to localhost and test database by default:
    $ ./mongo
    > help

INSTALLING COMPASS

  You can install compass using the install_compass script packaged with MongoDB:

    $ ./install_compass

  This will download the appropriate MongoDB Compass package for your platform
  and install it.
DRIVERS

  Client drivers for most programming languages are available at
  https://docs.mongodb.com/manual/applications/drivers/. Use the shell
  ("mongo") for administrative tasks.

BUG REPORTS

  See https://github.com/mongodb/mongo/wiki/Submit-Bug-Reports.

PACKAGING

  Packages are created dynamically by the package.py script located in the
  buildscripts directory. This will generate RPM and Debian packages.

DOCUMENTATION

  https://docs.mongodb.com/manual/

CLOUD HOSTED MONGODB

  https://www.mongodb.com/cloud/atlas

MAIL LISTS

  https://groups.google.com/forum/#!forum/mongodb-user

    A forum for technical questions about using MongoDB.

  https://groups.google.com/forum/#!forum/mongodb-dev

    A forum for technical questions about building and developing MongoDB.

LEARN MONGODB

  https://university.mongodb.com/

LICENSE

  MongoDB is free and open-source. Versions released prior to October 16,
  2018 are published under the AGPL. All versions released after October
  16, 2018, including patch fixes for prior versions, are published under
  the Server Side Public License (SSPL) v1. See individual files for
  details.

initial mongod.conf

Starting in MongoDB 4.2, mongod and mongos accept –outputConfig command-line option to output the configuration used by the mongod/mongos instance.
https://docs.mongodb.com/manual/tutorial/convert-command-line-options-to-yaml/
从MongoDB 4.2, mongod and mongos 支持 –outputConfig 输出yaml配置文件(命令参数仅仅输出配置文件)。通过>重定向输出用/etc/mongod.conf即可。

[root@centos76 bin]# mongod --shardsvr --replSet myShard  --dbpath /var/lib/mongodb --bind_ip localhost,My-Example-Hostname --fork --logpath /var/log/mongodb/mongod.log --clusterAuthMode x509 --tlsMode requireTLS  --tlsCAFile /path/to/my/CA/file  --tlsCertificateKeyFile /path/to/my/certificate/file --tlsClusterFile /path/to/my/cluster/membership/file --outputConfig
net:
  bindIp: localhost,My-Example-Hostname
  tls:
    CAFile: /path/to/my/CA/file
    certificateKeyFile: /path/to/my/certificate/file
    clusterFile: /path/to/my/cluster/membership/file
    mode: requireTLS
outputConfig: true                                #使用时此行需要先去掉。
processManagement:
  fork: true
replication:
  replSet: myShard
security:
  clusterAuthMode: x509
sharding:
  clusterRole: shardsvr
storage:
  dbPath: /var/lib/mongodb
systemLog:
  destination: file
  path: /var/log/mongodb/mongod.log
# 有用的示例
[root@centos76 bin]# mongod --dbpath /var/lib/mongodb --bind_ip 100.64.88.148 --fork --logpath /var/log/mongodb/mongod.log --outputConfig
net:
  bindIp: 100.64.88.148
outputConfig: true
processManagement:
  fork: true
storage:
  dbPath: /var/lib/mongodb
systemLog:
  destination: file
  path: /var/log/mongodb/mongod.log


Mongod server --help

#./mongod --help 

Options:
  --networkMessageCompressors arg (=snappy,zstd,zlib)
                                        Comma-separated list of compressors to 
                                        use for network messages

General options:
  -h [ --help ]                         Show this usage information
  --version                             Show version information
  -f [ --config ] arg                   Configuration file specifying 
                                        additional options
  --configExpand arg                    Process expansion directives in config 
                                        file (none, exec, rest)
  --ipv6                                Enable IPv6 support (disabled by 
                                        default)
  --listenBacklog arg (=128)            Set socket listen backlog size
  --maxConns arg (=1000000)             Max number of simultaneous connections
  --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
  --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
  -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
  --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
  --setParameter arg                    Set a configurable parameter
  --bind_ip arg                         Comma separated list of ip addresses to
                                        listen on - localhost by default
  --bind_ip_all                         Bind to all ip addresses
  --noauth                              Run without security
  --transitionToAuth                    For rolling access control upgrade. 
                                        Attempt to authenticate over outgoing 
                                        connections and proceed regardless of 
                                        success. Accept incoming connections 
                                        with or without authentication.
  --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
  --auth                                Run with security
  --clusterIpSourceWhitelist arg        Network CIDR specification of permitted
                                        origin for `__system` access
  --profile arg                         0=off 1=slow, 2=all
  --cpu                                 Periodically show cpu and iowait 
                                        utilization
  --sysinfo                             Print some diagnostic system 
                                        information
  --noscripting                         Disable scripting engine
  --notablescan                         Do not allow table scans
  --shutdown                            Kill a running server (for init 
                                        scripts)
  --keyFile arg                         Private key for cluster authentication
  --clusterAuthMode arg                 Authentication mode used for cluster 
                                        authentication. Alternatives are 
                                        (keyFile|sendKeyFile|sendX509|x509)

Replication options:
  --oplogSize arg                       Size to use (in MB) for replication op 
                                        log. default is 5% of disk space (i.e. 
                                        large is good)

Replica set options:
  --replSet arg                         arg is <setname>[/<optionalseedhostlist
                                        >]
  --enableMajorityReadConcern [=arg(=1)] (=1)
                                        Enables majority readConcern

Sharding options:
  --configsvr                           Declare this is a config db of a 
                                        cluster; default port 27019; default 
                                        dir /data/configdb
  --shardsvr                            Declare this is a shard db of a 
                                        cluster; default port 27018

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
  --syncdelay arg (=60)                 Seconds between disk syncs (0=never, 
                                        but not recommended)
  --journalCommitInterval arg (=100)    how often to group/batch commit (ms)
  --noIndexBuildRetry                   Do not retry any index builds that were
                                        interrupted by shutdown
  --upgrade                             Upgrade db if needed
  --repair                              Run repair on all dbs
  --journal                             Enable journaling
  --nojournal                           Disable journaling (journaling is on by
                                        default for 64 bit)

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|zstd]
  --wiredTigerDirectoryForIndexes       Put indexes and data in different 
                                        directories
  --wiredTigerMaxCacheOverflowFileSizeGB arg (=0)
                                        Maximum amount of disk space to use for
                                        cache overflow; Defaults to 0 
                                        (unbounded)
  --wiredTigerCollectionBlockCompressor arg (=snappy)
                                        Block compression algorithm for 
                                        collection data [none|snappy|zlib|zstd]
  --wiredTigerIndexPrefixCompression arg (=1)
                                        Use prefix compression on row-store 
                                        leaf pages

Free Monitoring Options:
  --enableFreeMonitoring arg            Enable Cloud Free Monitoring 
                                        (on|runtime|off)
  --freeMonitoringTag arg               Cloud Free Monitoring Tags

TLS Options:
  --tlsOnNormalPorts                    Use TLS on configured ports
  --tlsMode arg                         Set the TLS operation mode 
                                        (disabled|allowTLS|preferTLS|requireTLS
                                        )
  --tlsCertificateKeyFile arg           Certificate and key file for TLS
  --tlsCertificateKeyFilePassword arg   Password to unlock key in the TLS 
                                        certificate key file
  --tlsClusterFile arg                  Key file for internal TLS 
                                        authentication
  --tlsClusterPassword arg              Internal authentication key file 
                                        password
  --tlsCAFile arg                       Certificate Authority file for TLS
  --tlsClusterCAFile arg                CA used for verifying remotes during 
                                        inbound connections
  --tlsCRLFile arg                      Certificate Revocation List file for 
                                        TLS
  --tlsDisabledProtocols arg            Comma separated list of TLS protocols 
                                        to disable [TLS1_0,TLS1_1,TLS1_2]
  --tlsAllowConnectionsWithoutCertificates 
                                        Allow client to connect without 
                                        presenting a certificate
  --tlsAllowInvalidHostnames            Allow server certificates to provide 
                                        non-matching hostnames
  --tlsAllowInvalidCertificates         Allow connections to servers with 
                                        invalid certificates
  --tlsFIPSMode                         Activate FIPS 140-2 mode at startup
  --tlsLogVersions arg                  Comma separated list of TLS protocols 
                                        to log on connect [TLS1_0,TLS1_1,TLS1_2
                                        ]


mongodb log & Troubleshooting


2020-02-15T15:31:36.423+0800 I  CONTROL  [main] Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'
2020-02-15T15:31:36.424+0800 W  ASIO     [main] No TransportLayer configured during NetworkInterface startup
2020-02-15T15:31:36.425+0800 I  CONTROL  [initandlisten] MongoDB starting : pid=76019 port=27017 dbpath=/var/lib/mongo 64-bit host=centos76
2020-02-15T15:31:36.425+0800 I  CONTROL  [initandlisten] db version v4.2.3-46-g2503dfb
2020-02-15T15:31:36.425+0800 I  CONTROL  [initandlisten] git version: 2503dfb77d9b81d3a9dc9800bf56d52c0528e60f
2020-02-15T15:31:36.425+0800 I  CONTROL  [initandlisten] OpenSSL version: OpenSSL 1.0.1e-fips 11 Feb 2013
2020-02-15T15:31:36.425+0800 I  CONTROL  [initandlisten] allocator: tcmalloc
2020-02-15T15:31:36.425+0800 I  CONTROL  [initandlisten] modules: none
2020-02-15T15:31:36.425+0800 I  CONTROL  [initandlisten] build environment:
2020-02-15T15:31:36.425+0800 I  CONTROL  [initandlisten]     distmod: rhel70
2020-02-15T15:31:36.425+0800 I  CONTROL  [initandlisten]     distarch: x86_64
2020-02-15T15:31:36.425+0800 I  CONTROL  [initandlisten]     target_arch: x86_64
2020-02-15T15:31:36.425+0800 I  CONTROL  [initandlisten] options: { processManagement: { fork: true }, storage: { dbPath: "/var/lib/mongo" }, systemLog: { destination: "file", path: "/var/log/mongodb/mongod.log" } }
2020-02-15T15:31:36.425+0800 I  STORAGE  [initandlisten] wiredtiger_open config: create,cache_size=478M,cache_overflow=(file_max=0M),session_max=33000,eviction=(threads_min=4,threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000,close_scan_interval=10,close_handle_minimum=250),statistics_log=(wait=0),verbose=[recovery_progress,checkpoint_progress],
2020-02-15T15:31:36.936+0800 I  STORAGE  [initandlisten] WiredTiger message [1581751896:936828][76019:0x7f17ffaf6c40], txn-recover: Set global recovery timestamp: (0, 0)
2020-02-15T15:31:36.952+0800 I  RECOVERY [initandlisten] WiredTiger recoveryTimestamp. Ts: Timestamp(0, 0)
2020-02-15T15:31:36.966+0800 I  STORAGE  [initandlisten] Timestamp monitor starting
2020-02-15T15:31:36.969+0800 I  CONTROL  [initandlisten]
2020-02-15T15:31:36.969+0800 I  CONTROL  [initandlisten] ** WARNING: Access control is not enabled for the database.             #初次启动还未配置登陆用户授权
2020-02-15T15:31:36.969+0800 I  CONTROL  [initandlisten] **          Read and write access to data and configuration is unrestricted.
2020-02-15T15:31:36.969+0800 I  CONTROL  [initandlisten] ** WARNING: You are running this process as the root user, which is not recommended.   #不建议使用root启动
2020-02-15T15:31:36.969+0800 I  CONTROL  [initandlisten]
2020-02-15T15:31:36.969+0800 I  CONTROL  [initandlisten] ** WARNING: This server is bound to localhost.                          #服务仅绑定本地,仅可本地使用。如果需要远程调用,需要修改--bind_ip
2020-02-15T15:31:36.969+0800 I  CONTROL  [initandlisten] **          Remote systems will be unable to connect to this server.
2020-02-15T15:31:36.969+0800 I  CONTROL  [initandlisten] **          Start the server with --bind_ip <address> to specify which IP
2020-02-15T15:31:36.969+0800 I  CONTROL  [initandlisten] **          addresses it should serve responses from, or with --bind_ip_all to
2020-02-15T15:31:36.969+0800 I  CONTROL  [initandlisten] **          bind to all interfaces. If this behavior is desired, start the
2020-02-15T15:31:36.969+0800 I  CONTROL  [initandlisten] **          server with --bind_ip 127.0.0.1 to disable this warning.
2020-02-15T15:31:36.969+0800 I  CONTROL  [initandlisten]
2020-02-15T15:31:36.970+0800 I  CONTROL  [initandlisten]
2020-02-15T15:31:36.970+0800 I  CONTROL  [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/enabled is 'always'.    #THP配置建议
2020-02-15T15:31:36.970+0800 I  CONTROL  [initandlisten] **        We suggest setting it to 'never'
2020-02-15T15:31:36.970+0800 I  CONTROL  [initandlisten]
2020-02-15T15:31:36.970+0800 I  CONTROL  [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is 'always'.     #THP配置建议
2020-02-15T15:31:36.970+0800 I  CONTROL  [initandlisten] **        We suggest setting it to 'never'
2020-02-15T15:31:36.970+0800 I  CONTROL  [initandlisten]
2020-02-15T15:31:36.971+0800 I  STORAGE  [initandlisten] createCollection: admin.system.version with provided UUID: 1390a8d7-ad33-4346-94e9-d19375295604 and options: { uuid: UUID("1390a8d7-ad33-4346-94e9-d19375295604") }
2020-02-15T15:31:36.979+0800 I  INDEX    [initandlisten] index build: done building index _id_ on ns admin.system.version
2020-02-15T15:31:36.979+0800 I  SHARDING [initandlisten] Marking collection admin.system.version as collection version: <unsharded>
2020-02-15T15:31:36.979+0800 I  COMMAND  [initandlisten] setting featureCompatibilityVersion to 4.2
2020-02-15T15:31:36.979+0800 I  SHARDING [initandlisten] Marking collection local.system.replset as collection version: <unsharded>
2020-02-15T15:31:36.979+0800 I  STORAGE  [initandlisten] Flow Control is enabled on this deployment.
2020-02-15T15:31:36.980+0800 I  SHARDING [initandlisten] Marking collection admin.system.roles as collection version: <unsharded>
2020-02-15T15:31:36.980+0800 I  STORAGE  [initandlisten] createCollection: local.startup_log with generated UUID: 7a478454-3e35-41fb-b344-03d0c2d0e727 and options: { capped: true, size: 10485760 }
2020-02-15T15:31:36.986+0800 I  INDEX    [initandlisten] index build: done building index _id_ on ns local.startup_log
2020-02-15T15:31:36.986+0800 I  SHARDING [initandlisten] Marking collection local.startup_log as collection version: <unsharded>
2020-02-15T15:31:36.979+0800 I  COMMAND  [initandlisten] setting featureCompatibilityVersion to 4.2
2020-02-15T15:31:36.979+0800 I  SHARDING [initandlisten] Marking collection local.system.replset as collection version: <unsharded>
2020-02-15T15:31:36.979+0800 I  STORAGE  [initandlisten] Flow Control is enabled on this deployment.
2020-02-15T15:31:36.980+0800 I  SHARDING [initandlisten] Marking collection admin.system.roles as collection version: <unsharded>
2020-02-15T15:31:36.980+0800 I  STORAGE  [initandlisten] createCollection: local.startup_log with generated UUID: 7a478454-3e35-41fb-b344-03d0c2d0e727 and options: { capped: true, size: 10485760 }
2020-02-15T15:31:36.986+0800 I  INDEX    [initandlisten] index build: done building index _id_ on ns local.startup_log
2020-02-15T15:31:36.986+0800 I  SHARDING [initandlisten] Marking collection local.startup_log as collection version: <unsharded>
2020-02-15T15:31:36.997+0800 I  FTDC     [initandlisten] Initializing full-time diagnostic data capture with directory '/var/lib/mongo/diagnostic.data'
2020-02-15T15:31:37.000+0800 I  SHARDING [ftdc] Marking collection local.oplog.rs as collection version: <unsharded>
2020-02-15T15:31:37.003+0800 I  SHARDING [LogicalSessionCacheRefresh] Marking collection config.system.sessions as collection version: <unsharded>
2020-02-15T15:31:37.004+0800 I  STORAGE  [LogicalSessionCacheRefresh] createCollection: config.system.sessions with provided UUID: 06c7bfb3-3131-4423-afee-e4b5be386835 and options: { uuid: UUID("06c7bfb3-3131-4423-afee-e4b5be386835") }
2020-02-15T15:31:37.005+0800 I  NETWORK  [listener] Listening on /tmp/mongodb-27017.sock
2020-02-15T15:31:37.005+0800 I  NETWORK  [listener] Listening on 127.0.0.1
2020-02-15T15:31:37.005+0800 I  NETWORK  [listener] waiting for connections on port 27017                                      #进程完成初始化。
2020-02-15T15:31:37.016+0800 I  INDEX    [LogicalSessionCacheRefresh] index build: done building index _id_ on ns config.system.sessions
2020-02-15T15:31:37.027+0800 I  INDEX    [LogicalSessionCacheRefresh] index build: starting on config.system.sessions properties: { v: 2, key: { lastUse: 1 }, name: "lsidTTLIndex", ns: "config.system.sessions", expireAfterSeconds: 1800 } using method: Hybrid
2020-02-15T15:31:37.028+0800 I  INDEX    [LogicalSessionCacheRefresh] build may temporarily use up to 200 megabytes of RAM
2020-02-15T15:31:37.028+0800 I  INDEX    [LogicalSessionCacheRefresh] index build: collection scan done. scanned 0 total records in 0 seconds
2020-02-15T15:31:37.028+0800 I  INDEX    [LogicalSessionCacheRefresh] index build: inserted 0 keys from external sorter into index in 0 seconds
2020-02-15T15:31:37.029+0800 I  INDEX    [LogicalSessionCacheRefresh] index build: done building index lsidTTLIndex on ns config.system.sessions
2020-02-15T15:31:37.029+0800 I  SHARDING [LogicalSessionCacheReap] Marking collection config.transactions as collection version: <unsharded>