IMUZA.com

Xserver<<WordPress(ConoHa)<<はてなブログ

ホーム / Node.js / MongoDB 起動後の WARNING を消す

MongoDB 起動後の WARNING を消す

2018/01/12 Node.js, Windows

MongoDB 起動後の WARNING を消す

MongoDB を立ち上げてみましたら WARNING が出ます。消す方法です。

  • MongoDB を起動したら3つも WARNING が出た
    • mongo シェルで試してみる
  • Access control is not enabled for the database.
  • This server is bound to localhost.

MongoDB を起動したら3つも WARNING が出た

** WARNING: Access control is not enabled for the database.  
**          Read and write access to data and configuration is unrestricted.


** WARNING: This server is bound to localhost.
**          Remote systems will be unable to connect to this server.
**          Start the server with --bind_ip <address> to specify which IP
**          addresses it should serve responses from, or with --bind_ip_all to
**          bind to all interfaces. If this behavior is desired, start the
**          server with --bind_ip 127.0.0.1 to disable this warning.
 
** WARNING: The file system cache of this machine is configured to be greater than 40% of the total memory.  
**          This can lead to increased memory pressure and poor performance.
**          See http://dochub.mongodb.org/core/wt-windows-system-file-cache

mongo シェルで試してみる

クライアント側にも同じようにサーバの WARNING が表示されます。試しに、データベースを作成してデータを登録してみます。

問題ありませんね。

Access control is not enabled for the database.

でも、気になりますのでどういうことか調べてみました。

WARNING の意味は「データベースがアクセス制御なしで実行されているよ」ということだと思います。MongoDB の Documentation にそれらしきものがありましたので試してみました。

Enable Auth — MongoDB Manual 3.6

  1. まず MongoDB をアクセス制御なしで起動する

     >mongod --port 27017 --dbpath c:\mongodb\data
    
  2. mongoシェルから接続する

     >mongo --port 27017
    
  3. 管理者を作成する

     > use admin
     switched to db admin
     > db.createUser(
     {
     user: "myUserAdmin",
     pwd: "password",
     roles: [{role: "userAdminAnyDatabase", db: "admin"}]
     }
     )
     Successfully added user: {
             "user" : "myUserAdmin",
             "roles" : [
                     {
                             "role" : "userAdminAnyDatabase",
                             "db" : "admin"
                     }
             ]
     }
    
  4. mongoシェルを終了する

     > exit
     bye
    
  5. MongoDB をアクセス制御付きで再起動する

     >mongod --auth --port 27017 --dbpath c:\mongodb\data
    

おお!「WARNING: Access control is not enabled for the database.」が消えました。

This server is bound to localhost.

これはメッセージ通りにやれば消えそうです。

>mongod --auth --port 27017 --bind_ip 127.0.0.1 --dbpath c:\mongodb\data

やはり消えました!

で、後は「The file system cache of this machine is configured to be greater than 40% of the total memory.」なんですが、これがなかなか消えません。

今のところ成功していませんので、次回です。

Windows10/Shift+右クリックで「コマンドウィンドウをここで開く」を復活させる
Node.js から MongoDB への接続テスト
Twitter
Facebook
ブックマーク
LINEで送る

最初のサイドバー

最新記事

2023/01/26

WordPress:メニューのid,classを整理カスタマイズ

2023/01/19

WordPress:JSON-LD構造化データをプラグインなしで出力

2023/01/11

WordPress:OGPタグをプラグインなしで挿入する

2022/12/27

WordPress:canonicalタグをプラグインなしで制御する

2022/12/21

WordPress:robotsメタタグをプラグインなしで制御する

最新記事を一覧で見る

よく読まれている記事

よく読まれている記事を一覧で見る

カテゴリー

  • はてなブログ214
  • WebTips108
  • javascript98
  • Joomla!88
  • Windows68
  • CSS63
  • Wordpress59
  • Joomla!更新53
  • Linux49
  • はてなテーマ45
  • Plamo33
  • Google32
  • はてなプラグイン25
  • php22
  • Node.js18
  • Ubuntu16
  • SASS16
  • laravel415
  • Chrome11
  • cms-style10
  • iPhone9
  • genesis6
  • ConoHa WING6
  • Git入門6
  • Python5
  • Android5
  • スマートフォン4
  • PC全般4
  • 静的サイトジェネレーター3
  • Firefox3
  • SSD3
  • Facebook3
  • Blankslate3
  • Docker3
  • Mactype2
  • GitHub2
  • youtube1
  • rails入門1
  • Twitter1
  • はてなブクマ1
  • 映画1
  • Xserver1

Footer

My Web Sites

  • @半径とことこ60分
  • そんなには褒めないよ。映画評
  • IMUZA.com
  • GitHub

Related Sites

  • WordPress公式
  • WordPress関数リファレンス
  • PHPマニュアル

Contact Us

  • お問い合わせフォーム
  • Twitter
  • Facebook
  • Feedly

Copyright © 2023 · IMUZA.com