System Information

CrateDB provides the sys schema which contains virtual tables. These tables are read-only and can be queried to get statistical real-time information about the cluster, its nodes and their shards:

Table of Contents

Cluster

Basic information about the CrateDB cluster can be retrieved from the sys.cluster table:

NameDescriptionReturn Type
idA unique ID generated by the system.STRING
licenseThe current CrateDB license information.OBJECT
nameThe cluster name.STRING
master_nodeNode ID of the node which currently operates as masterSTRING
settingsThe cluster settings.OBJECT

The result has at most 1 row:

  1. cr> select name from sys.cluster;
  2. +--------------+
  3. | name |
  4. +--------------+
  5. | Testing... |
  6. +--------------+
  7. SELECT 1 row in set (... sec)

Cluster License

The sys.cluster.license expression returns information about the currently registered license.

license

Column NameDescriptionReturn Type
licenseThe current CrateDB license information or NULL on CrateDB CE.OBJECT
license[‘expiry_date’]The timestamp on which the license expires.TIMESTAMP
license[‘issued_to’]The organisation for which the license is issued.STRING
license[‘max_nodes’]The maximum number of nodes the license is valid for.INTEGER

Cluster Settings

The sys.cluster.settings expression returns information about the currently applied cluster settings.

  1. cr> select settings from sys.cluster;
  2. +-----------------------------------------------------------------------------------------------------------------------------------------------------...-+
  3. | settings |
  4. +-----------------------------------------------------------------------------------------------------------------------------------------------------...-+
  5. | {"bulk": {...}, "cluster": {...}, "discovery": {...}, "gateway": {...}, "indices": {...}, "license": {...}, "logger": [], "stats": {...}, "udc": {...}} |
  6. +-----------------------------------------------------------------------------------------------------------------------------------------------------...-+
  7. SELECT 1 row in set (... sec)
  1. cr> select column_name, data_type from information_schema.columns
  2. ... where column_name like 'settings%'
  3. ... and table_name = 'cluster';
  4. +-----------------------------------------------------------------------------------+--------------+
  5. | column_name | data_type |
  6. +-----------------------------------------------------------------------------------+--------------+
  7. | settings | object |
  8. | settings['bulk'] | object |
  9. | settings['bulk']['request_timeout'] | string |
  10. | settings['cluster'] | object |
  11. | settings['cluster']['graceful_stop'] | object |
  12. | settings['cluster']['graceful_stop']['force'] | boolean |
  13. | settings['cluster']['graceful_stop']['min_availability'] | string |
  14. | settings['cluster']['graceful_stop']['reallocate'] | boolean |
  15. | settings['cluster']['graceful_stop']['timeout'] | string |
  16. | settings['cluster']['info'] | object |
  17. | settings['cluster']['info']['update'] | object |
  18. | settings['cluster']['info']['update']['interval'] | string |
  19. | settings['cluster']['routing'] | object |
  20. | settings['cluster']['routing']['allocation'] | object |
  21. | settings['cluster']['routing']['allocation']['allow_rebalance'] | string |
  22. | settings['cluster']['routing']['allocation']['balance'] | object |
  23. | settings['cluster']['routing']['allocation']['balance']['index'] | float |
  24. | settings['cluster']['routing']['allocation']['balance']['shard'] | float |
  25. | settings['cluster']['routing']['allocation']['balance']['threshold'] | float |
  26. | settings['cluster']['routing']['allocation']['cluster_concurrent_rebalance'] | integer |
  27. | settings['cluster']['routing']['allocation']['disk'] | object |
  28. | settings['cluster']['routing']['allocation']['disk']['threshold_enabled'] | boolean |
  29. | settings['cluster']['routing']['allocation']['disk']['watermark'] | object |
  30. | settings['cluster']['routing']['allocation']['disk']['watermark']['flood_stage'] | string |
  31. | settings['cluster']['routing']['allocation']['disk']['watermark']['high'] | string |
  32. | settings['cluster']['routing']['allocation']['disk']['watermark']['low'] | string |
  33. | settings['cluster']['routing']['allocation']['enable'] | string |
  34. | settings['cluster']['routing']['allocation']['exclude'] | object |
  35. | settings['cluster']['routing']['allocation']['exclude']['_host'] | string |
  36. | settings['cluster']['routing']['allocation']['exclude']['_id'] | string |
  37. | settings['cluster']['routing']['allocation']['exclude']['_ip'] | string |
  38. | settings['cluster']['routing']['allocation']['exclude']['_name'] | string |
  39. | settings['cluster']['routing']['allocation']['include'] | object |
  40. | settings['cluster']['routing']['allocation']['include']['_host'] | string |
  41. | settings['cluster']['routing']['allocation']['include']['_id'] | string |
  42. | settings['cluster']['routing']['allocation']['include']['_ip'] | string |
  43. | settings['cluster']['routing']['allocation']['include']['_name'] | string |
  44. | settings['cluster']['routing']['allocation']['node_concurrent_recoveries'] | integer |
  45. | settings['cluster']['routing']['allocation']['node_initial_primaries_recoveries'] | integer |
  46. | settings['cluster']['routing']['allocation']['require'] | object |
  47. | settings['cluster']['routing']['allocation']['require']['_host'] | string |
  48. | settings['cluster']['routing']['allocation']['require']['_id'] | string |
  49. | settings['cluster']['routing']['allocation']['require']['_ip'] | string |
  50. | settings['cluster']['routing']['allocation']['require']['_name'] | string |
  51. | settings['cluster']['routing']['rebalance'] | object |
  52. | settings['cluster']['routing']['rebalance']['enable'] | string |
  53. | settings['discovery'] | object |
  54. | settings['discovery']['zen'] | object |
  55. | settings['discovery']['zen']['minimum_master_nodes'] | integer |
  56. | settings['discovery']['zen']['ping_timeout'] | string |
  57. | settings['discovery']['zen']['publish_timeout'] | string |
  58. | settings['gateway'] | object |
  59. | settings['gateway']['expected_nodes'] | integer |
  60. | settings['gateway']['recover_after_nodes'] | integer |
  61. | settings['gateway']['recover_after_time'] | string |
  62. | settings['indices'] | object |
  63. | settings['indices']['breaker'] | object |
  64. | settings['indices']['breaker']['fielddata'] | object |
  65. | settings['indices']['breaker']['fielddata']['limit'] | string |
  66. | settings['indices']['breaker']['fielddata']['overhead'] | double |
  67. | settings['indices']['breaker']['query'] | object |
  68. | settings['indices']['breaker']['query']['limit'] | string |
  69. | settings['indices']['breaker']['query']['overhead'] | double |
  70. | settings['indices']['breaker']['request'] | object |
  71. | settings['indices']['breaker']['request']['limit'] | string |
  72. | settings['indices']['breaker']['request']['overhead'] | double |
  73. | settings['indices']['recovery'] | object |
  74. | settings['indices']['recovery']['internal_action_long_timeout'] | string |
  75. | settings['indices']['recovery']['internal_action_timeout'] | string |
  76. | settings['indices']['recovery']['max_bytes_per_sec'] | string |
  77. | settings['indices']['recovery']['recovery_activity_timeout'] | string |
  78. | settings['indices']['recovery']['retry_delay_network'] | string |
  79. | settings['indices']['recovery']['retry_delay_state_sync'] | string |
  80. | settings['license'] | object |
  81. | settings['license']['enterprise'] | boolean |
  82. | settings['license']['ident'] | string |
  83. | settings['logger'] | object_array |
  84. | settings['logger']['level'] | string |
  85. | settings['logger']['name'] | string |
  86. | settings['stats'] | object |
  87. | settings['stats']['breaker'] | object |
  88. | settings['stats']['breaker']['log'] | object |
  89. | settings['stats']['breaker']['log']['jobs'] | object |
  90. | settings['stats']['breaker']['log']['jobs']['limit'] | string |
  91. | settings['stats']['breaker']['log']['jobs']['overhead'] | double |
  92. | settings['stats']['breaker']['log']['operations'] | object |
  93. | settings['stats']['breaker']['log']['operations']['limit'] | string |
  94. | settings['stats']['breaker']['log']['operations']['overhead'] | double |
  95. | settings['stats']['enabled'] | boolean |
  96. | settings['stats']['jobs_log_expiration'] | string |
  97. | settings['stats']['jobs_log_filter'] | string |
  98. | settings['stats']['jobs_log_persistent_filter'] | string |
  99. | settings['stats']['jobs_log_size'] | integer |
  100. | settings['stats']['operations_log_expiration'] | string |
  101. | settings['stats']['operations_log_size'] | integer |
  102. | settings['stats']['service'] | object |
  103. | settings['stats']['service']['interval'] | string |
  104. | settings['udc'] | object |
  105. | settings['udc']['enabled'] | boolean |
  106. | settings['udc']['initial_delay'] | string |
  107. | settings['udc']['interval'] | string |
  108. | settings['udc']['url'] | string |
  109. +-----------------------------------------------------------------------------------+--------------+
  110. SELECT ... rows in set (... sec)

For further details, see the Cluster Settings configuration section.

Nodes

To get information about the nodes query for sys.nodes.

This table can be queried for one, multiple or all nodes within a cluster.

The table schema is as follows:

id

Column NameDescriptionReturn Type
idA unique ID within the cluster generated by the system.STRING

name

Column NameDescriptionReturn Type
nameThe node name within a cluster. The system will choose a random name. You can specify the node name via your own custom configuration.STRING

hostname

Column NameDescriptionReturn Type
hostnameThe specified host name of the machine the node is running on.STRING

rest_url

Column NameDescriptionReturn Type
rest_urlFull http(s) address where the REST API of the node is exposed, including schema, hostname (or IP) and port.STRING

port

Column NameDescriptionReturn Type
portThe specified ports for both HTTP and binary transport interfaces. You can specify the ports via your own custom configuration.OBJECT
port[‘http’]CrateDB’s HTTP port.INTEGER
port[‘transport’]CrateDB’s binary transport port.INTEGER
port[‘psql’]The PostgreSQL wire protocol port.INTEGER

load

Column NameDescriptionReturn Type
loadSystem load statisticsOBJECT
load[‘1’]Average load over the last 1 minute.DOUBLE
load[‘5’]Average load over the last 5 minutes.DOUBLE
load[‘15’]Average load over the last 15 minutes.DOUBLE
load[‘probe_timestamp’]Unix timestamp at the time of collection of the load probe.LONG

mem

Column NameDescriptionReturn Type
memMemory utilization statistics of the host.OBJECT
mem[‘used’]Currently used memory in bytes.LONG
mem[‘used_percent’]Currently used memory in percent of total.SHORT
mem[‘free’]Currently available memory in bytes.LONG
mem[‘free_percent’]Currently available memory in percent of total.SHORT
mem[‘probe_timestamp’]Unix timestamp at the time of collection of the memory probe.LONG

heap

Column NameDescriptionReturn Type
heapHeap memory utilization statistics.OBJECT
heap[‘used’]Currently used heap memory in bytes.LONG
heap[‘max’]Maximum available heap memory. You can specify the max heap memory CrateDB should use in the configuration.LONG
heap[‘free’]Currently available heap memory in bytes.LONG
heap[‘probe_timestamp’]Unix timestamp at the time of collection of the heap probe.LONG

version

Column NameDescriptionReturn Type
versionCrateDB version information.OBJECT
version[‘number’]Version string in format “major.minor.hotfix”STRING
version[‘build_hash’]SHA hash of the Github commit which this build was built from.STRING
version[‘build_snapshot’]Indicates whether this build is a snapshot build.BOOLEAN

cluster_state_version

Column NameDescriptionReturn Type
cluster_state_versionThe current version of the cluster state. The cluster state is an immutable structure and that is recreated when a change is published.LONG

fs

Column NameDescriptionReturn Type
fsUtilization statistics about the file system.OBJECT
fs[‘total’]Aggregated usage statistic of all disks on the host.OBJECT
fs[‘total’][‘size’]Total size of all disks in bytes.LONG
fs[‘total’][‘used’]Total used space of all disks in bytes.LONG
fs[‘total’][‘available’]Total available space of all disks in bytes.LONG
fs[‘total’][‘reads’]Total number of reads on all disks.LONG
fs[‘total’][‘bytes_read’]Total size of reads on all disks in bytes.LONG
fs[‘total’][‘writes’]Total number of writes on all disks.LONG
fs[‘total’][‘bytes_written’]Total size of writes on all disks in bytes.LONG
fs[‘disks’]Usage statistics of individual disks on the host.ARRAY
fs[‘disks’][‘dev’]Device nameSTRING
fs[‘disks’][‘size’]Total size of the disk in bytes.LONG
fs[‘disks’][‘used’]Used space of the disk in bytes.LONG
fs[‘disks’][‘available’]Available space of the disk in bytes.LONG
fs[‘disks’][‘reads’]

Number of reads on the disk.

DEPRECATED: always returns -1

LONG
fs[‘disks’][‘bytes_read’]

Total size of reads on the disk in bytes.

DEPRECATED: always returns -1

LONG
fs[‘disks’][‘writes’]

Number of writes on the disk.

DEPRECATED: always returns -1

LONG
fs[‘disks’][‘bytes_written’]

Total size of writes on the disk in bytes.

DEPRECATED: always returns -1

LONG
fs[‘data’]Information about data paths used by the node.ARRAY
fs[‘data’][‘dev’]Device nameSTRING
fs[‘data’][‘path’]File path where the data of the node resides.STRING

thread_pools

Column NameDescriptionReturn Type
thread_poolsUsage statistics of Java thread pools.ARRAY
thread_pools[‘name’]Name of the pool.STRING
thread_pools[‘active’]Number of currently running thread in the thread pool.INTEGER
thread_pools[‘rejected’]Total number of rejected threads in the thread pool.LONG
thread_pools[‘largest’]Largest number of threads that have ever simultaniously been in the pool.INTEGER
thread_pools[‘completed’]Total number of completed thread in teh thread pool.LONG
thread_pools[‘threads’]Size of the thread pool.INTEGER
thread_pools[‘queue’]Number of thread currently in the queue.INTEGER

os

Column NameDescriptionReturn Type
osOperating system statsOBJECT
os[‘uptime’]

System uptime in milliseconds

Requires allowing system calls on Windows and macOS. See notes in Uptime Limitations.

LONG
os[‘timestamp’]UNIX timestamp in millisecond resolutionLONG
os[‘cpu’]Information about CPU utilizationOBJECT
os[‘cpu’][‘used’]System CPU usage as percentageSHORT
os[‘cpu’][‘system’]

CPU time used by the system

DEPRECATED: always returns -1

SHORT
os[‘cpu’][‘user’]

CPU time used by applications

DEPRECATED: always returns -1

SHORT
os[‘cpu’][‘idle’]

Idle CPU time

DEPRECATED: always returns -1

SHORT
os[‘cpu’][‘stolen’]

The amount of CPU ‘stolen’ from this virtual machine by the hypervisor for other tasks.

DEPRECATED: always returns -1

SHORT
os[‘probe_timestamp’]Unix timestamp at the time of collection of the OS probe.LONG
os[‘cgroup’]Information about Cgroups (Linux only)OBJECT
os[‘cgroup’][‘cpuacct’]Information about CPU accountingOBJECT
os[‘cgroup’][‘cpuacct’][‘control_group’]The path to the cpu accounting cgroupSTRING
os[‘cgroup’][‘cpuacct’][‘usage_nanos’]The total CPU time (in nanoseconds) consumed by all tasks in this cgroup.LONG
os[‘cgroup’][‘cpu’]Information about the CPU subsystemOBJECT
os[‘cgroup’][‘cpu’][‘control_group’]The path to the cpu cgroupSTRING
os[‘cgroup’][‘cpu’][‘cfs_period_micros’]The period of time (in microseconds) the cgroup access to the CPU gets reallocated.LONG
os[‘cgroup’][‘cpu’][‘cfs_quota_micros’]The total amount of time (in microseconds) for which all tasks in the cgroup can run during one period (cfs_period_micros).LONG
os[‘cgroup’][‘cpu’][‘num_elapsed_periods’]The nr. of period intervals (cfs_period_micros) that have elapsed.LONG
os[‘cgroup’][‘cpu’][‘num_times_throttled’]The nr. of times tasks in the cgroup have been throttled.LONG
os[‘cgroup’][‘cpu’][‘time_throttled_nanos’]The total time (in nanoseconds) for which tasks in the cgroup have been throttled.LONG
os[‘cgroup’][‘mem’]Information about memory resources used by tasks in a cgroup.OBJECT
os[‘cgroup’][‘mem’][‘control_group’]The path to the memory cgroupSTRING
os[‘cgroup’][‘mem’][‘usage_bytes’]The total current memory usage by processes in the cgroup.STRING
os[‘cgroup’][‘mem’][‘limit_bytes’]The max. amount of user memory in the cgroup.STRING

The cpu information values are cached for 1s. They might differ from the actual values at query time. Use the probe timestamp to get the time of collection. When analyzing the cpu usage over time, always use os['probe_timestamp'] to calculate the time difference between 2 probes.

Cgroup Limitations

Note

Cgroup metrics only work if the stats are available from /sys/fs/cgroup/cpu and /sys/fs/cgroup/cpuacct.

Uptime Limitations

Note

os[‘uptime’] required a system call when running CrateDB on Windows or macOS, however, system calls are not permitted by default. If you require this metric you need to allow system calls by setting bootstrap.seccomp to false. This setting must be set in the crate.yml or via command line argument and cannot be changed at runtime.

os_info

Column NameDescriptionReturn Type
os_infoOperating system informationOBJECT
os_info[‘available_processors’]Number of processors that are available in the JVM. This is usually equal to the number of cores of the CPU.INTEGER
os_info[‘name’]Name of the operating system (ex: Linux, Windows, macOS)STRING
os_info[‘arch’]Name of the JVM architecture (ex: amd64, x86)STRING
os_info[‘version’]Version of the operating systemSTRING
os_info[‘jvm’]Information about the JVM (Java Virtual Machine)OBJECT
os_info[‘jvm’][‘version’]The JVM versionSTRING
os_info[‘jvm’][‘vm_name’]The name of the JVM (eg. OpenJDK, Java Hotspot(TM) )STRING
os_info[‘jvm’][‘vm_vendor’]The vendor name of the JVMSTRING
os_info[‘jvm’][‘vm_version’]The version of the JVMSTRING

network

Network statistics are deprecated in CrateDB 2.3 and may completely be removed in subsequent versions. All LONG columns always return 0.

Column NameDescriptionReturn Type
networkStatistics about network activity on the host.OBJECT
network[‘probe_timestamp’]Unix timestamp at the time of collection of the network probe.LONG
network[‘tcp’]TCP network activity on the host.OBJECT
network[‘tcp’][‘connections’]Information about TCP network connections.OBJECT
network[‘tpc’][‘connections’][‘initiated’]Total number of initiated TCP connections.LONG
network[‘tpc’][‘connections’][‘accepted’]Total number of accepted TCP connections.LONG
network[‘tpc’][‘connections’][‘curr_established’]Total number of currently established TCP connections.LONG
network[‘tcp’][‘connections’][‘dropped’]Total number of dropped TCP connections.LONG
network[‘tcp’][‘connections’][‘embryonic_dropped’]Total number of TCP connections that have been dropped before they were accepted.LONG
network[‘tcp’][‘packets’]Information about TCP packets.OBJECT
network[‘tpc’][‘packets’][‘sent’]Total number of TCP packets sent.LONG
network[‘tcp’][‘packets’][‘received’]Total number of TCP packets received.LONG
network[‘tpc’][‘packets’][‘retransmitted’]Total number of TCP packets retransmitted due to an error.LONG
network[‘tcp’][‘packets’][‘errors_received’]Total number of TCP packets that contained checksum errors, had a bad offset, were dropped because of a lack of memory or were too short.LONG
network[‘tcp’]][‘packets’][‘rst_sent’]Total number of RST packets sent due to left unread data in queue when socket is closed. See tools.ietf.org.LONG

connections

Column NameDescriptionReturn Type
httpNumber of connections established via HTTPOBJECT
http[‘open’]The currently open connections established via HTTPLONG
http[‘total’]The total number of connections that have been established via HTTP over the life time of a CrateDB nodeLONG
psqlNumber of connections established via Postgres protocolOBJECT
psql[‘open’]The currently open connections established via Postgres protocolLONG
psql[‘total’]The total number of connections that have been established via Postgres protocol over the life time of a CrateDB nodeLONG
transportNumber of connections established via Transport protocolOBJECT
transport[‘open’]The currently open connections established via Transport protocolLONG

process

Column NameDescriptionReturn Type
processStatistics about the CrateDB process.OBJECT
process[‘open_file_descriptors’]Number of currently open file descriptors used by the CrateDB process.LONG
process[‘max_open_file_descriptors’]The maximum number of open file descriptors CrateDB can use.LONG
process[‘probe_timestamp’]The system UNIX timestamp at the moment of the probe collection.LONG
process[‘cpu’]Information about the CPU usage of the CrateDB process.OBJECT
process[‘cpu’][‘percent’]The CPU usage of the CrateDB JVM process given in percent.SHORT
process[‘cpu’][‘user’]

The process CPU user time in milliseconds.

DEPRECATED: always returns -1

LONG
process[‘cpu’][‘system’]

The process CPU kernel time in milliseconds.

DEPRECATED: always returns -1

LONG

The cpu information values are cached for 1s. They might differ from the actual values at query time. Use the probe timestamp to get the time of the collect. When analyzing the cpu usage over time, always use process['probe_timestamp'] to calculate the time difference between 2 probes.

Note

If one of the queried nodes is not responding within three seconds it returns null every column except id and name. This behaviour could be used to detect hanging nodes.

Node Checks

The table sys.node_checks exposes a list of internal node checks and results of their validation.

The table schema is the following:

Column NameDescriptionReturn Type
idThe unique check ID.INTEGER
node_idThe unique node ID.STRING
severityThe level of severity. The higher the value of the field the higher severity.INTEGER
descriptionThe description message for the setting check.STRING
passedThe flag determines whether the check for the setting has passed.BOOLEAN
acknowledgedThe flag determines whether the check for this setting has been acknowledged by the user in order to ignored the value of passed column. This column can be updated.BOOLEAN

Example query:

  1. cr> select id, node_id, description from sys.node_checks order by id, node_id;
  2. +----+---------...-+--------------------------------------------------------------...-+
  3. | id | node_id | description |
  4. +----+---------...-+--------------------------------------------------------------...-+
  5. | 1 | ... | The value of the cluster setting 'gateway.expected_nodes' mus... |
  6. | 2 | ... | The value of the cluster setting 'gateway.recover_after_nodes... |
  7. | 3 | ... | If any of the "expected nodes" recovery settings are set, the... |
  8. | 5 | ... | The high disk watermark is exceeded on the node. The cluster ... |
  9. | 6 | ... | The low disk watermark is exceeded on the node. The cluster w... |
  10. | 7 | ... | The flood stage disk watermark is exceeded on the node. Table... |
  11. | 8 | ... | The JVM version with which CrateDB is running should be >= 11... |
  12. +----+---------...-+--------------------------------------------------------------...-+
  13. SELECT 7 rows in set (... sec)

Acknowledge Failed Checks

It is possible to acknowledge every check by updating the acknowledged column. By doing this, specially CrateDB’s built-in Admin-UI won’t complain anymore about failing checks.

Imagine we’ve added a new node to our cluster, but as the gateway.expected_nodes column can only be set via config-file or command-line argument, the check for this setting will not pass on the already running nodes until the config-file or command-line argument on these nodes is updated and the nodes are restarted (which is not what we want on a healthy well running cluster).

In order to make the Admin-UI accept a failing check (so the checks label goes green again), we must acknowledge this check by updating it’s acknowledged flag:

  1. cr> update sys.node_checks set acknowledged = true where id = 1;
  2. UPDATE OK, 1 row affected (... sec)

Caution

Updates on this column are transient, so changed values are lost after the affected node is restarted.

Description of Checked Node Settings

Recovery Expected Nodes

The check for the gateway.expected_nodes setting checks that the number of nodes that should be waited for the immediate cluster state recovery, must be equal to the maximum number of data and master nodes in the cluster.

Recovery After Nodes

The check for the gateway.recover_after_nodes verifies that the number of started nodes before the cluster starts must be greater than the half of the expected number of nodes and equal/less than number of nodes in the cluster.

  1. (E / 2) < R <= E

where R is the number of recovery nodes, E is the number of expected nodes.

Recovery After Time

If gateway.recover_after_nodes is set, then gateway.recover_after_time must not be set to 0s, otherwise the gateway.recover_after_nodes setting wouldn’t have any effect.

Routing Allocation Disk Watermark High

The check for the cluster.routing.allocation.disk.watermark.high setting verifies that the high watermark is not exceeded on the current node. The usage of each disk for configured CrateDB data paths is verified against the threshold setting. If one or more verification fails the check is marked as not passed.

Routing Allocation Disk Watermark Low

The check for the cluster.routing.allocation.disk.watermark.low which controls the low watermark for the node disk usage. The check verifies that the low watermark is not exceeded on the current node. The verification is done against each disk for configured CrateDB data paths. The check is not passed if the verification for one or more disk fails.

JVM Version

The check for the JVM version checks if CrateDB is running under Java 11 or later. If not the check fails as we’re dropping support for earlier versions in future release. This is a low severity check that doesn’t require immediate action. But to be able to upgrade to future version the JVM should be upgraded eventually.

Shards

The table sys.shards contains real-time statistics for all shards of all (non-system) tables.

Table Schema

Column NameDescriptionReturn Type
   
_node

Information about the node the shard is located at.

Contains the same information as the sys.nodes table.

OBJECT
blob_pathPath to the directory which contains the blob files of the shard, or null if the shard is not a blob shard.STRING
id

The shard ID.

This shard ID is managed by the managed by the system ranging from 0 and up to the specified number of shards of a table (by default the number of shards is 5).

INTEGER
min_lucene_versionShows the oldest lucene segment version used in this shard.STRING
num_docsThe total amount of docs within a shard.LONG
orphan_partition

True if the partition has NO table associated with. In rare situations the table is missing.

False on non-partitioned tables.

BOOLEAN
partition_ident

The partition ident of a partitioned table.

Empty string on non-partitioned tables.

STRING
path

Path to the shard directory on the filesystem.

This directory contains state and index files.

STRING
primaryDescribes if the shard is the primary shard.BOOLEAN
recovery

Represents recovery statistic of the particular shard.

Recovery is the process of moving a table shard to a different node or loading it from disk, e.g. during node startup (local gateway recovery), replication, shard rebalancing or snapshot recovery.

OBJECT
recovery[‘files’]Shards recovery statistic in files.OBJECT
recovery[‘files’][‘percent’]Percentage of files already recovered.FLOAT
recovery[‘files’][‘recovered’]Number of actual files recovered in the shard. Includes both existing and reused files.INTEGER
recovery[‘files’][‘reused’]Total number of files reused from a local copy while recovering the shard.INTEGER
recovery[‘files’][‘used’]Total number of files in the shard.INTEGER
recovery[‘size’]Shards recovery statistic in bytes.OBJECT
recovery[‘size’][‘percent’]Percentage of bytes already recovered.FLOAT
recovery[‘size’][‘recovered’]Number of actual bytes recovered in the shard. Includes both existing and reused bytes.LONG
recovery[‘size’][‘reused’]Number of bytes reused from a local copy while recovering the shard.LONG
recovery[‘size’][‘used’]Total number of bytes in the shard.LONG
recovery[‘stage’]

Recovery stage:

  • init: Recovery has not started
  • index: Reading the Lucene index meta-data and copying bytes from source to destination
  • start: Starting the engine, opening the index for use
  • translog: Replaying transaction log
  • finalize: Cleanup
  • done: Complete
STRING
recovery[‘total_time’]Returns elapsed time from the start of the shard recovery.LONG
recovery[‘type’]

Recovery type:

  • gateway
  • snapshot
  • replica
  • relocating
STRING
relocating_nodeThe node ID which the shard is getting relocated to at the time.STRING
routing_state

The current state of a shard as defined by the routing.

Possible states of the shard routing are:

  • UNASSIGNED,
  • INITIALIZING
  • STARTED
  • RELOCATING
STRING
schema_name

The schema name.

This will be “blob” for shards of blob tables and “doc” for shards of common tables without a defined schema.

STRING
size

Current size in bytes.

This value is cached for max. 10 seconds to reduce file system access.

LONG
state

The current state of the shard.

Possible states are:

  • CREATED
  • RECOVERING
  • POST_RECOVERY
  • STARTED
  • RELOCATED
  • CLOSED
  • INITIALIZING
  • UNASSIGNED
STRING
table_nameThe table name.STRING

Note

The sys.shards table is subject to Shard Table Permissions.

Example

For example, you can query shards like this:

  1. cr> select schema_name as schema,
  2. ... table_name as t,
  3. ... id,
  4. ... partition_ident as p_i,
  5. ... num_docs as docs,
  6. ... primary,
  7. ... relocating_node as r_n,
  8. ... routing_state as r_state,
  9. ... state,
  10. ... orphan_partition as o_p
  11. ... from sys.shards where table_name = 'locations' and id = 1;
  12. +--------+-----------+----+-----+------+---------+------+---------+---------+-------+
  13. | schema | t | id | p_i | docs | primary | r_n | r_state | state | o_p |
  14. +--------+-----------+----+-----+------+---------+------+---------+---------+-------+
  15. | doc | locations | 1 | | 8 | TRUE | NULL | STARTED | STARTED | FALSE |
  16. +--------+-----------+----+-----+------+---------+------+---------+---------+-------+
  17. SELECT 1 row in set (... sec)

Jobs, Operations, and Logs

To let you inspect the activities currently taking place in a cluster, CrateDB provides system tables that let you track current cluster jobs and operations. See Jobs Table and Operations Table.

Jobs and operations that finished executing are additionally recorded in memory. There are two retention policies available to control how many records should be kept.

One option is to configure the maximum number of records which should be kept. Once the configured table size is reached, the older log records are deleted as newer records are added. This is configurable using stats.jobs_log_size and stats.operations_log_size.

Another option is to configure an expiration time for the records. In this case, the records in the logs tables are periodically cleared if they are older than the expiry time. This behaviour is configurable using stats.jobs_log_expiration and stats.operations_log_expiration.

In addition to these retention policies, there is a memory limit in place preventing these tables from taking up too much memory. The amount of memory that can be used to store the jobs can be configured using stats.breaker.log.jobs.limit and stats.breaker.log.operations.limit. If the memory limit is reached, an error message will be logged and the log table will be cleared completely.

It is also possible to define a filter which must match for jobs to be recorded after they finished executing. This can be useful to only record slow queries or queries that failed due to an error. This filter can be configured using the stats.jobs_log_filer setting.

Furthermore, there is a second filter setting which also results in a log entry in the regular CrateDB log file for all finished jobs that match this filter. This can be configured using stats.jobs_log_persistent_filter. This could be used to create a persistent slow query log.

Jobs

The sys.jobs table is a constantly updated view of all jobs that are currently being executed in the cluster.

Table Schema

Column NameDescriptionReturn Type
id

The job UUID.

This job ID is generated by the sytem.

STRING
nodeInformation about the node that created the job.OBJECT
node[‘id’]The id of the node.STRING
node[‘name’]The name of the node.STRING
startedThe point in time when the job started.TIMESTAMP
stmtShows the data query or manipulation statement represented by this job.STRING
usernameThe user who is executing the statement.STRING

The field username corresponds to the SESSION_USER that is performing the query:

  1. cr> select stmt, username, started from sys.jobs where stmt like 'sel% from %jobs%';
  2. +---------------------------------------------------------------------------------+----------+-...-----+
  3. | stmt | username | started |
  4. +---------------------------------------------------------------------------------+----------+-...-----+
  5. | select stmt, username, started from sys.jobs where stmt like 'sel% from %jobs%' | crate | ... |
  6. +---------------------------------------------------------------------------------+----------+-...-----+
  7. SELECT 1 row in set (... sec)

Note

If the enterprise edition is disabled or the user management module is not available, the username is represented as crate.

Every request that queries data or manipulates data is considered a “job” if it is a valid query. Requests that are not valid queries (for example, a request that tries to query a non-existent table) will not show up as jobs.

Jobs Metrics

The sys.jobs_metrics table provides an overview of the query latency in the cluster. Jobs metrics are not persisted across node restarts.

The metrics are aggregated for each node and each unique classification of the statements.

Note

In order to reduce the memory requirements for these metrics, the times are statistically sampled and therefore may have slight inaccuracies. In addition, durations are only tracked up to 10 minutes. Statements taking longer than that are capped to 10 minutes.

sys.jobs_metrics Table Schema

Column NameDescriptionReturn Type
nodeAn object containing the id and name of the node on which the metrics have been sampled.OBJECT
classificationAn object containing the statement classification.OBJECT
classification[‘type’]The general type of the statement. Types are: INSERT, SELECT, UPDATE, DELETE, COPY, DDL, and MANAGEMENT.STRING
classification[‘labels’]Labels are only available for certain statement types that can be classified more accurately than just by their type.STRING_ARRAY
total_countTotal number of queries executedLONG
failed_countTotal number of queries that failed to complete successfully.LONG
sum_of_durationsSum of durations in ms of all executed queries per statement type.LONG
stdevThe standard deviation of the query latenciesDOUBLE
meanThe mean query latency in msDOUBLE
maxThe maximum query latency in msLONG
minThe minimum query latency in msLONG
percentilesAn object containing different percentilesOBJECT

Classification

Certain statement types (such as SELECT statements) have additional labels in their classification. These labels are the names of the logical plan operators that are involved in the query.

For example, the following UNION statement:

  1. SELECT name FROM t1 where id = 1
  2. UNION ALL
  3. SELECT name FROM t2 where id < 2

would result in the following labels:

  • Union` for the UNION ALL
  • Get for the left SELECT
  • Collect for the right SELECT

Note

Labels may be subject to change as they only represent internal properties of the statement!

Operations

The sys.operations table is a constantly updated view of all operations that are currently being executed in the cluster:

  1. cr> select node['name'], job_id, name, used_bytes from sys.operations
  2. ... order by name limit 1;
  3. +--------------+--------...-+-----...-+------------+
  4. | node['name'] | job_id | name | used_bytes |
  5. +--------------+--------...-+-----...-+------------+
  6. | crate | ... | ... | ... |
  7. +--------------+--------...-+-----...-+------------+
  8. SELECT 1 row in set (... sec)

An operation is a node-specific sub-component of a job (for when a job involves multi-node processing). Jobs that do not require multi-node processing will not produce any operations.

Table Schema

Column NameDescriptionReturn Type
id

The operation UUID.

This operation ID is generated by the sytem.

STRING
job_idThe job id this operation belongs to.STRING
nameThe name of the operation.STRING
nodeInformation about the node that created the operation.OBJECT
node[‘id’]The id of the node.STRING
node[‘name’]The name of the node.STRING
startedThe point in time when the operation started.TIMESTAMP
used_bytesCurrently loaded amount of data by the operation.LONG

Note

In some cases, operations are generated for internal CrateDB work that does not directly correspond to a user request. These entries do not have corresponding entries in sys.jobs.

Logs

The sys.jobs and sys.operations tables have corresponding log tables: sys.jobs_log and sys.operations_log.

sys.jobs_log Table Schema

Column NameDescriptionReturn Type
idThe job ID.STRING
endedThe point in time when the job finished.TIMESTAMP
errorIf the job encountered an error, this will hold the error message.STRING
startedThe point in time when the job started.TIMESTAMP
stmtShows the data query or manipulation statement executed by the job.STRING
usernameThe user who executed the statement.STRING
classificationAn object containing the statement classification.OBJECT
classification[‘type’]The general type of the statement. Types are: INSERT, SELECT, UPDATE, DELETE, COPY, DDL, and MANAGEMENT.STRING
classification[‘labels’]Labels are only available for certain statement types that can be classified more accurately than just by their type.STRING_ARRAY

Note

You can control which jobs are recorded using the stats.jobs_log_filter

sys.operations_log Table Schema

Column NameDescriptionReturn Type
idThe operation ID.STRING
job_idThe job id.STRING
endedThe point in time when the operation finished.TIMESTAMP
errorIf the operation encountered an error, this will hold the error message.STRING
nameThe name of the operation.STRING
startedThe point in time when the operation started.TIMESTAMP
used_bytesThe amount of data loaded by the operation.LONG

After a job or operation finishes, the corresponding entry will be moved into the corresponding log table:

  1. cr> select id, stmt, username, started, ended, error
  2. ... from sys.jobs_log order by ended desc limit 2;
  3. +-...+----------------------------------------------...-+----------+-...-----+-...---+-------+
  4. | id | stmt | username | started | ended | error |
  5. +-...+----------------------------------------------...-+----------+-...-----+-...---+-------+
  6. | ...| select node['name'], ... | crate | ... | ... | NULL |
  7. | ...| select stmt, username, started from sys.jobs ... | crate | ... | ... | NULL |
  8. +-...+----------------------------------------------...-+----------+-...-----+-...---+-------+
  9. SELECT 2 rows in set (... sec)

Invalid queries are also logged in the sys.jobs_log table, i.e. queries that never make it to the sys.jobs table because they could not be executed.

The log tables are bound by a fixed size (stats.jobs_log_size) or by an expiration time (stats.jobs_log_expiration)

See Collecting Stats for information on how to configure logs.

Caution

If you deactivate statistics tracking, the logs tables will be truncated.

Cluster Checks

The table sys.checks exposes a list of internal cluster checks and results of their validation.

The sys.checks table looks like this:

Column NameDescriptionReturn Type
idThe unique check id.INTEGER
severityThe level of severity. The higher the value of the field the higher severity.INTEGER
descriptionThe description message for the setting check.STRING
passedThe flag determines whether the check for the setting has passed.BOOLEAN

Here’s an example query:

  1. cr> select id, description from sys.checks order by id;
  2. +----+--------------------------------------------------------------...-+
  3. | id | description |
  4. +----+--------------------------------------------------------------...-+
  5. | 1 | The setting 'discovery.zen.minimum_master_nodes' must not be ... |
  6. | 2 | The total number of partitions of one or more partitioned tab... |
  7. | 3 | The following tables need to be recreated for compatibility w... |
  8. | 6 | Your CrateDB license is valid. Enjoy CrateDB! |
  9. +----+--------------------------------------------------------------...-+
  10. SELECT 4 rows in set (... sec)

Cluster checks are also indicated in the CrateDB admin console. When all cluster checks (and all Node Checks) pass, the Checks icon will be green. Here’s what it looks like when some checks are failing at the CRITICAL severity level:

../_images/cluster-checks-critical.png

Current Checks

Minimum Master Nodes

The check for the discovery.zen.minimum_master_nodes setting verifies that the minimum number of nodes is equal/greater than the half of maximum number of nodes in the cluster.

  1. (N / 2) + 1 <= M

where N is the number of nodes in the cluster, and M is the value of the setting discovery.zen.minimum_master_nodes.

You can change the value (via SET and RESET) permanently by issuing the following SQL statement:

  1. SET GLOBAL PERSISTENT discovery.zen.minimum_master_nodes = M;

Number of Partitions

This check warns if any partitioned table has more than 1000 partitions to detect the usage of a high cardinality field for partitioning.

Tables need to be recreated

Warning

Do not attempt to upgrade your cluster to a newer major version if this cluster check is failing. Follow the instructions below to get this cluster check passing.

This check warns you if there are tables that need to be recreated for compatibility with future major versions of CrateDB.

If you try to upgrade to the next major version of CrateDB with tables that have not been recreated, CrateDB will refuse to start.

To recreate a table, you have to create new tables, copy over the data and rename or remove the old table.

1) Use SHOW CREATE TABLE to get the schema required to create an empty copy of the table to recreate:

  1. SHOW CREATE TABLE your_table;

2) Create a new temporary table, using the schema returned from SHOW CREATE TABLE:

  1. CREATE TABLE tmp_your_table (...);
  1. Prevent inserts to the original table:

    1. ALTER TABLE your_table SET ("blocks.read_only" = true);
  2. Copy the data:

    1. INSERT INTO tmp_your_table (...) (SELECT ... FROM your_table);
  3. Swap the tables:

    1. ALTER CLUSTER SWAP TABLE tmp_your_table TO your_table;
  4. Confirm the new your_table contains all data and has the new version:

    1. SELECT count(*) FROM your_table;
    2. SELECT version FROM information_schema.tables where table_name = 'your_table';
  5. Drop the now obsolete old table:

    1. ALTER TABLE tmp_your_table SET ("blocks.read_only" = false);
    2. DROP TABLE tmp_your_table;

When all tables have been recreated, this cluster check will pass.

Note

Snapshots of your tables created prior to them being upgraded will not work with future versions of CrateDB. For this reason, you should create a new snapshot for each of your tables. (See Snapshots.)

License expiry check

This check warns you when your license is close to expiration. It will yield a MEDIUM alert when your license is valid for less than 15 days and a HIGH alert when your license is valid for less than a day. It’s highly recommended you request a new license when this check triggers in order to avoid the situation where operations are rejected due to an invalid license.

Health

The sys.health table lists the health of each table and table partition. The health is computed by checking the states of the shard of each table/partition.

Column NameDescriptionReturn Type
table_nameThe table name.STRING
table_schemaThe schema of the table.STRING
partition_identThe ident of the partition. NULL for non-partitioned tables.STRING
healthThe health label. Can be RED, YELLOW or GREEN.STRING
severityThe health as a short value. Useful when ordering on health.SHORT
missing_shardsThe number of not assigned or started shards.INTEGER
underreplicated_shardsThe number of shards which are not fully replicated.INTEGER

Both missing_shards and underreplicated_shards might return -1 if the cluster is in an unhealthy state that prevents the exact number from being calculated. This could be the case when the cluster can’t elect a master, because there are not enough eligible nodes available.

  1. cr> select * from sys.health order by severity desc, table_name;
  2. +--------+----------------+-----------------+----------+------------+--------------+------------------------+
  3. | health | missing_shards | partition_ident | severity | table_name | table_schema | underreplicated_shards |
  4. +--------+----------------+-----------------+----------+------------+--------------+------------------------+
  5. | GREEN | 0 | | 1 | locations | doc | 0 |
  6. | GREEN | 0 | | 1 | quotes | doc | 0 |
  7. +--------+----------------+-----------------+----------+------------+--------------+------------------------+
  8. SELECT 2 rows in set (... sec)

The health with the highest severity will always define the health of the query scope.

Example of getting a cluster health (health of all tables):

  1. cr> select health from sys.health order by severity desc limit 1;
  2. +--------+
  3. | health |
  4. +--------+
  5. | GREEN |
  6. +--------+
  7. SELECT 1 row in set (... sec)

Health Definition

HealthDescription
REDAt least one primary shard is missing (primary shard not started or unassigned).
YELLOWAt least one shard is underreplicated (replica shard not started or unassigned).
GREENAll primary and replica shards have been started.

Note

The sys.health table is subject to Shard Table Permissions as it will expose a summary of table shard states.

Repositories

The table sys.repositories lists all configured repositories that can be used to create, manage and restore snapshots (see Snapshots).

Column NameDescriptionReturn Type
nameThe repository nameSTRING
typeThe type of the repository determining how and where the repository stores its snapshots.STRING
settingsThe configuration settings the repository has been created with. The specific settings depend on the repository type, see CREATE REPOSITORY.OBJECT
  1. cr> SELECT name, type, settings FROM sys.repositories
  2. ... ORDER BY name;
  3. +---------+------+---------------------------------------------------...--+
  4. | name | type | settings |
  5. +---------+------+---------------------------------------------------...--+
  6. | my_repo | fs | {"compress": "true", "location": "repo_location", ...} |
  7. +---------+------+---------------------------------------------------...--+
  8. SELECT 1 row in set (... sec)

Snapshots

The table sys.snapshots lists all existing snapshots in all configured repositories (see Snapshots).

Column NameDescriptionReturn Type
nameThe name of the snapshotSTRING
repositoryThe name of the repository that contains this snapshot.STRING
concrete_indicesContains the names of all tables and partitions that are contained in this snapshot how they are represented as ES index names.ARRAY
startedThe point in time when the creation of the snapshot started. Changes made after that are not stored in this snapshot.TIMESTAMP
finishedThe point in time when the snapshot creation finished.TIMESTAMP
stateThe current state of the snapshot. One of: IN_PROGRESS, SUCCESS, PARTIAL, or FAILED.STRING
versionAn internal version this snapshot was created with.STRING

Snapshot/Restore operates on a per-shard basis. Hence, the state column indicates whether all (SUCCESS), some (PARTIAL), or no shards(FAILED) have been backed up. PARTIAL snapshots are the result of some primaries becoming unavailable while taking the snapshot when there are no replicas at hand (cluster state is RED). If there are replicas of the (now unavailable) primaries (cluster state is YELLOW) the snapshot succeeds and all shards are included (state SUCCESS). Building on a PARTIAL snapshot will include all primaries again.

Warning

In case of a PARTIAL state another snapshot should be created in order to guarantee a full backup! Only SUCCESS includes all shards.

The concrete_indices column contains the names of all Elasticsearch indices that were stored in the snapshot. A normal CrateDB table maps to one Elasticsearch index, a partitioned table maps to one Elasticsearch index per partition. The mapping follows the following pattern:

CrateDB table / partition nameconcrete_indices entry
doc.my_tablemy_table
my_schema.my_tablemy_schema.my_table
doc.parted_table (value=null).partitioned.my_table.0400
my_schema.parted_table (value=null)my_schema..partitioned.my_table.0400
  1. cr> SELECT "repository", name, state, concrete_indices
  2. ... FROM sys.snapshots order by "repository", name;
  3. +------------+-------------+---------+-----------------...-+
  4. | repository | name | state | concrete_indices |
  5. +------------+-------------+---------+-----------------...-+
  6. | my_repo | my_snapshot | SUCCESS | [...] |
  7. +------------+-------------+---------+-----------------...-+
  8. SELECT 1 row in set (... sec)

Summits

The sys.summits table contains the information about the mountains in the Alps higher than 2000m. The mountain names from the table are also used to generate random nodes names.

Users

The sys.users table contains all existing database users in the cluster. The table is only available in the CrateDB Enterprise Edition.

Column NameDescriptionReturn Type
nameThe name of the database user.STRING
superuserBOOLEAN flag to indicate whether the user is a superuser.BOOLEAN

Allocations

The sys.allocations table contains information about shards and their allocation state. The table contains:

  • shards that are unassigned and why they are unassigned
  • shards that are assigned but cannot be moved or rebalanced and why they remain on their current node

It can help to identify problems if shard allocations behave different than expected, e.g. when a shard stays unassigned or a shard does not move off a node.

Column NameDescriptionReturn Type
table_schemaSchema name of the table of the shard.STRING
table_nameTable name of the shard.STRING
partition_identIdentifier of the partition of the shard. NULL if the table is not partitioned.STRING
shard_idID of the effected shard.INTEGER
node_idID of the node on which the shard resides. NULL if the shard is unassigned.STRING
primaryWhether the shard is a primary shard.BOOLEAN
current_stateCurrent state of the shard. Possible states are: UNASSIGNED, INITIALIZING, STARTED, RELOCATINGSTRING
explanationExplanation why the shard cannot be allocated, moved or rebalanced.STRING
decisionsA list of decisions that describe in detail why the shard in the current state.ARRAY
decisions[‘node_id’]ID of the node of the decision.STRING
decisions[‘node_name’]Name of the node of the decision.STRING
decisions[‘explanations’]Detailed list of human readable explanations why the node decided whether to allocate or rebalance the shard. Returns NULL if there is no need to rebalance the shard.ARRAY

Note

The sys.allocations table is subject to Shard Table Permissions.

Shard Table Permissions

Accessing tables that return shards (sys.shards, sys.allocations) is subjected to the same privileges constraints as the other tables. Namely, in order to query them, the connected user needs to have the DQL privilege on that particular table, either directly or inherited from the SCHEMA or CLUSTER (for more information on privileges inheritance see Hierarchical Inheritance of Privileges).

However, being able to query shard returning system tables will not allow the user to retrieve all the rows in the table, as they may contain information related to tables, which the connected user does not have any privileges for. The only rows that will be returned will be the ones the user is allowed to access.

For example, if the user john has any privilege on the doc.books table but no privilege at all on doc.locations, when john issues a SELECT * FROM sys.shards statement, the shards information related to the doc.locations table will not be returned.