Installation

Antony Dovgal edited this page Sep 16, 2015 · 14 revisions

Table of Contents

Installation requirements

Pinba requires MySQL 5.1.x+ or MariaDB 5.1.43+ sources to be built and MySQL 5.1.x+ or MariaDB 5.1.43+ installation to run.

MySQL 5.1 is the first version which supports pluggable storage engines, so older MySQL versions cannot and will not be supported.

In order to build Pinba you need to execute ./configure ..options... && cd include && make in MySQL sources, otherwise my_config.h will be missing.

Make sure you use the same configure options for the sources and MySQL server you're going to use (if you don't build it yourself using the same sources), otherwise you might experience unpredictable crashes and other problems. Pay special attention to these options: --with-big-tables, --with-debug.

Libraries required:

Please make sure libevent is 1.4.1+ at the very least, older versions are not supported.

Pinba versions < 1.1.0 also required this library:

Building Pinba engine

Unpack the Pinba engine archive and start the good old configure & make procedure. If there's no ./configure script, run ./buildconf.sh to create it.

 # ./configure \
       --with-mysql=/path/to/the/sources/of/mysql-5.1 \
       --with-judy=/judy/prefix \
       --with-event=/event/prefix \
       --libdir=/path/to/mysql/plugin/dir
 # make install

For Pinba versions < 1.1.0 use this line:

 # ./configure \
       --with-mysql=/path/to/the/sources/of/mysql-5.1 \
       --with-judy=/judy/prefix \
       --with-protobuf=/protobuf/prefix \
       --with-event=/event/prefix \
       --libdir=/path/to/mysql/plugin/dir

The --libdir option is required in order to get the library installed into the correct directory (but you can always put the lib there manually). Usually the path looks like [MySQL]/lib/mysql/plugin, so if you've installed MySQL using /usr/local/mysql prefix, the path should be /usr/local/mysql/lib/mysql/plugin.

Some OSX-specific hints

Run the following in your terminal (you can use --HEAD to install with newest code):

brew tap in2pire/pinba

Then if you are using mysql, run:

brew install mysql-engine-pinba

Or if you are using percona-server, run:

brew install percona-engine-pinba

Some Ubuntu-specific hints

(c) Max Romanovsky updated by Eugene Klimov (see https://gist.github.com/Slach/d61acbd153ea6d3e6c2b)

These instructions apply to standard mysql-server installation from packages.

1. Download and install these packages:

apt-get install -y git libncurses5-dev libprotobuf-dev libjemalloc-dev libjemalloc1 libjudy-dev libjudydebian1 protobuf-compiler automake autoconf libprotobuf-lite9 libevent-dev libevent-2.0-5 libevent-core-2.0-5 libevent-core-2.0-5 libevent-extra-2.0-5 libevent-openssl-2.0-5 libevent-pthreads-2.0-5 libboost-all-dev cmake

2. Download MySQL sources to some dir: `cd /opt/mysql-source && apt-get source mysql-server-5.x`.
3. Run `cmake /opt/mysql-source/mysql-server-5.x-5.x.x/`.
5. Process to steps described in Official Manual.

see

Pinba engine installation

After you've installed the plugin into the correct plugin directory, you need to enable it in MySQL.
To do this log in to the MySQL console (as root) and execute the following:

 mysql> INSTALL PLUGIN pinba SONAME 'libpinba_engine.so';

We'd also suggest you to create a separate database, this way:

 mysql> CREATE DATABASE pinba;

And then create the default tables:

 # mysql -D pinba < default_tables.sql

You can create more tables later, but these are the default ones.

Pinba extension installation

In order to build Pinba extension you need PHP -devel package installed, which includes phpize, php-config and PHP headers. When you have it, you may proceed with unpacking the archive with the Pinba PHP extension sources and the following commands:

 # phpize
 # ./configure --enable-pinba
 # make install

You might want to add --with-php-config=/path/to/php-config if php-config script is not in your PATH.

Don't forget to add pinba.so to your php.ini and enable Pinba using pinba.enabled=1, see PHP extension for more details.

For OSX users using Homebrew, there are two ways:

  • you can use homebrew to tap in2pire/pinba and install PHP extension. For more information, visit https://github.com/in2pire/homebrew-pinba
  • or you can execute "brew install php*version*-pinba", where php*version* matches the installed PHP version — php53, php54, php55 or php56.