zoukankan      html  css  js  c++  java
  • 配置MongoDB的Windows服务

    [1] 创建directorys和files

    Create a configuration file and a directory path for MongoDB log output (logpath):
     
    首先要手动新建Windows服务:
     
     
    创建日志文件的地址:
    md  "C:Program FilesMongoDBlog"
     
    在命令提示行,为logpath创建一个配置文件:
    echo logpath=C:Program FilesMongoDBlogmongo.log> "C:Program FilesMongoDBmongod.cfg" --install
    
    [2] 运行MongoDB service
     
     
    官方资料:
     
    1. Configure directories and files.
       Create a configuration file and a directory path for MongoDB log output (logpath):
        Create a specific directory for MongoDB log files:
    md "C:Program FilesMongoDBlog"
    In the Command Prompt, create a configuration file for the logpath option for MongoDB:
    echo logpath=C:Program FilesMongoDBlogmongo.log > "C:Program FilesMongoDBmongod.cfg"
    

    2. Run the MongoDB service.

    Run all of the following commands in Command Prompt with “Administrative Privileges:”
    Install the MongoDB service. For --install to succeed, you must specify the logpath run-time option.
    "C:Program FilesMongoDBinmongod.exe" --config "C:Program FilesMongoDBmongod.cfg" --install

    3. Stop or remove the MongoDB service as needed.

     

    To stop the MongoDB service use the following command:

    net stop MongoDB

    To remove the MongoDB service use the following command:

    "C:Program FilesMongoDBinmongod.exe" --remove
     
     【官方资料】
    Manually Create a Windows Service for MongoDB
     

    The following procedure assumes you have installed MongoDB using the MSI installer, with the default path C:Program FilesMongoDB 2.6 Standard.

    If you have installed in an alternative directory, you will need to adjust the paths as appropriate.

    1

    Open an Administrator command prompt.

    Windows 7 / Vista / Server 2008 (and R2)

    Press Win + R, then type cmd, then press Ctrl + Shift + Enter.

    Windows 8

    Press Win + X, then press A.

    Execute the remaining steps from the Administrator command prompt.

    2

    Create directories.

    Create directories for your database and log files:

    mkdir c:datadb
    mkdir c:datalog
    
    3

    Create a configuration file.

    Create a configuration file. This file can include any of the configuration options for mongod, butmust include a valid setting for logpath:

    The following creates a configuration file, specifying both the logpath and the dbpath settings in the configuration file:

    echo logpath=c:datalogmongod.log> "C:Program FilesMongoDB 2.6 Standardmongod.cfg"
    echo dbpath=c:datadb>> "C:Program FilesMongoDB 2.6 Standardmongod.cfg"
    
    4

    Create the MongoDB service.

    Create the MongoDB service.

    sc.exe create MongoDB binPath= ""C:Program FilesMongoDB 2.6 Standardinmongod.exe" --service --config="C:Program FilesMongoDB 2.6 Standardmongod.cfg"" DisplayName= "MongoDB 2.6 Standard" start= "auto"
    

    sc.exe requires a space between “=” and the configuration values (eg “binPath= ”), and a “” to escape double quotes.

    If successfully created, the following log message will display:

    [SC] CreateService SUCCESS
    5

    Start the MongoDB service.

    net start MongoDB
    6

    Stop or remove the MongoDB service as needed.

    To stop the MongoDB service, use the following command:

    net stop MongoDB

    To remove the MongoDB service, first stop the service and then run the following command:

    sc.exe delete MongoDB
     
     
     
     
     
     
     
     
     
     
     
  • 相关阅读:
    腾讯QQ家族任意支付QB+修改资料csrf
    腾讯QQ积分CSRF导致积分任意挥霍(我的积分为什么少了)
    腾讯大湘网某处csrf(city.hn.qq.com)可投诉刷留言
    路由器下再连接一台路由器
    PHP安全之临时文件的安全
    通过NAT转发实现私网对外发布信息
    asp adodb.stream读取文件和写文件
    解决:ADODB.Stream 错误 '800a0bbc' 写入文件失败
    笑话一则
    spring-boot-2.0.3源码篇
  • 原文地址:https://www.cnblogs.com/yedushusheng/p/4333949.html
Copyright © 2011-2022 走看看