Windows 10 is installed on mongoDB

Reference from: https://www.jianshu.com/p/266167c4ed8b

MongoDB General Installation

  1. First, the official website ( https://www.mongodb.com/download-center#community) to download the appropriate installation package

    There are zip and msi installation package format is recommended to download zip format, msi actually is carried out under decompression only, and not to select the installation path during installation, installed by default to C: \ Program Files \ MongoDB directory, according to own system to select 32-bit or 64-bit

    I am a win10 computer systems 64, 64 of the download zip, unzip the download is complete H: \ MongoDB directory

  2. The H:\MongoDB\binpath is added to the environment variable

  3. Create a database directoryH:\MongoDB\data\db

    Create a database directory `H: \ MongoDB \ data \ logs

  4. Administrator cmd to open

  5. Create a database file storage location, you need to determine the location of the database file storage service startup mongodb

    --dbpath is designated database storage directory

    mongod --dbpath H:\MongoDB\data\db 

    This is the command line window will print some information to start, the last line of the display indicate when to start successfully the following information

    2018-06-04T08:36:34.330-0700 I CONTROL [initandlisten] MongoDB starting : pid=28828 port=27017 dbpath=H:\MongoDB\data\db 64-bit host=DESKTOP-96JC150

    This is entered in the browser http: // localhost: 27017 / you can see the browser displays information:

1528126769645.png

cmd display similar to the following:
1528126880934.png

  1. MongoDB installed as a Windows Service

    The mongodb installed as a windows service is very simple to just add --install command after the above row

    mongod --dbpath H:\MongoDB\data\db  --install 
  2. We need to specify the log directory, so we create a log directory H: \ MongoDB \ data \ logs and then re-execute the command to install MongoDB

    mongod --dbpath H:\MongoDB\data\db --logpath=H:\MongoDB\data\logs\mongodb.log --logappend --serviceName "MongoDB" --serviceDisplayName "MongoDB" --install
  3. MongoDB service started

    net start MongoDB
  4. About MongoDB profile

    Profiling directory H: \ MongoDB \ etc

    Profiling H: \ MongoDB \ etc \ mongodb.conf

    Configuration file as follows:

    dbpath=H:\MongoDB\data #数据库路径
    logpath=H:\MongoDB\data\logs\mongodb.log #日志输出文件路径
    logappend=true #错误日志采用追加模式,配置这个选项后mongodb的日志会追加到现有的日志文件,而不是从新创建一个新文件
    journal=true #启用日志文件,默认启用
    quiet=true #这个选项可以过滤掉一些无用的日志信息,若需要调试使用请设置为false
    port=27017 #端口号 默认为27017
    serviceName=MongoDB # 服务的名称
    serviceDisplayName=MongoDB  # 服务显示的名称

    Ordinary start

    mongod --config H:\MongoDB\etc\mongodb.conf

    Installed as a Windows service (MongoDB service is not installed)

    mongod --config H:\MongoDB\etc\mongodb.conf --install
  5. Start MongoDB service (it must be an administrator to change when you run the command)

    net start MongoDB

Service starts solutions unsuccessful (not the authority to determine the cause of the problem):

  1. Delete E: \ MongoDB \ data \ mongod.lock file (do not know why)

  2. Delete Service

    mongod --logpath "H:\mongodb\data\mongodb.log" --logappend --dbpath "H:\mongodb\data\db" --directoryperdb --serviceName "MongoDB" --serviceDisplayName "MongoDB" --remove
  3. re-install

    mongod --logpath "H:\mongodb\data\logs\mongodb.log" --logappend --dbpath "H:\mongodb\data\db" --directoryperdb --serviceName "MongoDB" --serviceDisplayName "MongoDB" --install
  4. Open a new terminal, enter mongo restart the service, if the following conditions, the installation is successful

    MongoDB shell version v3.6.5
    connecting to: mongodb://127.0.0.1:27017
    MongoDB server version: 3.6.5
    Server has startup warnings:
    2018-06-04T09:24:38.381-0700 I CONTROL [initandlisten]
    2018-06-04T09:24:38.381-0700 I CONTROL [initandlisten] ** WARNING: Access control is not enabled for the datab
    ase.
    2018-06-04T09:24:38.383-0700 I CONTROL [initandlisten] ** Read and write access to data and configura
    tion is unrestricted.
    2018-06-04T09:24:38.384-0700 I CONTROL [initandlisten]
    2018-06-04T09:24:38.385-0700 I CONTROL [initandlisten] ** WARNING: This server is bound to localhost.
    2018-06-04T09:24:38.386-0700 I CONTROL [initandlisten] ** Remote systems will be unable to connect to
    this server.
    2018-06-04T09:24:38.387-0700 I CONTROL [initandlisten] ** Start the server with --bind_ip

    t
    o specify which IP
    2018-06-04T09:24:38.388-0700 I CONTROL [initandlisten] ** addresses it should serve responses from, o
    r with --bind_ip_all to
    2018-06-04T09:24:38.389-0700 I CONTROL [initandlisten] ** bind to all interfaces. If this behavior is
    desired, start the
    2018-06-04T09:24:38.390-0700 I CONTROL [initandlisten] ** server with --bind_ip 127.0.0.1 to disable
    this warning.
    2018-06-04T09:24:38.391-0700 I CONTROL [initandlisten]
    2018-06-04T09:24:38.392-0700 I CONTROL [initandlisten]
    2018-06-04T09:24:38.397-0700 I CONTROL [initandlisten] ** WARNING: The file system cache of this machine is co
    nfigured to be greater than 40% of the total memory. This can lead to increased memory pressure and poor perfor
    mance.
    2018-06-04T09:24:38.398-0700 I CONTROL [initandlisten] See http://dochub.mongodb.org/core/wt-windows-system-fi
    le-cache
    2018-06-04T09:24:38.400-0700 I CONTROL [initandlisten]

Guess you like

Origin www.cnblogs.com/finlu/p/11757123.html