MongoDB开机启动脚本-systemd

[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

发表评论

您的邮箱地址不会被公开。 必填项已用 * 标注