examples
See Dockerfile and build-from-source.sh.
Also there is a rough guide for centos7 in #17 - should be workable for multiple distros really.
requirements
- c++14 compatible compiler (tested with gcc7+, clang7+)
- meow: https://github.com/anton-povarov/meow
- boost: http://boost.org/ (or just install from packages for your distro, need headers only)
- nanomsg: http://nanomsg.org/ (or https://github.com/nanomsg/nanomsg/releases, or just pull master)
- build it statically with
-DCMAKE_C_FLAGS="-fPIC -DPIC"
(see build-from-source.sh for an example) - make sure to adjust NN_MAX_SOCKETS cmake option as it limits the number of reports available, 4096 should be enough for ~700 reports.
- build it statically with
- mysql (5.6+) or mariadb (10+)
- IMPORTANT: just unpacking sources is not enough, as mysql generates required headers on configure and make
- run
cmake . && make
(going to take a while) - cmake might require multiple
*-devel
packages, for stuff like ncurses, openssl, install them using your distro's package manager
To build, run
$ ./buildconf.sh
$ ./configure
--prefix=<path>
--with-mysql=<path to configured mysql sources (built as explained above)>
--with-nanomsg=<nanomsg install dir>
--with-meow=<path>
--with-boost=<path (need headers only)>
$ make -j4
Unfinished, use containers or
- copy mysql_engine/.libs/libpinba_engine2.so (make sure to copy the real .so, not the symlink) to mysql plugin directory
- install plugin
- create database pinba
- create default tables + reports
Something like this
$ rsync -av mysql_engine/.libs/libpinba_engine2.so `mysql_config --plugindir`
$ echo "install plugin pinba soname 'libpinba_engine2.so';" | mysql
$ (maybe change my.cnf here, restart server if you have made changes)
$ echo "create database pinba;" | mysql
$ cat scripts/default_tables/*.sql | mysql
$ cat scripts/default_reports.sql | mysql
Jemalloc
highly recommended to run mysql/mariadb with jemalloc enabled
- mariadb does this automatically (i think) and has been for quite a while
- mysql has --malloc-lib option
- percona has an ok guide
Compatibility
- if mysql/mariadb are built with debug enabled (or you're using debug packages) - build with --enable-debug, or stuff will not work
- make sure that you're building pinba with the same mysql/mariadb version that you're going to install built plugin into, or mysterious crashes might happen
- MARIADB: you might need to change your
plugin_maturity
setting in my.cnf tounknown
(should be possible to get rid of this requirement, please file an issue or send PR)
These are options that go in my.cnf.
You don't need to change any of these, all options have workable defaults.
Address to listen for UDP packets on.
Default: 0.0.0.0 (aka - all interfaces present)
Port to listen for UDP packets on.
Default: 3002
Logging level, one of: debug, info, notice, warn, error, crit, alert
Use 'debug' for debugging :)
Use 'warn' or 'error' for production, should be enough
This value can be changed at runtime with query like set global pinba_log_level='debug';
Default aggregation time_window for all reports. This value is used if you use "default_history_time" as time window in report configuration.
Default: 60 (seconds)
Number of UDP reader threads, default is usually enough here.
Default: 2
Max: 16
Number of internal packet-repack threads, default is usually enough here.
Try tunning higher if stats udp_batches_lost is > 0.
Default: 2
Max: 16
Queue buffer size for udp-reader -> packet-repack threads communication.
Default: 512
Max: 16K
Batch size for packet-repack -> reports communication.
Might want to tune higher if coordinator thread rusage is too high.
Default: 1024
Max: 16K
Max delay between packet-repack thread batches generation (in milliseconds).
This setting basically puts an upper bound on how long packet can be queued before begin transferred to report for processing. Don't set below 10ms unless you know what you're doing.
Default: 100 (milliseconds)
Max: 1000 (milliseconds)
Queue buffer size for packet-repack -> coordinator threads communication.
Default: 128
Max: 1024
Queue buffer size for coordinator -> report threads communication. This setting is per report.
Default: 128
Max: 8192