Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

[MongoDB Learning Note 10] startup and shutdown of MongoDB

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

1. MongoDB start

MongoDB is started with the mongod command, not recommended

Service mongod start

Or

Chkconfig mongod on

To start MongoDB, because mongod needs to be started with parameters every time, otherwise it will cause an error

It is recommended that after setting up the configuration file / etc/mongod.conf first, start with the command every time.

Mongod-f / etc/mongod.conf

Or set the boot restart.

Echo "mongod-f / etc/mongod.conf" > > / etc/rc.d/rc.local

Introduction to the options commonly used in / etc/mongod.conf:

-- dbpath: specify the data directory, which is required. Error reporting will be started if it is not configured.

-- port: specifies the port on which the service listens. Default is 27017.

-- logpath: specify the log path

-- logappend: specifies that the log is in append mode, or cleans up the log every time MongoDB is restarted. The default is append mode.

-- fork: create a child process with this option, and run MongoDB; in the background. This option must first enable the logpath option.

-- bind_ip: specifies the interface for listening; default is 127.0.0.1

-- httpinterface: sets whether to start a mini HTTP server on port 1000; it is disabled by default

-- nounixsocket: sets whether to use UNIX socket

-- noscripting: sets whether to completely disable server-side JavaScript scripts

II. Shutdown of MongoDB

Force MongoDB shutdown (not recommended)

Service mongod stop

Alternatively, turn it off from MongoDB's admin (recommended):

> use admin switched to db admin > db.shutdownServer () server should be down...

Or

Mongod-shutdown

Use shutdownServer to shut down MongoDB, and if there is a MongoDB master-slave server, synchronize the master-slave server before the service is shut down; forced shutdown will not

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report