ยง 2024-05-18

ysadmin@yushei-dtk-server:~$ mongostat --host ys20220318/redisMongo03.yushei.com.tw:27017 --username siteRootAdmin --password b23258585 --authenticationDatabase admin --discover

redisMongo03.yushei.com.tw:27017     *0     1     *0     *0       3     4|0  0.2% 65.4%       0 6.52G 3.85G 0|0 0|0  6.17k   59.6k   60 ys20220318  SLV May 18 08:19:44.318
redisMongo04.yushei.com.tw:27017     *0    *0     *0     *0       0     1|0  0.1% 79.5%       0 4.70G 2.89G 0|0 0|0   263b   54.2k   24 ys20220318  SEC May 18 08:19:44.333
redisMongo05.yushei.com.tw:27017     *0    *0     *0     *0       0     2|0  0.3% 69.2%       0 4.05G 2.40G 0|0 0|0   849b   61.7k   23 ys20220318  SEC May 18 08:19:44.347

```

    Host:
        The hostname and port of the MongoDB instance being monitored (redisMongo03.yushei.com.tw:27017, etc.).

    insert:
        Number of insert operations per second (*0, *0, *0).

    query:
        Number of query operations per second (1, *0, *0).

    update:
        Number of update operations per second (*0, *0, *0).

    delete:
        Number of delete operations per second (*0, *0, *0).

    getmore:
        Number of getmore operations per second (used to fetch more results from cursor queries) (3, 0, 0).

    command:
        Number of command operations per second (general database commands) (4|0, 1|0, 2|0).

    % dirty:
        Percentage of dirty data in the cache (0.2%, 0.1%, 0.3%).

    % used:
        Percentage of the cache that is being used (65.4%, 79.5%, 69.2%).

    flushes:
        Number of flushes to disk per second (0, 0, 0).

    vsize:
        Virtual memory usage (6.52G, 4.70G, 4.05G).

    res:
        Resident memory usage (3.85G, 2.89G, 2.40G).

    qr|qw:
        Queue lengths for clients waiting for read and write operations (0|0, 0|0, 0|0).

    ar|aw:
        Active clients performing read and write operations (0|0, 0|0, 0|0).

    netIn:
        Network traffic in (amount of data received per second) (6.17k, 263b, 849b).

    netOut:
        Network traffic out (amount of data sent per second) (59.6k, 54.2k, 61.7k).

    conn:
        Number of active connections to the database (60, 24, 23).

    time:
        The timestamp of the report (May 18 08:19:44.318, May 18 08:19:44.333, May 18 08:19:44.347).

    repl:
        Replication status:
            SLV: Slave (Secondary node).
            SEC: Secondary node.

Interpreting the Data:

    Operation Metrics: The insert, query, update, delete, getmore, and command columns show the rate of operations. A *0 means that the operation is occurring less frequently than the sampling interval can detect.
    Memory Usage: vsize and res columns indicate virtual and resident memory usage. These values are important for understanding how much memory the MongoDB instance is consuming.
    Cache Usage: The % dirty and % used columns provide insights into the cache's state. High dirty percentages can indicate that a lot of data needs to be written to disk.
    Network Traffic: netIn and netOut show the network activity, which can indicate how much data is being received and sent by the MongoDB instance.
    Connections and Clients: The conn column shows the number of active connections. High values here might suggest heavy usage or potential connection pooling issues.
    Replication Status: The repl column shows the role of each member in the replica set (secondary nodes in this case).

By regularly monitoring these metrics, you can get a good sense of your MongoDB replica set's health and performance, allowing you to identify and address any issues promptly.