• MongoDB Http Interface


    HTTP Interface

    REST Interfaces

    DrowsyDromedary (Ruby)

    DrowsyDromedary is a REST layer for MongoDB based on Ruby.

    MongoDB Rest (Node.js)

    MongoDB Rest is an alpha REST interface to MongoDB that uses the MongoDB Node Native driver.

    Mongodb Java REST server

    Mongodb Java REST server based on Jetty.

    HTTP Interfaces

    Sleepy Mongoose (Python)

    Sleepy Mongoose is a full featured HTTP interface for MongoDB.

    HTTP Console

    MongoDB provides a simple http interface listing information of interest to administrators. This interface may be accessed at the port with numeric value 1000 more than the configured mongod port. The default port for the http interface is 28017. To access the http interface an administrator may, for example, point a browser to http://localhost:28017 if mongod is running with the default port on the local machine.

    ../../_images/http-interface-console.png

    Here is a description of the informational elements of the http interface:

    element description
    db version database version information
    git hash database version developer tag
    sys info mongod compilation environment
    dblocked indicates whether the primary mongod mutex is held
    uptime time since this mongod instance was started
    assertions any software assertions that have been raised by this mongodinstance
    replInfo information about replication configuration
    currentOp most recent client request
    # databases number of databases that have been accessed by this mongodinstance
    curclient last database accessed by this mongod instance
    Cursors describes outstanding client cursors
    master whether this mongod instance has been designated a master
    slave whether this mongod instance has been designated a slave
    initialSyncCompleted whether this slave or repl pair node has completed an initial clone of the mongod instance it is replicating
    DBTOP Displays the total time the mongod instance has devoted to each listed collection, as well as the percentage of available time devoted to each listed collection recently and the number of reads, writes, and total calls made recently
    dt Timing information about the primary mongod mutex

    HTTP Console Security

    If security is configured for a mongod instance, authentication is required for a client to access the http interface from another machine.

    Simple REST Interface

    The mongod process includes a simple REST interface, with no support for insert/update/remove operations, as a convenience – it is generally used for monitoring/alerting scripts or administrative tasks. For full REST capabilities we recommend using an external tool such asSleepy.Mongoose.

    v1.4+: This interface is disabled by default. Use --rest on the command line to enable.

    To get the contents of a collection (note the trailing slash):

    http://127.0.0.1:28017/databaseName/collectionName/
    

    To add a limit:

    http://127.0.0.1:28017/databaseName/collectionName/?limit=-10
    

    To skip:

    http://127.0.0.1:28017/databaseName/collectionName/?skip=5
    

    To query for {a : 1}:

    http://127.0.0.1:28017/databaseName/collectionName/?filter_a=1
    

    Separate conditions with an &:

    http://127.0.0.1:28017/databaseName/collectionName/?filter_a=1&limit=-10
    

    Same as db.$cmd.findOne({listDatabase:1}) on the admin database in the shell:

    http://localhost:28017/admin/$cmd/?filter_listDatabases=1&limit=1
    

    To count documents in a collection:

    http://host:port/db/$cmd/?filter_count=collection&limit=1
    

    JSON in the simple REST interface

    The simple ReST interface uses strict JSON (as opposed to the shell, which uses Dates, regular expressions, etc.). To display non-JSON types, the web interface wraps them in objects and uses the key for the type. For example:

    # ObjectIds just become strings
    "_id" : "4a8acf6e7fbadc242de5b4f3"
    
    # dates
    "date" : { "$date" : 1250609897802 }
    
    # regular expressions
    "match" : { "$regex" : "foo", "$options" : "ig" }
    

    The code type has not been implemented yet and causes the DB to crash if you try to display it in the browser.

    See Mongo Extended JSON for details.

    Replica Set Admin UI

    The mongod process includes a simple administrative UI for checking the status of a replica set.

    To use, first enable --rest from the mongod command line. The rest port is the db port plus 1000 (thus, the default is 28017). Be sure this port is secure before enabling this.

    Then you can navigate to http://<hostname>:28017/ in your web browser. Once there, click Replica Set Status (/_replSet) to move to the Replica Set Status page.

    ../../_images/http-interface-rs.png

  • 相关阅读:
    php 无限极分类
    高德地图随笔
    安全随笔
    关于专线映射问题
    js小技巧总结
    php+ajax 文件上传
    去除数组中重复的元素
    关于ueditor插入不了动态地图
    vue.js 安装
    js轮播
  • 原文地址:https://www.cnblogs.com/grj001/p/12225451.html
Copyright © 2020-2023  润新知