[Unit] Description=MongoDB document-oriented database After=network.target [Service] PIDFile=/var/run/mongod.pid ExecStart=/usr/local/mongodb/bin/mongod -f /etc/mongod.conf ExecStop=/bin/kill -INT $MAINPID [Install] WantedBy=multi-user.target
如果启动日志出现”WARNING: /sys/kernel/mm/transparent_hugepage/defrag is ‘always’.”
加入一行
ExecStartPre=echo never >> /sys/kernel/mm/transparent_hugepage/enabled && echo never >> /sys/kernel/mm/transparent_hugepage/defrag