forked from crate/crate
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsystem.txt
More file actions
666 lines (563 loc) · 42.6 KB
/
Copy pathsystem.txt
File metadata and controls
666 lines (563 loc) · 42.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
.. highlight:: psql
==================
System Information
==================
Crate provides some useful schemas which contains virtual tables.
Those tables are read-only and can be queried to get statistical
real-time information about the cluster, its nodes, and their shards.
Cluster
=======
Basic information about the Crate cluster can be retrieved from
the ``sys.cluster`` table:
+------------------+---------------------------------+-------------------+
| Name | Description | Return Type |
+==================+=================================+===================+
| ``id`` | A unique id | ``String`` |
| | generated by the system. | |
+------------------+---------------------------------+-------------------+
| ``name`` | The cluster name. | ``String`` |
+------------------+---------------------------------+-------------------+
| ``master_node`` | Node id of the node which | ``String`` |
| | currently operates as master | |
+------------------+---------------------------------+-------------------+
| ``settings`` | The cluster settings. | ``Object`` |
+------------------+---------------------------------+-------------------+
.. Hidden: reset settings
cr> reset GLOBAL stats.enabled, stats.jobs_log_size, stats.operations_log_size;
RESET OK (... sec)
The result has at most 1 row::
cr> select name from sys.cluster;
+--------------+
| name |
+--------------+
| Testing... |
+--------------+
SELECT 1 row in set (... sec)
.. _sys-cluster-settings:
Cluster Settings
----------------
The ``sys.cluster.settings`` expression returns information about the
currently applied cluster settings.
::
cr> select settings from sys.cluster;
+--------------------------------------------------------------------------------------------...-+
| settings |
+--------------------------------------------------------------------------------------------...-+
| {"cluster": {...}, "routing": {...}, "discovery": {...}, "indices": {...}, "stats": {...}} |
+--------------------------------------------------------------------------------------------...-+
SELECT 1 row in set (... sec)
::
cr> select column_name, data_type from information_schema.columns
... where column_name like 'settings%'
... and table_name = 'cluster';
+-----------------------------------------------------------------------------------+-----------+
| column_name | data_type |
+-----------------------------------------------------------------------------------+-----------+
| settings | object |
| settings['stats'] | object |
| settings['stats']['jobs_log_size'] | integer |
| settings['stats']['operations_log_size'] | integer |
| settings['stats']['enabled'] | boolean |
| settings['discovery'] | object |
| settings['discovery']['zen'] | object |
| settings['discovery']['zen']['minimum_master_nodes'] | integer |
| settings['discovery']['zen']['ping_timeout'] | long |
| settings['discovery']['zen']['publish_timeout'] | long |
| settings['cluster'] | object |
| settings['cluster']['graceful_stop'] | object |
| settings['cluster']['graceful_stop']['min_availability'] | string |
| settings['cluster']['graceful_stop']['reallocate'] | boolean |
| settings['cluster']['graceful_stop']['timeout'] | long |
| settings['cluster']['graceful_stop']['force'] | boolean |
| settings['cluster']['routing'] | object |
| settings['cluster']['routing']['allocation'] | object |
| settings['cluster']['routing']['allocation']['enable'] | string |
| settings['cluster']['routing']['allocation']['allow_rebalance'] | string |
| settings['cluster']['routing']['allocation']['cluster_concurrent_rebalance'] | integer |
| settings['cluster']['routing']['allocation']['node_initial_primaries_recoveries'] | integer |
| settings['cluster']['routing']['allocation']['node_concurrent_recoveries'] | integer |
| settings['cluster']['routing']['allocation']['include'] | object |
| settings['cluster']['routing']['allocation']['include']['_ip'] | string |
| settings['cluster']['routing']['allocation']['include']['_id'] | string |
| settings['cluster']['routing']['allocation']['include']['_host'] | string |
| settings['cluster']['routing']['allocation']['include']['_name'] | string |
| settings['cluster']['routing']['allocation']['exclude'] | object |
| settings['cluster']['routing']['allocation']['exclude']['_ip'] | string |
| settings['cluster']['routing']['allocation']['exclude']['_id'] | string |
| settings['cluster']['routing']['allocation']['exclude']['_host'] | string |
| settings['cluster']['routing']['allocation']['exclude']['_name'] | string |
| settings['cluster']['routing']['allocation']['require'] | object |
| settings['cluster']['routing']['allocation']['require']['_ip'] | string |
| settings['cluster']['routing']['allocation']['require']['_id'] | string |
| settings['cluster']['routing']['allocation']['require']['_host'] | string |
| settings['cluster']['routing']['allocation']['require']['_name'] | string |
| settings['cluster']['routing']['allocation']['balance'] | object |
| settings['cluster']['routing']['allocation']['balance']['shard'] | float |
| settings['cluster']['routing']['allocation']['balance']['index'] | float |
| settings['cluster']['routing']['allocation']['balance']['primary'] | float |
| settings['cluster']['routing']['allocation']['balance']['threshold'] | float |
| settings['cluster']['routing']['allocation']['disk'] | object |
| settings['cluster']['routing']['allocation']['disk']['threshold_enabled'] | boolean |
| settings['cluster']['routing']['allocation']['disk']['watermark'] | object |
| settings['cluster']['routing']['allocation']['disk']['watermark']['low'] | string |
| settings['cluster']['routing']['allocation']['disk']['watermark']['high'] | string |
| settings['indices'] | object |
| settings['indices']['recovery'] | object |
| settings['indices']['recovery']['concurrent_streams'] | integer |
| settings['indices']['recovery']['file_chunk_size'] | long |
| settings['indices']['recovery']['translog_ops'] | integer |
| settings['indices']['recovery']['translog_size'] | long |
| settings['indices']['recovery']['compress'] | boolean |
| settings['indices']['recovery']['max_bytes_per_sec'] | long |
| settings['indices']['store'] | object |
| settings['indices']['store']['throttle'] | object |
| settings['indices']['store']['throttle']['type'] | string |
| settings['indices']['store']['throttle']['max_bytes_per_sec'] | long |
| settings['indices']['fielddata'] | object |
| settings['indices']['fielddata']['breaker'] | object |
| settings['indices']['fielddata']['breaker']['limit'] | string |
| settings['indices']['fielddata']['breaker']['overhead'] | double |
| settings['cluster']['info'] | object |
| settings['cluster']['info']['update'] | object |
| settings['cluster']['info']['update']['interval'] | long |
+-----------------------------------------------------------------------------------+-----------+
SELECT 67 rows in set (... sec)
For further details, see the :ref:`Cluster Settings <conf-cluster-settings>` configuration section.
Nodes
=====
To get information about the nodes simply 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 Name | Description | Return Type |
+=============+=============================================+=============+
| ``id`` | A unique id within the cluster generated by | ``String`` |
| | the system. | |
+-------------+---------------------------------------------+-------------+
name
----
+-------------+-------------------------------------------------+-------------+
| Column Name | Description | Return Type |
+=============+=================================================+=============+
| ``name`` | The node name within a cluster. The system will | ``String`` |
| | choose a random name. You can specify the node | |
| | name via your own custom `configuration`_. | |
+-------------+-------------------------------------------------+-------------+
hostname
--------
+--------------+-------------------------------------------------+-------------+
| Column Name | Description | Return Type |
+==============+=================================================+=============+
| ``hostname`` | The specified host name of the machine the node | ``String`` |
| | is running on. | |
+--------------+-------------------------------------------------+-------------+
port
----
+-----------------------+-------------------------------------------------+-------------+
| Column Name | Description | Return Type |
+=======================+=================================================+=============+
| ``port`` | The specified ports for both HTTP and binary | ``Object`` |
| | transport interfaces. You can specify the ports | |
| | via your own custom `configuration`_. | |
+-----------------------+-------------------------------------------------+-------------+
| ``port['http']`` | Crate's HTTP port. | ``Integer`` |
+-----------------------+-------------------------------------------------+-------------+
| ``port['transport']`` | Crate's binary transport port. | ``Integer`` |
+-----------------------+-------------------------------------------------+-------------+
load
----
+----------------+----------------------------------------+-------------+
| Column Name | Description | Return Type |
+================+========================================+=============+
| ``load`` | System load statistics | ``Object`` |
+----------------+----------------------------------------+-------------+
| ``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`` |
+----------------+----------------------------------------+-------------+
mem
---
+-------------------------+-------------------------------------------------+-------------+
| Column Name | Description | Return Type |
+=========================+=================================================+=============+
| ``mem`` | Memory 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`` |
+-------------------------+-------------------------------------------------+-------------+
heap
----
+------------------+------------------------------------------------+-------------+
| Column Name | Description | Return Type |
+==================+================================================+=============+
| ``heap`` | Heap memory utilization statistics. | ``Object`` |
+------------------+------------------------------------------------+-------------+
| ``heap['used']`` | Currently used heap memory in bytes. | ``Long`` |
+------------------+------------------------------------------------+-------------+
| ``heap['max']`` | Maximum available heap memory. You can specify | ``Long`` |
| | the max heap memory Crate should use in the | |
| | `configuration`_. | |
+------------------+------------------------------------------------+-------------+
| ``heap['free']`` | Currently available heap memory in bytes. | ``Long`` |
+------------------+------------------------------------------------+-------------+
.. _sys-versions:
version
-------
+-------------------------------+---------------------------------------------------+-------------+
| Column Name | Description | Return Type |
+===============================+===================================================+=============+
| ``version`` | Crate version information. | ``Object`` |
+-------------------------------+---------------------------------------------------+-------------+
| ``version['number']`` | Version string in format ``"major.minor.hotfix"`` | ``String`` |
+-------------------------------+---------------------------------------------------+-------------+
| ``version['build_hash']`` | SHA hash of the Github commit which | ``String`` |
| | this build was built from. | |
+-------------------------------+---------------------------------------------------+-------------+
| ``version['build_snapshot']`` | Indicates whether this build is a snapshot build. | ``Boolean`` |
+-------------------------------+---------------------------------------------------+-------------+
fs
---
+----------------------------------+------------------------------------------------+-------------+
| Column Name | Description | Return Type |
+==================================+================================================+=============+
| ``fs`` | Utilization statistics about the file system. | ``Object`` |
+----------------------------------+------------------------------------------------+-------------+
| ``fs['total']`` | Aggregated usage statistic of all disks on the | ``Object`` |
| | host. | |
+----------------------------------+------------------------------------------------+-------------+
| ``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 | ``Array`` |
| | host. | |
+----------------------------------+------------------------------------------------+-------------+
| ``fs['disks']['dev']`` | Device name | ``String`` |
+----------------------------------+------------------------------------------------+-------------+
| ``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. | ``Long`` |
+----------------------------------+------------------------------------------------+-------------+
| ``fs['disks']['bytes_read']`` | Total size of reads on the disk in bytes. | ``Long`` |
+----------------------------------+------------------------------------------------+-------------+
| ``fs['disks']['writes']`` | Number of writes on the disk. | ``Long`` |
+----------------------------------+------------------------------------------------+-------------+
| ``fs['disks']['bytes_written']`` | Total size of writes on the disk in bytes. | ``Long`` |
+----------------------------------+------------------------------------------------+-------------+
| ``fs['data']`` | Information about data paths used by the node. | ``Array`` |
+----------------------------------+------------------------------------------------+-------------+
| ``fs['data']['dev']`` | Device name | ``String`` |
+----------------------------------+------------------------------------------------+-------------+
| ``fs['data']['path']`` | File path where the data of the node resides. | ``String`` |
+----------------------------------+------------------------------------------------+-------------+
thread_pools
------------
+-------------------------------+------------------------------------------------+-------------+
| Column Name | Description | Return Type |
+===============================+================================================+=============+
| ``thread_pools`` | Usage statistics of Java thread pools. | ``Array`` |
+-------------------------------+------------------------------------------------+-------------+
| ``thread_pools['name']`` | Name of the pool. | ``String`` |
+-------------------------------+------------------------------------------------+-------------+
| ``thread_pools['active']`` | Number of currently running thread in the | ``Integer`` |
| | thread pool. | |
+-------------------------------+------------------------------------------------+-------------+
| ``thread_pools['rejected']`` | Total number of rejected threads in the thread | ``Long`` |
| | pool. | |
+-------------------------------+------------------------------------------------+-------------+
| ``thread_pools['largest']`` | Largest number of threads that have ever | ``Integer`` |
| | simultaniously been in the pool. | |
+-------------------------------+------------------------------------------------+-------------+
| ``thread_pools['completed']`` | Total number of completed thread in teh thread | ``Long`` |
| | pool. | |
+-------------------------------+------------------------------------------------+-------------+
| ``thread_pools['threads']`` | Size of the thread pool. | ``Integer`` |
+-------------------------------+------------------------------------------------+-------------+
| ``thread_pools['queue']`` | Number of thread currently in the queue. | ``Integer`` |
+-------------------------------+------------------------------------------------+-------------+
os
---
+-------------------------+----------------------------------------------+-------------+
| Column Name | Description | Return Type |
+=========================+==============================================+=============+
| ``os`` | Operating system stats | ``Object`` |
+-------------------------+----------------------------------------------+-------------+
| ``os['uptime']`` | System uptime in milliseconds | ``Long`` |
+-------------------------+----------------------------------------------+-------------+
| ``os['timestamp']`` | UNIX timestamp in millisecond resolution | ``Long`` |
+-------------------------+----------------------------------------------+-------------+
| ``os['cpu']`` | Information about CPU utilization | ``Object`` |
+-------------------------+----------------------------------------------+-------------+
| ``os['cpu']['system']`` | CPU time used by the system | ``Short`` |
+-------------------------+----------------------------------------------+-------------+
| ``os['cpu']['user']`` | CPU time used by applications | ``Short`` |
+-------------------------+----------------------------------------------+-------------+
| ``os['cpu']['idle']`` | Idle CPU time | ``Short`` |
+-------------------------+----------------------------------------------+-------------+
| ``os['cpu']['used']`` | Used CPU (system + user) | ``Short`` |
+-------------------------+----------------------------------------------+-------------+
| ``os['cpu']['stolen']`` | The amount of CPU 'stolen' from this virtual | ``Short`` |
| | machine by the hypervisor for other tasks. | |
+-------------------------+----------------------------------------------+-------------+
network
-------
+--------------------------------------------------------+--------------------------------------------------------------------------------------------+-------------+
| Column Name | Description | Return Type |
+========================================================+============================================================================================+=============+
| ``network`` | Statistics about network activity on the host. | ``Object`` |
+--------------------------------------------------------+--------------------------------------------------------------------------------------------+-------------+
| ``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 | ``Long`` |
| | because of a lack of memory or were too short. | |
+--------------------------------------------------------+--------------------------------------------------------------------------------------------+-------------+
| ``network['tcp']]['packets']['rst_sent']`` | Total number of RST packets sent due to left unread | ``Long`` |
| | data in queue when socket is closed. | |
| | See `tools.ietf.org <https://tools.ietf.org/html/rfc2525#page-50>`_. | |
+--------------------------------------------------------+--------------------------------------------------------------------------------------------+-------------+
process
-------
+------------------------------------------+------------------------------------------------+--------------+
| Column Name | Description | Return Type |
+==========================================+================================================+==============+
| ``process`` | Statistics about the Crate process | ``Object`` |
+------------------------------------------+------------------------------------------------+--------------+
| ``process['open_file_descriptors']`` | Number of currently open file descriptors used | ``Long`` |
| | by the Crate process. | |
+------------------------------------------+------------------------------------------------+--------------+
| ``process['max_open_file_descriptors']`` | The maximum number of open file descriptors | ``Long`` |
| | Crate can use. | |
+------------------------------------------+------------------------------------------------+--------------+
Shards
======
The table ``sys.shards`` contains real-time statistics for all
shards of all (non-system) tables.
The table schema is as follows:
+------------------+----------------------------------+-------------+
| Name | Description | Return Type |
+==================+==================================+=============+
| schema_name | The schema name. | String |
| | This will be "blob" for | |
| | shards of blob tables and "doc" | |
| | for shards of common tables. | |
+------------------+----------------------------------+-------------+
| table_name | The table name. | String |
+------------------+----------------------------------+-------------+
| partition_ident | The partition ident of a | String |
| | partitioned table. | |
| | Empty string on non-partitioned | |
| | tables. | |
+------------------+----------------------------------+-------------+
| id | The shard id. This shard id is | Integer |
| | 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). | |
+------------------+----------------------------------+-------------+
| num_docs | The total amount of docs | Long |
| | within a shard. | |
+------------------+----------------------------------+-------------+
| primary | Describes if the shard is the | Boolean |
| | primary shard. | |
+------------------+----------------------------------+-------------+
| relocating_node | The node id which the shard is | String |
| | getting relocated to at the time | |
+------------------+----------------------------------+-------------+
| size | Current size in bytes. | Long |
+------------------+----------------------------------+-------------+
| state | The current state of the shard. | String |
| | Possible states are: | |
| | CREATED, | |
| | RECOVERING, | |
| | POST_RECOVERY, | |
| | STARTED, | |
| | RELOCATED, | |
| | CLOSED, | |
| | INITIALIZING, | |
| | UNASSIGNED | |
+------------------+----------------------------------+-------------+
| orphan_partition | True if the partition has NO | Boolean |
| | table associated with. In rare | |
| | situations the table is | |
| | missing. | |
| | False on non-partitioned | |
| | tables. | |
+------------------+----------------------------------+-------------+
| _node | Information about the node the | Object |
| | shard is located at | |
| | at. Contains the same | |
| | information as the ``sys.nodes`` | |
| | table. | |
+------------------+----------------------------------+-------------+
For example, you can query shards like this::
cr> select schema_name as schema,
... table_name as t,
... id,
... partition_ident as p_i,
... num_docs as docs,
... primary,
... relocating_node as r_n,
... state,
... size,
... orphan_partition as o_p
... from sys.shards where table_name = 'locations' and id = 1;
+--------+-----------+----+-----+------+---------+------+---------+------+-------+
| schema | t | id | p_i | docs | primary | r_n | state | size | o_p |
+--------+-----------+----+-----+------+---------+------+---------+------+-------+
| doc | locations | 1 | | 6 | TRUE | NULL | STARTED | ... | FALSE |
+--------+-----------+----+-----+------+---------+------+---------+------+-------+
SELECT 1 row in set (... sec)
Jobs, Operations and Logs
=========================
In order to see what is happening in the cluster crate provides the
``sys.jobs`` and ``sys.operations`` tables and there corresponding "logs"
``sys.jobs_log`` and ``sys.operations_log``.
These tables are by *default always empty*. Jobs and operations aren't tracked
unless stats collection is activiated as tracking statistics adds a slight
performance overhead.
In order to activate stats tracking :ref:`ref-set` can be used::
cr> set global stats.enabled = true;
SET OK (... sec)
Jobs
----
The ``sys.jobs`` table provides an overview over all jobs that are currently
being executed in the cluster::
cr> select stmt, started from sys.jobs where stmt like 'sel% from %jobs%';
+-----------------------------------------------------------------------+-...-----+
| stmt | started |
+-----------------------------------------------------------------------+-...-----+
| select stmt, started from sys.jobs where stmt like 'sel% from %jobs%' | ... |
+-----------------------------------------------------------------------+-...-----+
SELECT 1 row in set (... sec)
Each request sent to crate that queries data or manipulates data is considered
a ``job`` if it passes the analysis step.
For example a request that fails because it attempts to query a table that
doesn't exist won't get listed.
Operations
----------
The ``sys.operations`` table lists all operations that are currently being
executed in the cluster.
A ``operation`` is part of a ``job`` but not all jobs list their operations. A
operation is listed on each node it is being executed on.
In order to see on which nodes the operations are being executed the
``_node`` system column can be used in the query::
cr> select _node['name'], job_id, name, used_bytes from sys.operations order by name limit 1;
+---------------+--------...-+---------+------------+
| _node['name'] | job_id | name | used_bytes |
+---------------+--------...-+---------+------------+
| crate | ... | collect | ... |
+---------------+--------...-+---------+------------+
SELECT 1 row in set (... sec)
Logs
----
Both ``sys.jobs`` and ``sys.operations`` have a corresponding ``_log`` table.
After a job or operation finishes the entries will be moved into the ``_log``
table. The ``_log`` tables are bound in size and once a table has reached its
limit old entries will be discarded as new entries are added::
cr> select * from sys.jobs_log order by ended desc limit 2;
+-...+------------------------------------...-+-...-----+-...---+-------+
| id | stmt | started | ended | error |
+-...+------------------------------------...-+-...-----+-...---+-------+
| ...| select _node['name'], ... | ... | ... | NULL |
| ...| select stmt, started from sys.jobs ... | ... | ... | NULL |
+-...+------------------------------------...-+-...-----+-...---+-------+
SELECT 2 rows in set (... sec)
See :ref:`ref-set` on how to change the size of the tables.
As described above the stats tracking is by default deactivated and has to be
enabled using the ``SET`` statement. The same statement can also be used to
deactivate the stats tracking. This will also wipe all existing log entries::
cr> set global stats.enabled = false;
SET OK (... sec)
::
cr> select count(*) from sys.jobs_log;
+----------+
| count(*) |
+----------+
| 0 |
+----------+
SELECT 1 row in set (... sec)
.. note::
Instead of ``SET`` the ``RESET`` statement could also have been used to
reset the value of ``stats.enabled`` to its default which is false.
Graceful Stop
=============
In order to change the shutdown behaviour of nodes of the cluster,
you can utilise the ``cluster.graceful_stop.*`` cluster settings.
Please refer to :ref:`ref-set` for a complete list of settings.
For example to set the timeout to 30 minutes::
cr> SET GLOBAL TRANSIENT cluster.graceful_stop.timeout = 1800000;
SET OK (... sec)
Crate supports string literals for time values the same way as the ``crate.yml`` does.
So you can write the previous statmement as::
cr> SET GLOBAL TRANSIENT cluster.graceful_stop.timeout = '30m';
SET OK (... sec)
Note, that querying a time setting will always return a ``string`` value::
cr> select settings['cluster']['graceful_stop']['timeout'] from sys.cluster;
+-------------------------------------------------+
| settings['cluster']['graceful_stop']['timeout'] |
+-------------------------------------------------+
| 30m |
+-------------------------------------------------+
SELECT 1 row in set (... sec)
::
cr> SET GLOBAL TRANSIENT cluster.graceful_stop = {force=true};
SET OK (... sec)
cr> select settings['cluster']['graceful_stop'] from sys.cluster;
+---------------------------------------------------...-------------------+
| settings['cluster']['graceful_stop'] |
+---------------------------------------------------...-------------------+
| {"force": true, "min_availability": "primaries", ... "timeout": "30m"} |
+---------------------------------------------------...-------------------+
SELECT 1 row in set (... sec)
The default configuration in ``crate.yml`` looks like:
.. code-block:: yaml
graceful_stop:
min_availability: primaries
reallocate: true
timeout: 2h
force: false
.. _configuration: ../configuration.html