README.md
author Mahlon E. Smith <mahlon@martini.nu>
Wed, 27 Oct 2021 14:52:54 -0700
changeset 27 38fef53ec76f
parent 25 970ca83c849b
permissions -rw-r--r--
Use standard library namespacing.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
160338bb2822 Add README.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
     1
160338bb2822 Add README.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
     2
Netdata-TSRelay
160338bb2822 Add README.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
     3
===============
160338bb2822 Add README.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
     4
160338bb2822 Add README.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
     5
What's this?
160338bb2822 Add README.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
     6
------------
160338bb2822 Add README.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
     7
160338bb2822 Add README.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
     8
This program is designed to accept JSON streams from
10
252cdb26f76b Fix the netdata link to point the the right spot.
Mahlon E. Smith <mahlon@laika.com>
parents: 5
diff changeset
     9
[Netdata](https://my-netdata.io/) clients, and write metrics to a
252cdb26f76b Fix the netdata link to point the the right spot.
Mahlon E. Smith <mahlon@laika.com>
parents: 5
diff changeset
    10
PostgreSQL table - specifically, [Timescale](http://timescale.com)
252cdb26f76b Fix the netdata link to point the the right spot.
Mahlon E. Smith <mahlon@laika.com>
parents: 5
diff changeset
    11
backed tables (though that's not technically a requirement.)
1
160338bb2822 Add README.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    12
160338bb2822 Add README.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    13
160338bb2822 Add README.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    14
Installation
160338bb2822 Add README.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    15
------------
160338bb2822 Add README.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    16
11
475c9942eb15 Multiple changes:
Mahlon E. Smith <mahlon@laika.com>
parents: 10
diff changeset
    17
You'll need a working [Nim](http://nim-lang.org) build environment and
475c9942eb15 Multiple changes:
Mahlon E. Smith <mahlon@laika.com>
parents: 10
diff changeset
    18
PostgreSQL development headers to compile the binary.
1
160338bb2822 Add README.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    19
11
475c9942eb15 Multiple changes:
Mahlon E. Smith <mahlon@laika.com>
parents: 10
diff changeset
    20
Simply run `make` to build it.  Put it wherever you please.
1
160338bb2822 Add README.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    21
160338bb2822 Add README.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    22
160338bb2822 Add README.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    23
Configuration
160338bb2822 Add README.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    24
-------------
160338bb2822 Add README.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    25
160338bb2822 Add README.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    26
There are a few assumptions that should be satisfied before running
11
475c9942eb15 Multiple changes:
Mahlon E. Smith <mahlon@laika.com>
parents: 10
diff changeset
    27
this successfully.
1
160338bb2822 Add README.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    28
160338bb2822 Add README.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    29
### Database setup
160338bb2822 Add README.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    30
160338bb2822 Add README.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    31
You'll need to create the destination table.
160338bb2822 Add README.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    32
160338bb2822 Add README.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    33
```sql
160338bb2822 Add README.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    34
CREATE TABLE netdata (
160338bb2822 Add README.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    35
	time timestamptz default now() not null,
160338bb2822 Add README.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    36
	host text not null,
160338bb2822 Add README.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    37
	metrics jsonb default '{}'::jsonb not null
160338bb2822 Add README.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    38
);
160338bb2822 Add README.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    39
```
160338bb2822 Add README.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    40
11
475c9942eb15 Multiple changes:
Mahlon E. Smith <mahlon@laika.com>
parents: 10
diff changeset
    41
Index it based on how you intend to query the data, including JSON
475c9942eb15 Multiple changes:
Mahlon E. Smith <mahlon@laika.com>
parents: 10
diff changeset
    42
functional indexing, etc.  See PostgreSQL documentation for details.
1
160338bb2822 Add README.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    43
160338bb2822 Add README.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    44
Strongly encouraged:  Promote this table to a Timescale "hypertable".
11
475c9942eb15 Multiple changes:
Mahlon E. Smith <mahlon@laika.com>
parents: 10
diff changeset
    45
See [Timescale](http://timescale.com) docs for that, but a quick example
475c9942eb15 Multiple changes:
Mahlon E. Smith <mahlon@laika.com>
parents: 10
diff changeset
    46
to partition automatically at weekly boundaries would look something
14
717e89280a20 Update README Timescale example for v0.9.0.
Mahlon E. Smith <mahlon@laika.com>
parents: 13
diff changeset
    47
like this, if you're running v0.9.0 or better:
3
f34855556f4d Add timescale creation example.
Mahlon E. Smith <mahlon@laika.com>
parents: 1
diff changeset
    48
f34855556f4d Add timescale creation example.
Mahlon E. Smith <mahlon@laika.com>
parents: 1
diff changeset
    49
```sql
14
717e89280a20 Update README Timescale example for v0.9.0.
Mahlon E. Smith <mahlon@laika.com>
parents: 13
diff changeset
    50
SELECT create_hypertable( 'netdata', 'time', migrate_data => true, chunk_time_interval => '1 week'::interval );
3
f34855556f4d Add timescale creation example.
Mahlon E. Smith <mahlon@laika.com>
parents: 1
diff changeset
    51
```
1
160338bb2822 Add README.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    52
11
475c9942eb15 Multiple changes:
Mahlon E. Smith <mahlon@laika.com>
parents: 10
diff changeset
    53
Timescale also has some great examples and advice for efficient [JSON
25
970ca83c849b Fix link to Timescale JSON docs.
Mahlon E. Smith <mahlon@martini.nu>
parents: 21
diff changeset
    54
indexing](https://docs.timescale.com/timescaledb/latest/how-to-guides/schema-management/json/#json)
11
475c9942eb15 Multiple changes:
Mahlon E. Smith <mahlon@laika.com>
parents: 10
diff changeset
    55
and queries.
1
160338bb2822 Add README.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    56
160338bb2822 Add README.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    57
160338bb2822 Add README.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    58
### Netdata
160338bb2822 Add README.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    59
160338bb2822 Add README.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    60
You'll likely want to pare down what netdata is sending.  Here's an
19
1f09cfb560e0 Multiple changes.
Mahlon E. Smith <mahlon@martini.nu>
parents: 14
diff changeset
    61
example configuration for `exporting.conf` -- season this to taste (what
11
475c9942eb15 Multiple changes:
Mahlon E. Smith <mahlon@laika.com>
parents: 10
diff changeset
    62
charts to send and frequency.)
1
160338bb2822 Add README.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    63
19
1f09cfb560e0 Multiple changes.
Mahlon E. Smith <mahlon@martini.nu>
parents: 14
diff changeset
    64
Note: This example uses the "exporting" module introduced in
1f09cfb560e0 Multiple changes.
Mahlon E. Smith <mahlon@martini.nu>
parents: 14
diff changeset
    65
Netdata v1.23.  If your netdata is older than that, you'll be using
1f09cfb560e0 Multiple changes.
Mahlon E. Smith <mahlon@martini.nu>
parents: 14
diff changeset
    66
the deprecated "backend" instead in the main `netdata.conf` file.
1f09cfb560e0 Multiple changes.
Mahlon E. Smith <mahlon@martini.nu>
parents: 14
diff changeset
    67
1
160338bb2822 Add README.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    68
```
19
1f09cfb560e0 Multiple changes.
Mahlon E. Smith <mahlon@martini.nu>
parents: 14
diff changeset
    69
[exporting:global]
21
a2fe9ec4cdf2 Fix docs: exporting.conf example and help verbose/version typo.
Mahlon E. Smith <mahlon@laika.com>
parents: 19
diff changeset
    70
	enabled  = yes
a2fe9ec4cdf2 Fix docs: exporting.conf example and help verbose/version typo.
Mahlon E. Smith <mahlon@laika.com>
parents: 19
diff changeset
    71
	hostname = your-hostname
19
1f09cfb560e0 Multiple changes.
Mahlon E. Smith <mahlon@martini.nu>
parents: 14
diff changeset
    72
1f09cfb560e0 Multiple changes.
Mahlon E. Smith <mahlon@martini.nu>
parents: 14
diff changeset
    73
[json:timescale]
1f09cfb560e0 Multiple changes.
Mahlon E. Smith <mahlon@martini.nu>
parents: 14
diff changeset
    74
	enabled              = yes
1f09cfb560e0 Multiple changes.
Mahlon E. Smith <mahlon@martini.nu>
parents: 14
diff changeset
    75
	data source          = average
1f09cfb560e0 Multiple changes.
Mahlon E. Smith <mahlon@martini.nu>
parents: 14
diff changeset
    76
	destination          = localhost:14866
1f09cfb560e0 Multiple changes.
Mahlon E. Smith <mahlon@martini.nu>
parents: 14
diff changeset
    77
	prefix               = netdata
1f09cfb560e0 Multiple changes.
Mahlon E. Smith <mahlon@martini.nu>
parents: 14
diff changeset
    78
	update every         = 10
1f09cfb560e0 Multiple changes.
Mahlon E. Smith <mahlon@martini.nu>
parents: 14
diff changeset
    79
	buffer on failures   = 10
1f09cfb560e0 Multiple changes.
Mahlon E. Smith <mahlon@martini.nu>
parents: 14
diff changeset
    80
	send charts matching = !cpu.cpu* !ipv6* !users.* nfs.rpc net.* net_drops.* net_packets.* !system.interrupts* system.* disk.* disk_space.* disk_ops.* mem.*
1
160338bb2822 Add README.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    81
```
160338bb2822 Add README.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    82
11
475c9942eb15 Multiple changes:
Mahlon E. Smith <mahlon@laika.com>
parents: 10
diff changeset
    83
475c9942eb15 Multiple changes:
Mahlon E. Smith <mahlon@laika.com>
parents: 10
diff changeset
    84
Running the Relay
475c9942eb15 Multiple changes:
Mahlon E. Smith <mahlon@laika.com>
parents: 10
diff changeset
    85
-----------------
475c9942eb15 Multiple changes:
Mahlon E. Smith <mahlon@laika.com>
parents: 10
diff changeset
    86
475c9942eb15 Multiple changes:
Mahlon E. Smith <mahlon@laika.com>
parents: 10
diff changeset
    87
### Options
475c9942eb15 Multiple changes:
Mahlon E. Smith <mahlon@laika.com>
parents: 10
diff changeset
    88
475c9942eb15 Multiple changes:
Mahlon E. Smith <mahlon@laika.com>
parents: 10
diff changeset
    89
  * [-q|--quiet]:    Quiet mode.  No output at all. Ignored if -d is supplied.
475c9942eb15 Multiple changes:
Mahlon E. Smith <mahlon@laika.com>
parents: 10
diff changeset
    90
  * [-d|--debug]:    Debug mode.  Show incoming data.
19
1f09cfb560e0 Multiple changes.
Mahlon E. Smith <mahlon@martini.nu>
parents: 14
diff changeset
    91
  * [-D|--dropconn]: Drop the TCP connection to netdata between samples.
1f09cfb560e0 Multiple changes.
Mahlon E. Smith <mahlon@martini.nu>
parents: 14
diff changeset
    92
                     This may be more efficient depending on your environment and
1f09cfb560e0 Multiple changes.
Mahlon E. Smith <mahlon@martini.nu>
parents: 14
diff changeset
    93
                     number of clients.  Defaults to false.
1f09cfb560e0 Multiple changes.
Mahlon E. Smith <mahlon@martini.nu>
parents: 14
diff changeset
    94
  * [-o|--dbopts]:   PostgreSQL connection information.  (See below for more details.)
11
475c9942eb15 Multiple changes:
Mahlon E. Smith <mahlon@laika.com>
parents: 10
diff changeset
    95
  * [-h|--help]:     Display quick help text.
19
1f09cfb560e0 Multiple changes.
Mahlon E. Smith <mahlon@martini.nu>
parents: 14
diff changeset
    96
  * [-a|--listen-addr]: A specific IP address to listen on.  Defaults to **INADDR_ANY**.
1f09cfb560e0 Multiple changes.
Mahlon E. Smith <mahlon@martini.nu>
parents: 14
diff changeset
    97
  * [-p|--listen-port]: The port to listen for netdata JSON streams.
12
450df27eaeec Fix typos, add small "scaling" section.
Mahlon E. Smith <mahlon@laika.com>
parents: 11
diff changeset
    98
                     Default is **14866**.
19
1f09cfb560e0 Multiple changes.
Mahlon E. Smith <mahlon@martini.nu>
parents: 14
diff changeset
    99
  * [-P|--persistent]: Don't disconnect from the database between samples. This may be
1f09cfb560e0 Multiple changes.
Mahlon E. Smith <mahlon@martini.nu>
parents: 14
diff changeset
   100
                     more efficient with a small number of clients, when not using a
1f09cfb560e0 Multiple changes.
Mahlon E. Smith <mahlon@martini.nu>
parents: 14
diff changeset
   101
                     pooler, or with a very high sample size/rate.  Defaults to false.
11
475c9942eb15 Multiple changes:
Mahlon E. Smith <mahlon@laika.com>
parents: 10
diff changeset
   102
  * [-T|--dbtable]:  Change the table name to insert to.  Defaults to **netdata**.
475c9942eb15 Multiple changes:
Mahlon E. Smith <mahlon@laika.com>
parents: 10
diff changeset
   103
  * [-t|--timeout]:  Maximum time in milliseconds to wait for data.  Slow
12
450df27eaeec Fix typos, add small "scaling" section.
Mahlon E. Smith <mahlon@laika.com>
parents: 11
diff changeset
   104
                     connections may need to increase this from the default **500** ms.
11
475c9942eb15 Multiple changes:
Mahlon E. Smith <mahlon@laika.com>
parents: 10
diff changeset
   105
  * [-v|--version]:  Show version.
475c9942eb15 Multiple changes:
Mahlon E. Smith <mahlon@laika.com>
parents: 10
diff changeset
   106
475c9942eb15 Multiple changes:
Mahlon E. Smith <mahlon@laika.com>
parents: 10
diff changeset
   107
19
1f09cfb560e0 Multiple changes.
Mahlon E. Smith <mahlon@martini.nu>
parents: 14
diff changeset
   108
11
475c9942eb15 Multiple changes:
Mahlon E. Smith <mahlon@laika.com>
parents: 10
diff changeset
   109
**Notes**
475c9942eb15 Multiple changes:
Mahlon E. Smith <mahlon@laika.com>
parents: 10
diff changeset
   110
475c9942eb15 Multiple changes:
Mahlon E. Smith <mahlon@laika.com>
parents: 10
diff changeset
   111
Nim option parsing might be slightly different than what you're used to.
475c9942eb15 Multiple changes:
Mahlon E. Smith <mahlon@laika.com>
parents: 10
diff changeset
   112
Flags that require arguments must include an '=' or ':' character.
475c9942eb15 Multiple changes:
Mahlon E. Smith <mahlon@laika.com>
parents: 10
diff changeset
   113
475c9942eb15 Multiple changes:
Mahlon E. Smith <mahlon@laika.com>
parents: 10
diff changeset
   114
  * --timeout=1000  *valid*
475c9942eb15 Multiple changes:
Mahlon E. Smith <mahlon@laika.com>
parents: 10
diff changeset
   115
  * --timeout:1000  *valid*
12
450df27eaeec Fix typos, add small "scaling" section.
Mahlon E. Smith <mahlon@laika.com>
parents: 11
diff changeset
   116
  * -t:1000  *valid*
11
475c9942eb15 Multiple changes:
Mahlon E. Smith <mahlon@laika.com>
parents: 10
diff changeset
   117
  * --timeout 1000  *invalid*
475c9942eb15 Multiple changes:
Mahlon E. Smith <mahlon@laika.com>
parents: 10
diff changeset
   118
  * -t 1000  *invalid*
475c9942eb15 Multiple changes:
Mahlon E. Smith <mahlon@laika.com>
parents: 10
diff changeset
   119
475c9942eb15 Multiple changes:
Mahlon E. Smith <mahlon@laika.com>
parents: 10
diff changeset
   120
All database connection options are passed as a key/val string to the
475c9942eb15 Multiple changes:
Mahlon E. Smith <mahlon@laika.com>
parents: 10
diff changeset
   121
*dbopts* flag.  The default is:
475c9942eb15 Multiple changes:
Mahlon E. Smith <mahlon@laika.com>
parents: 10
diff changeset
   122
13
e1777929ba15 Remove port and user from the default dbopts, so they instead use the postgresql behavioral default.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   123
	"host=localhost dbname=netdata application_name=netdata-tsrelay"
e1777929ba15 Remove port and user from the default dbopts, so they instead use the postgresql behavioral default.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   124
e1777929ba15 Remove port and user from the default dbopts, so they instead use the postgresql behavioral default.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   125
... which uses the default PostgreSQL port, and connects as the running
e1777929ba15 Remove port and user from the default dbopts, so they instead use the postgresql behavioral default.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   126
user.
11
475c9942eb15 Multiple changes:
Mahlon E. Smith <mahlon@laika.com>
parents: 10
diff changeset
   127
19
1f09cfb560e0 Multiple changes.
Mahlon E. Smith <mahlon@martini.nu>
parents: 14
diff changeset
   128
Reference the [PostgreSQL Documentation](https://www.postgresql.org/docs/current/static/libpq-connect.html#LIBPQ-PARAMKEYWORDS)
1f09cfb560e0 Multiple changes.
Mahlon E. Smith <mahlon@martini.nu>
parents: 14
diff changeset
   129
for all available options (including how to store passwords in a
1f09cfb560e0 Multiple changes.
Mahlon E. Smith <mahlon@martini.nu>
parents: 14
diff changeset
   130
separate file, enable SSL mode, etc.)
11
475c9942eb15 Multiple changes:
Mahlon E. Smith <mahlon@laika.com>
parents: 10
diff changeset
   131
475c9942eb15 Multiple changes:
Mahlon E. Smith <mahlon@laika.com>
parents: 10
diff changeset
   132
475c9942eb15 Multiple changes:
Mahlon E. Smith <mahlon@laika.com>
parents: 10
diff changeset
   133
### Daemonizing
475c9942eb15 Multiple changes:
Mahlon E. Smith <mahlon@laika.com>
parents: 10
diff changeset
   134
475c9942eb15 Multiple changes:
Mahlon E. Smith <mahlon@laika.com>
parents: 10
diff changeset
   135
Use a tool of your choice to run this at system
475c9942eb15 Multiple changes:
Mahlon E. Smith <mahlon@laika.com>
parents: 10
diff changeset
   136
startup in the background.  My personal preference is
475c9942eb15 Multiple changes:
Mahlon E. Smith <mahlon@laika.com>
parents: 10
diff changeset
   137
[daemontools](https://cr.yp.to/daemontools.html), but I won't judge you
475c9942eb15 Multiple changes:
Mahlon E. Smith <mahlon@laika.com>
parents: 10
diff changeset
   138
if you use something else.
475c9942eb15 Multiple changes:
Mahlon E. Smith <mahlon@laika.com>
parents: 10
diff changeset
   139
475c9942eb15 Multiple changes:
Mahlon E. Smith <mahlon@laika.com>
parents: 10
diff changeset
   140
Here's an example using the simple
475c9942eb15 Multiple changes:
Mahlon E. Smith <mahlon@laika.com>
parents: 10
diff changeset
   141
[daemon](https://www.freebsd.org/cgi/man.cgi?query=daemon&apropos=0&sektion=8&manpath=FreeBSD+11.0-RELEASE+and+Ports&arch=default&format=html) wrapper tool:
475c9942eb15 Multiple changes:
Mahlon E. Smith <mahlon@laika.com>
parents: 10
diff changeset
   142
475c9942eb15 Multiple changes:
Mahlon E. Smith <mahlon@laika.com>
parents: 10
diff changeset
   143
	# daemon \
475c9942eb15 Multiple changes:
Mahlon E. Smith <mahlon@laika.com>
parents: 10
diff changeset
   144
		-o /var/log/netdata_tsrelay.log \
475c9942eb15 Multiple changes:
Mahlon E. Smith <mahlon@laika.com>
parents: 10
diff changeset
   145
		-p /var/run/netdata_tsrelay.pid \
475c9942eb15 Multiple changes:
Mahlon E. Smith <mahlon@laika.com>
parents: 10
diff changeset
   146
		-u nobody -cr \
475c9942eb15 Multiple changes:
Mahlon E. Smith <mahlon@laika.com>
parents: 10
diff changeset
   147
		/usr/local/bin/netdata_tsrelay \
475c9942eb15 Multiple changes:
Mahlon E. Smith <mahlon@laika.com>
parents: 10
diff changeset
   148
			--dbopts="dbname=metrics user=metrics host=db-master port=6432 application_name=netdata-tsrelay"
475c9942eb15 Multiple changes:
Mahlon E. Smith <mahlon@laika.com>
parents: 10
diff changeset
   149
12
450df27eaeec Fix typos, add small "scaling" section.
Mahlon E. Smith <mahlon@laika.com>
parents: 11
diff changeset
   150
### Scaling
450df27eaeec Fix typos, add small "scaling" section.
Mahlon E. Smith <mahlon@laika.com>
parents: 11
diff changeset
   151
450df27eaeec Fix typos, add small "scaling" section.
Mahlon E. Smith <mahlon@laika.com>
parents: 11
diff changeset
   152
Though performant by default, if you're going to be storing a LOT of
450df27eaeec Fix typos, add small "scaling" section.
Mahlon E. Smith <mahlon@laika.com>
parents: 11
diff changeset
   153
data (or have a lot of netdata clients), here are some suggestions for
450df27eaeec Fix typos, add small "scaling" section.
Mahlon E. Smith <mahlon@laika.com>
parents: 11
diff changeset
   154
getting the most bang for your buck:
450df27eaeec Fix typos, add small "scaling" section.
Mahlon E. Smith <mahlon@laika.com>
parents: 11
diff changeset
   155
450df27eaeec Fix typos, add small "scaling" section.
Mahlon E. Smith <mahlon@laika.com>
parents: 11
diff changeset
   156
  * Use the [pgbouncer](https://pgbouncer.github.io/) connection
450df27eaeec Fix typos, add small "scaling" section.
Mahlon E. Smith <mahlon@laika.com>
parents: 11
diff changeset
   157
    pooler.
450df27eaeec Fix typos, add small "scaling" section.
Mahlon E. Smith <mahlon@laika.com>
parents: 11
diff changeset
   158
  * DNS round robin the hostname where **netdata_tsrelay** lives across
450df27eaeec Fix typos, add small "scaling" section.
Mahlon E. Smith <mahlon@laika.com>
parents: 11
diff changeset
   159
    *N* hosts -- you can horizontally scale without any gotchas.
450df27eaeec Fix typos, add small "scaling" section.
Mahlon E. Smith <mahlon@laika.com>
parents: 11
diff changeset
   160
  * Edit your **netdata.conf** file to only send the metrics you are
450df27eaeec Fix typos, add small "scaling" section.
Mahlon E. Smith <mahlon@laika.com>
parents: 11
diff changeset
   161
    interested in.
450df27eaeec Fix typos, add small "scaling" section.
Mahlon E. Smith <mahlon@laika.com>
parents: 11
diff changeset
   162
  * Decrease the frequency at which netdata sends its data. (When in
450df27eaeec Fix typos, add small "scaling" section.
Mahlon E. Smith <mahlon@laika.com>
parents: 11
diff changeset
   163
    "average" mode, it averages over that time automatically.)
450df27eaeec Fix typos, add small "scaling" section.
Mahlon E. Smith <mahlon@laika.com>
parents: 11
diff changeset
   164
  * Use [Timescale](http://timescale.com) hypertables.
450df27eaeec Fix typos, add small "scaling" section.
Mahlon E. Smith <mahlon@laika.com>
parents: 11
diff changeset
   165
  * Add database indexes specific to how you intend to consume the data.
450df27eaeec Fix typos, add small "scaling" section.
Mahlon E. Smith <mahlon@laika.com>
parents: 11
diff changeset
   166
  * Use the PostgreSQL
450df27eaeec Fix typos, add small "scaling" section.
Mahlon E. Smith <mahlon@laika.com>
parents: 11
diff changeset
   167
    [JSON Operators](https://www.postgresql.org/docs/current/static/functions-json.html#FUNCTIONS-JSONB-OP-TABLE),
450df27eaeec Fix typos, add small "scaling" section.
Mahlon E. Smith <mahlon@laika.com>
parents: 11
diff changeset
   168
	which take advantage of GIN indexing.
450df27eaeec Fix typos, add small "scaling" section.
Mahlon E. Smith <mahlon@laika.com>
parents: 11
diff changeset
   169
  * Put convenience SQL VIEWs around the data you're fetching later, for
450df27eaeec Fix typos, add small "scaling" section.
Mahlon E. Smith <mahlon@laika.com>
parents: 11
diff changeset
   170
    easier graph building with [Grafana](https://grafana.com/) (or whatever.)
450df27eaeec Fix typos, add small "scaling" section.
Mahlon E. Smith <mahlon@laika.com>
parents: 11
diff changeset
   171