1 RRDCACHED(1) rrdtool RRDCACHED(1)
6 rrdcached - Data caching daemon for rrdtool
9 r\brr\brd\bdc\bca\bac\bch\bhe\bed\bd [-\b-l\bl/\b/-\b-L\bL _\ba_\bd_\bd_\br_\be_\bs_\bs] [-\b-w\bw _\bt_\bi_\bm_\be_\bo_\bu_\bt] [-\b-z\bz _\bd_\be_\bl_\ba_\by] [-\b-f\bf _\bt_\bi_\bm_\be_\bo_\bu_\bt]
10 [-\b-p\bp _\bp_\bi_\bd_\b__\bf_\bi_\bl_\be] [-\b-t\bt _\bw_\br_\bi_\bt_\be_\b__\bt_\bh_\br_\be_\ba_\bd_\bs] [-\b-j\bj _\bj_\bo_\bu_\br_\bn_\ba_\bl_\b__\bd_\bi_\br] [-F] [-g]
15 accumulates them and, if enough have been received or a defined time
17 used to force writing of values to disk, so that graphing facilities
18 and similar can work with up-to-date data.
20 The daemon was written with big setups in mind. Those setups usually
21 run into IO related problems sooner or later for reasons that are
22 beyond the scope of this document. Check the wiki at the RRDTool home-
23 page for details. Also check "SECURITY CONSIDERATIONS" below before
24 using this daemon! A detailed description of how the daemon operates
25 can be found in the "HOW IT WORKS" section below.
31 ing that prefix is interpreted as the path to a UNIX domain socket.
32 Otherwise the address or node name are resolved using getaddrinfo.
34 For network sockets, a port may be specified by using the form
35 "[address]:port". If the address is an IPv4 address or a fully
36 qualified domain name (i. e. the address contains at least one dot
37 (".")), the square brackets can be omitted, resulting in the (sim-
40 The following formats are accepted. Please note that the address of
43 unix:</path/to/unix.sock>
44 /<path/to/unix.sock>
45 <hostname-or-ip>
46 [<hostname-or-ip>]:<port>
47 <hostname-or-ipv4>:<port>
50 "unix:/tmp/rrdcached.sock", will be used.
58 not specified the default interval of 300 seconds will be used.
61 If specified, rrdcached will delay writing of each RRD for a random
63 writes being queued simultaneously. This value should be no
65 delay.
69 which are written to disk. This only concerns files to which
70 updates have stopped, so setting this to a high value, such as
71 3600 seconds, is acceptable in most cases. This timeout defaults to
72 3600 seconds.
75 Sets the name and location of the PID-file. If not specified, the
76 default, "$localststedir/run/rrdcached.pid" will be used.
79 Specifies the number of threads used for writing RRD files. The
80 default is 4. Increasing this number will allow rrdcached to have
81 more simultaneous I/O requests into the kernel. This may allow the
82 kernel to re-order disk writes, resulting in better disk through-
83 put.
87 system crash, this will allow the daemon to write any updates that
88 were pending at the time of the crash.
90 On startup, the daemon will check for journal files in this direc-
91 tory. If found, all updates therein will be read into memory
92 before the daemon starts accepting new connections.
94 The journal will be rotated with the same frequency as the flush
97 When journaling is enabled, the daemon will use a fast shutdown
98 procedure. Rather than flushing all files to disk, it will make
99 sure the journal is properly written and exit immediately.
100 Although the RRD data files are not fully up-to-date, no informa-
101 tion is lost; all pending updates will be replayed from the journal
102 next time the daemon starts up.
107 shut down, regardless of journal setting.
112 The daemon will change into a specific directory at startup. All
114 will be interpreted to be relative to this directory. If not given
115 the default, "/tmp", will be used.
117 +------------------------+------------------------+
118 ! Command line ! File updated !
119 +------------------------+------------------------+
120 ! foo.rrd ! /tmp/foo.rrd !
121 ! foo/bar.rrd ! /tmp/foo/bar.rrd !
122 ! /var/lib/rrd/foo.rrd ! /var/lib/rrd/foo.rrd !
123 +------------------------+------------------------+
124 Paths given on the command line and paths actually
125 updated by the daemon, assuming the base directory
126 "/tmp".
128 W\bWA\bAR\bRN\bNI\bIN\bNG\bG:\b: The paths up to and including the base directory M\bMU\bUS\bST\bT N\bNO\bOT\bT
130 fied as:
132 -b /base/dir/somewhere
136 /base
137 /base/dir
138 /base/dir/somewhere
142 taining "../" will also be blocked.
146 command line argument -\b--\b-d\bda\bae\bem\bmo\bon\bn or the environment variable R\bRR\bRD\bD-\b-
162 (see below) to the daemon before accessing the files, so they work with
163 up-to-date data even if the cache timeout is large.
166 The daemon reports errors in one of two ways: During startup, error
167 messages are printed to "STDERR". One of the steps when starting up is
168 to fork to the background and closing "STDERR" - after this writing
169 directly to the user is no longer possible. Once this has happened, the
175 for an entry for that file in its internal tree. If not found, an entry
176 is created including the current time (called "First" in the diagram
178 time the operating system considers to be "now". The value and time of
179 the value (called "Time" in the diagram below) are appended to the tree
180 node.
182 When appending a value to a tree node, it is checked whether it's time
183 to write the values to disk. Values are written to disk if
184 "now() - First >= timeout", where "timeout" is the timeout specified
186 will be enqueued in the "update queue", i. e. they will be appended to
187 the linked list shown below. Because the tree nodes and the elements
188 of the linked list are the same data structures in memory, any update
189 to a file that has already been enqueued will be written with the next
190 write to the RRD file, too.
192 A separate "update thread" constantly dequeues the first element in the
193 update queue and writes all its values to the appropriate file. So as
194 long as the update queue is not empty files are written at the highest
195 possible rate.
197 Since the timeout of files is checked only when new values are added to
198 the file, "dead" files, i. e. files that are not updated anymore, would
199 never be written to disk. Therefore, every now and then, controlled by
201 enqueued. Since this only affects "dead" files and walking the tree is
202 relatively expensive, you should set the "flush interval" to a reason-
203 ably high value. The default is 3600 seconds (one hour).
205 The downside of caching values is that they won't show up in graphs
206 generated from the RRD files. To get around this, the daemon provides
207 the "flush command" to flush specific files. This means that the file
209 already enqueued. The flush command will return only after the file's
210 pending updates have been written to disk.
212 +------+ +------+ +------+
213 ! head ! ! root ! ! tail !
214 +---+--+ +---+--+ +---+--+
215 ! /\ !
216 ! / \ !
217 ! /\ /\ !
218 ! /\/\ \ `----------------- ... --------, !
219 V / `-------, ! V
220 +---+----+---+ +------+-----+ +---+----+---+
221 ! File: foo ! ! File: bar ! ! File: qux !
222 ! First: 101 ! ! First: 119 ! ! First: 180 !
223 ! Next:&bar -+--->! Next:&... -+---> ... --->! Next:NULL !
224 | Prev:NULL !<---+-Prev:&foo !<--- ... ----+-Prev: &... !
225 +============+ +============+ +============+
226 ! Time: 100 ! ! Time: 120 ! ! Time: 180 !
227 ! Value: 10 ! ! Value: 0.1 ! ! Value: 2,2 !
228 +------------+ +------------+ +------------+
229 ! Time: 110 ! ! Time: 130 ! ! Time: 190 !
230 ! Value: 26 ! ! Value: 0.1 ! ! Value: 7,3 !
231 +------------+ +------------+ +------------+
232 : : : : : :
233 +------------+ +------------+ +------------+
234 ! Time: 230 ! ! Time: 250 ! ! Time: 310 !
235 ! Value: 42 ! ! Value: 0.2 ! ! Value: 1,2 !
236 +------------+ +------------+ +------------+
238 The above diagram demonstrates:
240 · Files/values are stored in a (balanced) tree.
242 · Tree nodes and entries in the update queue are the same data struc-
243 ture.
245 · The local time ("First") and the time specified in updates ("Time")
246 may differ.
248 · Timed out values are inserted at the "tail".
250 · Explicitly flushed values are inserted at the "head".
252 · ASCII art rocks.
255 The client/server protocol does not have any authentication or autho-
256 rization mechanism. Therefore, take care to restrict which users can
257 connect to the daemon.
263 For a multi-user environment where only certain users require
264 read/write access, the recommended configuration uses two sockets as
265 follows:
267 -\b-l\bl _\b/_\bp_\br_\bo_\bt_\be_\bc_\bt_\be_\bd_\b/_\bd_\bi_\br_\b/_\br_\br_\bd_\b._\bs_\bo_\bc_\bk
268 Create a high-privilege unix-domain socket. This should be pro-
269 tected with the same Unix permissions that are used to protect the
270 RRD files. Updates should be directed to this socket.
273 Create a low-privilege TCP socket listening on localhost. All
274 users on the local system may use this to trigger FLUSH of individ-
275 ual files. Users with read-only access should be directed to this
276 socket.
278 If you (want to) use the network capability, i. e. let the daemon bind
280 similar mechanism to prevent unauthorized connections. Unless you have
281 a dedicated VLAN or VPN for this, using the network option is probably
282 a bad idea!
284 The daemon will blindly write to any file it gets told, so you really
285 should create a separate user just for this daemon. Also it does not do
286 any sanity checks, so if it gets told to write values for a time far in
287 the future, your files will be messed up good!
289 You have been warned.
292 The daemon communicates with clients using a line based ASCII protocol
293 which is easy to read and easy to type. This makes it easy for scripts
294 to implement the protocol and possible for users to use telnet to con-
295 nect to the daemon and test stuff "by hand".
297 The protocol is line based, this means that each record consists of one
298 or more lines. A line is terminated by the line feed character 0x0A,
299 commonly written as "\n". In the examples below, this character will be
300 written as "<LF>" ("line feed").
302 After the connection has been established, the client is expected to
303 send a "command". A command consists of the command keyword, possibly
304 some arguments, and a terminating newline character. For a list of com-
305 mands, see "Valid Commands" below.
307 Example:
309 FLUSH /tmp/foo.rrd<LF>
311 The daemon answers with a line consisting of a status code and a short
312 status message, separated by one or more space characters. A negative
313 status code signals an error, a positive status code or zero signal
314 success. If the status code is greater than zero, it indicates the num-
315 ber of lines that follow the status line.
317 Examples:
319 0 Success<LF>
321 2 Two lines follow<LF>
322 This is the first line<LF>
323 And this is the second line<LF>
327 The following commands are understood by the daemon:
330 Causes the daemon to put _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be to the h\bhe\bea\bad\bd of the update queue
331 (possibly moving it there if the node is already enqueued). The
335 Causes the daemon to start flushing ALL pending values to disk.
336 This returns immediately, even though the writes may take a long
337 time.
340 Shows any "pending" updates for a file, in order. The updates
341 shown have not yet been written to the underlying RRD file.
344 Removes _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be from the cache. Any pending updates W\bWI\bIL\bLL\bL B\bBE\bE L\bLO\bOS\bST\bT.
347 Shows the files that are on the output queue. Returns zero or more
348 lines in the following format, where <num_vals> is the number of
349 values to be written for the <file>:
351 <num_vals> <file>
356 Otherwise a short description, possibly containing a pointer to a
357 manual page, is returned. Obviously, this is meant for interactive
358 usage and the format in which the commands and usage summaries are
359 returned is not well defined.
362 Returns a list of metrics which can be used to measure the daemons
363 performance and check its status. For a description of the values
364 returned, see "Performance Values" below.
366 The format in which the values are returned is similar to many
367 other line based protocols: Each value is printed on a separate
368 line, each consisting of the name of the value, a colon, one or
369 more spaces and the actual value.
371 Example:
373 9 Statistics follow
374 QueueLength: 0
375 UpdatesReceived: 30
376 FlushesReceived: 2
377 UpdatesWritten: 13
378 DataSetsWritten: 390
379 TreeNodesNumber: 13
380 TreeDepth: 4
381 JournalBytes: 190
382 JournalRotate: 0
384 U\bUP\bPD\bDA\bAT\bTE\bE _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be _\bv_\ba_\bl_\bu_\be_\bs [_\bv_\ba_\bl_\bu_\be_\bs ...]
386 designed for, so describing the mechanism again is unnecessary.
387 Read "HOW IT WORKS" above for a detailed explanation.
389 Note that rrdcached only accepts absolute timestamps in the update
390 values. Updates strings like "N:1:2:3" are automatically converted
391 to absolute time by the RRD client library before sending to rrd-
392 cached.
395 This command is written to the journal after a file is successfully
396 written out to disk. It is used during journal replay to determine
398 journal; it is not accepted from the other command channels.
401 This command initiates the bulk load of multiple commands. This is
402 designed for installations with extremely high update rates, since
406 All commands are executed just as they would be if given individu-
407 ally, except for output to the user. Messages indicating success
408 are suppressed, and error messages are delayed until the client is
409 finished.
411 Command processing is finished when the client sends a dot (".") on
412 its own line. After the client has finished, the server responds
413 with an error count and the list of error messages (if any). Each
414 error messages indicates the number of the command to which it cor-
415 responds, and the error message itself. The first user command
418 client: BATCH
419 server: 0 Go ahead. End with dot '.' on its own line.
420 client: UPDATE x.rrd 1223661439:1:2:3 <--- command #1
421 client: UPDATE y.rrd 1223661440:3:4:5 <--- command #2
422 client: and so on...
423 client: .
424 server: 2 Errors
425 server: 1 message for command 1
426 server: 12 message for command 12
429 Disconnect from rrdcached.
435 Q\bQu\bue\beu\bue\beL\bLe\ben\bng\bgt\bth\bh _\b(_\bu_\bn_\bs_\bi_\bg_\bn_\be_\bd _\b6_\b4_\bb_\bi_\bt _\bi_\bn_\bt_\be_\bg_\be_\br_\b)
436 Number of nodes currently enqueued in the update queue.
438 U\bUp\bpd\bda\bat\bte\bes\bsR\bRe\bec\bce\bei\biv\bve\bed\bd _\b(_\bu_\bn_\bs_\bi_\bg_\bn_\be_\bd _\b6_\b4_\bb_\bi_\bt _\bi_\bn_\bt_\be_\bg_\be_\br_\b)
439 Number of UPDATE commands received.
441 F\bFl\blu\bus\bsh\bhe\bes\bsR\bRe\bec\bce\bei\biv\bve\bed\bd _\b(_\bu_\bn_\bs_\bi_\bg_\bn_\be_\bd _\b6_\b4_\bb_\bi_\bt _\bi_\bn_\bt_\be_\bg_\be_\br_\b)
442 Number of FLUSH commands received.
444 U\bUp\bpd\bda\bat\bte\bes\bsW\bWr\bri\bit\btt\bte\ben\bn _\b(_\bu_\bn_\bs_\bi_\bg_\bn_\be_\bd _\b6_\b4_\bb_\bi_\bt _\bi_\bn_\bt_\be_\bg_\be_\br_\b)
445 Total number of updates, i. e. calls to "rrd_update_r", since the
446 daemon was started.
448 D\bDa\bat\bta\baS\bSe\bet\bts\bsW\bWr\bri\bit\btt\bte\ben\bn _\b(_\bu_\bn_\bs_\bi_\bg_\bn_\be_\bd _\b6_\b4_\bb_\bi_\bt _\bi_\bn_\bt_\be_\bg_\be_\br_\b)
449 Total number of "data sets" written to disk since the daemon was
451 mand. For example: "1223661439:123:456" is one data set with two
452 values. The term "data set" is used to prevent confusion whether
453 individual values or groups of values are counted.
455 T\bTr\bre\bee\beN\bNo\bod\bde\bes\bsN\bNu\bum\bmb\bbe\ber\br _\b(_\bu_\bn_\bs_\bi_\bg_\bn_\be_\bd _\b6_\b4_\bb_\bi_\bt _\bi_\bn_\bt_\be_\bg_\be_\br_\b)
456 Number of nodes in the cache.
458 T\bTr\bre\bee\beD\bDe\bep\bpt\bth\bh _\b(_\bu_\bn_\bs_\bi_\bg_\bn_\be_\bd _\b6_\b4_\bb_\bi_\bt _\bi_\bn_\bt_\be_\bg_\be_\br_\b)
459 Depth of the tree used for fast key lookup.
461 J\bJo\bou\bur\brn\bna\bal\blB\bBy\byt\bte\bes\bs _\b(_\bu_\bn_\bs_\bi_\bg_\bn_\be_\bd _\b6_\b4_\bb_\bi_\bt _\bi_\bn_\bt_\be_\bg_\be_\br_\b)
462 Total number of bytes written to the journal since startup.
464 J\bJo\bou\bur\brn\bna\bal\blR\bRo\bot\bta\bat\bte\be _\b(_\bu_\bn_\bs_\bi_\bg_\bn_\be_\bd _\b6_\b4_\bb_\bi_\bt _\bi_\bn_\bt_\be_\bg_\be_\br_\b)
465 Number of times the journal has been rotated since startup.
468 SIGINT and SIGTERM
469 The daemon exits normally on receipt of either of these signals.
471 options.
473 SIGUSR1
474 The daemon exits AFTER flushing all updates out to disk. This may
475 take a while.
477 SIGUSR2
478 The daemon exits immediately, without flushing updates out to disk.
479 Pending updates will be replayed from the journal when the daemon
480 starts up again. W\bWA\bAR\bRN\bNI\bIN\bNG\bG:\b: i\bif\bf j\bjo\bou\bur\brn\bna\bal\bli\bin\bng\bg (\b(-\b-j\bj)\b) i\bis\bs N\bNO\bOT\bT e\ben\bna\bab\bbl\ble\bed\bd,\b, a\ban\bny\by
481 p\bpe\ben\bnd\bdi\bin\bng\bg u\bup\bpd\bda\bat\bte\bes\bs W\bWI\bIL\bLL\bL B\bBE\bE L\bLO\bOS\bST\bT.
484 No known bugs at the moment.
487 rrdtool, rrdgraph
491 <octo at verplant.org>.
494 kevin brintnall <kbrint@rufus.net>
498 1.3.99909060808 2009-04-09 RRDCACHED(1)