知识库

如何从 Cypher 生成 sysinfo 输出

如果您需要从 Neo4j 浏览器中运行的命令 :sysinfo 生成等效输出,可以在 http://localhost:7474 运行以下 Cypher

call dbms.queryJmx("org.neo4j:instance=kernel#0,name=Store file sizes") yield attributes
       with  keys(attributes) as k , attributes
       unwind k as row
       return "StoreSizes" as type,row,attributes[row]["value"]

union all

call dbms.queryJmx("org.neo4j:instance=kernel#0,name=Page cache") yield attributes
       with  keys(attributes) as k , attributes
       unwind k as row
       return "PageCache" as type,row,attributes[row]["value"]

union all

call dbms.queryJmx("org.neo4j:instance=kernel#0,name=Primitive count") yield attributes
       with  keys(attributes) as k , attributes
       unwind k as row
       return "ID Allocations" as type,row,attributes[row]["value"]

union all

call dbms.queryJmx("org.neo4j:instance=kernel#0,name=Transactions") yield attributes
       with  keys(attributes) as k , attributes
       unwind k as row
       return "Transactions" as type,row,attributes[row]["value"]

union all

call dbms.queryJmx("org.neo4j:instance=kernel#0,name=High Availability") yield attributes
       with  keys(attributes) as k , attributes
       unwind k as row
       return "High Availability" as type,row,attributes[row]["value"]

union all

call dbms.queryJmx("org.neo4j:instance=kernel#0,name=Causal Clustering") yield attributes
       with  keys(attributes) as k , attributes
       unwind k as row
       return "Causal Cluster" as type,row,attributes[row]["value"];

这将生成类似于以下的输出

+------------------------------------------------------------------------------------+
| type             | row                                  | attributes[row]["value"] |
+------------------------------------------------------------------------------------+
| "StoreSizes"     | "LogicalLogSize"                     | 90                       |
| "StoreSizes"     | "StringStoreSize"                    | 8192                     |
| "StoreSizes"     | "ArrayStoreSize"                     | 8192                     |
| "StoreSizes"     | "RelationshipStoreSize"              | 0                        |
| "StoreSizes"     | "PropertyStoreSize"                  | 0                        |
| "StoreSizes"     | "TotalStoreSize"                     | 139579                   |
| "StoreSizes"     | "NodeStoreSize"                      | 0                        |
| "PageCache"      | "Faults"                             | 62                       |
| "PageCache"      | "EvictionExceptions"                 | 0                        |
| "PageCache"      | "BytesWritten"                       | 196598                   |
| "PageCache"      | "Flushes"                            | 20                       |
| "PageCache"      | "Evictions"                          | 0                        |
| "PageCache"      | "FileUnmappings"                     | 76                       |
| "PageCache"      | "BytesRead"                          | 327650                   |
| "PageCache"      | "Pins"                               | 126                      |
| "PageCache"      | "FileMappings"                       | 93                       |
...