Rocky Linux 9で稼働するMongoDBの起動と停止を行います。
記事の目次
MongoDBの起動状態を確認する!
MongoDBの起動状態を確認します。
$ sudo systemctl status mongod ● mongod.service - MongoDB Database Server Loaded: loaded (/usr/lib/systemd/system/mongod.service; enabled; vendor preset: disabled) Active: active (running) since Sun 2023-04-16 11:02:08 JST; 15h ago Docs: https://docs.mongodb.org/manual Main PID: 44101 (mongod) Memory: 209.9M CPU: 4min 22.441s CGroup: /system.slice/mongod.service └─44101 /usr/bin/mongod -f /etc/mongod.conf
MongoDBを停止する!
MongoDBを停止します。
$ sudo systemctl stop mongod $ sudo systemctl status mongod ○ mongod.service - MongoDB Database Server Loaded: loaded (/usr/lib/systemd/system/mongod.service; enabled; vendor preset: disabled) Active: inactive (dead) since Mon 2023-04-17 02:17:50 JST; 2s ago Duration: 15h 15min 41.377s Docs: https://docs.mongodb.org/manual Process: 44101 ExecStart=/usr/bin/mongod $OPTIONS (code=exited, status=0/SUCCESS) Main PID: 44101 (code=exited, status=0/SUCCESS) CPU: 4min 23.061s
MongoDBを起動する!
MongoDBを起動します。
$ sudo systemctl start mongod $ sudo systemctl status mongod ● mongod.service - MongoDB Database Server Loaded: loaded (/usr/lib/systemd/system/mongod.service; enabled; vendor preset: disabled) Active: active (running) since Mon 2023-04-17 02:19:44 JST; 2s ago Docs: https://docs.mongodb.org/manual Main PID: 319549 (mongod) Memory: 161.5M CPU: 666ms CGroup: /system.slice/mongod.service └─319549 /usr/bin/mongod -f /etc/mongod.conf
MongoDBを再起動する!
MongoDBを再起動します。
$ sudo systemctl restart mongod $ sudo systemctl status mongod ● mongod.service - MongoDB Database Server Loaded: loaded (/usr/lib/systemd/system/mongod.service; enabled; vendor preset: disabled) Active: active (running) since Mon 2023-04-17 02:21:37 JST; 2s ago Docs: https://docs.mongodb.org/manual Main PID: 320169 (mongod) Memory: 169.7M CPU: 701ms CGroup: /system.slice/mongod.service └─320169 /usr/bin/mongod -f /etc/mongod.conf
おわりに
Rocky Linux 9で稼働するMongoDBの起動と停止は、Systemdで行うことができます。
参考情報
関連記事
参考書籍(Amazon)