Today i want to share experience with latest Percona Server where
TokuDB and TokuBakcup plugins have been added in main
source.
So there is no other steps needed here to get and started.
But in recent discussion in our local community, there was a
question: “How about installing MySQL on CentOS minimal”.
The reason was clear, because somebody got too many errors in
fresh CentOS 7 minimal.
I want to share here full steps.
Please follow numbers:
1. Getting Source package:
[root@testing-host1 ~]# wget
https://www.percona.com/downloads/Percona-Server-5.6/Percona-Server-5.6.27-75.0/source/tarball/percona-server-5.6.27-75.0.tar.gz
Unpacking:
tar -xvf percona-server-5.6.27-75.0.tar.gz
2. Compiling using CMAKE:
If you have read the documentation:
The only command we need is:
cmake . -DCMAKE_BUILD_TYPE=RelWithDebInfo
-DBUILD_CONFIG=mysql_release -DFEATURE_SET=community
-DWITH_EMBEDDED_SERVER=OFF
But if we will test extensively some sort of things with our
build we need to add for eg, Debug + Valgrind facilities or even
Optimizer Tracer.
So our command will look like:
cmake -DCMAKE_INSTALL_PREFIX=/opt/percona-5.6.27
-DMYSQL_DATADIR=/opt/percona-5.6.27/datadir -DSYSCONFDIR=/opt/
-DWITH_SSL=system -DMYSQL_TCP_PORT=3307
-DMYSQL_UNIX_ADDR=/opt/percona-5.6.27/mysqld.sock
-DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci
-DWITH_DEBUG=1 -DCOMPILATION_COMMENT="Shahriyar Rzayev's Percona
Server" -DOPTIMIZER_TRACE=1 -DWITH_ZLIB=system -DWITH_VALGRIND=1
-DCMAKE_C_FLAGS=-DHAVE_purify
-DCMAKE_CXX_FLAGS=-DHAVE_purify
3. Dealing with errors:
While running our cmake command in minimal CentOS our first error will :
-bash: cmake: command not found
Solution is just installing cmake:
yum install cmake
Second error:
CMake Error: CMAKE_C_COMPILER not set, after
EnableLanguage
CMake Error: Internal CMake error, TryCompile configure of cmake
failed
Obvious reason that we have not installed C Compiler yet.
Solution:
yum install gcc
Rerun CMAKE and you can see our next error:
CMake Error: your CXX compiler:
"CMAKE_CXX_COMPILER-NOTFOUND" was not found. Please set
CMAKE_CXX_COMPILER to a valid compiler path or name.
Solution:
yum install gcc-c++
NOTE: Do not forget to clear CmakeLists.txt file each time after error
Next error is about missing Valgrind package of course:
CMake Error at configure.cmake:1102 (MESSAGE):
Unable to find Valgrind header files
valgrind/memcheck.h;valgrind/valgrind.h. Make sure you have them
in your
include path.
Solution:
yum install valgrind valgrind-devel
Another one is:
CMake Error: The following variables are used in this
project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in
the CMake files:
OPENSSL_INCLUDE_DIR
You can resolve this error:
yum install openssl openssl-devel
You may see another error, related to ncurses library:
Could NOT find Curses (missing: CURSES_LIBRARY
CURSES_INCLUDE_PATH)
CMake Error at cmake/readline.cmake:87 (MESSAGE):
Curses library not found. Please install appropriate
package,
Install related package:
yum install ncurses-devel
And maybe there will be error related to readline package too:
-- READLINE_INCLUDE_DIR READLINE_INCLUDE_DIR-NOTFOUND
-- READLINE_LIBRARY READLINE_LIBRARY-NOTFOUND
CMake Error at cmake/readline.cmake:271 (MESSAGE):
Cannot find system readline libraries.
Install missing package:
yum install readline-devel
Also maybe you will get some:
-- Googlemock was not found. gtest-based unit tests will be
disabled. You can run cmake . -DENABLE_DOWNLOADS=1 to
automatically download and build required components from
source.
Just add -DENABLE_DOWNLOADS=1 to cmake command:
cmake -DCMAKE_INSTALL_PREFIX=/opt/percona-5.6.27
-DMYSQL_DATADIR=/opt/percona-5.6.27/datadir -DSYSCONFDIR=/opt/
-DWITH_SSL=system -DMYSQL_TCP_PORT=3307
-DMYSQL_UNIX_ADDR=/opt/percona-5.6.27/mysqld.sock
-DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci
-DWITH_DEBUG=1 -DCOMPILATION_COMMENT="Shahriyar Rzayev's Percona
Server" -DOPTIMIZER_TRACE=1 -DWITH_ZLIB=system -DWITH_VALGRIND=1
-DCMAKE_C_FLAGS=-DHAVE_purify -DCMAKE_CXX_FLAGS=-DHAVE_purify
-DENABLE_DOWNLOADS=1
The result should be:
-- Successfully downloaded
http://googlemock.googlecode.com/files/gmock-1.6.0.zip to
/root/percona-server-5.6.27-75.0/source_downloads
Of course you may see some warnings , on of them will be:
Warning: Bison executable not found in PATH
Resolving:
yum install bison
From now our configuring procedure should be succeed:
-- Configuring done
-- Generating done
-- Build files have been written to:
/root/percona-server-5.6.27-75.0
Now it is time to compile. Just run:
make
and
make install
Now you can start MySQL and use. But be aware that, on the way you can see another type of errors as:
[root@testing-host1 percona-5.6.27]#
./scripts/mysql_install_db --help
FATAL ERROR: please install the following Perl modules before
executing ./scripts/mysql_install_db:
Data::Dumper
Installing missing perl module:
yum install perl-Data-Dumper
4. Starting MySQL
Installing system tables:
[root@testing-host1 percona-5.6.27]#
./scripts/mysql_install_db
--defaults-file=/opt/percona-5.6.27/my.cnf
--datadir=/opt/percona-5.6.27/datadir
With TokuDB there is a dependency on jemalloc package. So before to start Percona Server we must install jemalloc and specify path to “mysqld_safe”.
yum install epel-release
yum install jemalloc
Now we can start MySQL with jemalloc and then activate TokuDB engine and TokuBackup:
Start command:
/opt/percona-5.6.27/bin/mysqld_safe
--defaults-file=/opt/percona-5.6.27/my.cnf --user=root
--datadir=/opt/percona-5.6.27/datadir
--socket=/opt/percona-5.6.27/datadir/mysqld.sock --port=3308
--pid-file=/opt/percona-5.6.27/datadir/percona-new.pid
--log-error=/opt/percona-5.6.27/datadir/error.log
--malloc-lib=/usr/lib64/libjemalloc.so.1
Output:
151117 14:35:59 mysqld_safe Adding
'/usr/lib64/libjemalloc.so.1' to LD_PRELOAD for mysqld
151117 14:35:59 mysqld_safe Logging to
'/opt/percona-5.6.27/datadir/error.log'.
151117 14:35:59 mysqld_safe Starting mysqld daemon with databases
from /opt/percona-5.6.27/datadir
For enabling TokuDB and TokuBackup there is a ps_tokudb_admin tool. But due to report -> LP BUG 1517021 we can’t use this tool because we have used different my.cnf file path here.
So i just want to show how manually activate TokuDB and TokuBackup. First off all, my.cnf file should be updated. Put thp-setting=never under [mysqld_safe] catalog under my.cnf and restart MySQL.
Now connect to MySQL and run:
INSTALL PLUGIN tokudb SONAME 'ha_tokudb.so';
INSTALL PLUGIN tokudb_file_map SONAME 'ha_tokudb.so';
INSTALL PLUGIN tokudb_fractal_tree_info SONAME
'ha_tokudb.so';
INSTALL PLUGIN tokudb_fractal_tree_block_map SONAME
'ha_tokudb.so';
INSTALL PLUGIN tokudb_trx SONAME 'ha_tokudb.so';
INSTALL PLUGIN tokudb_locks SONAME 'ha_tokudb.so';
INSTALL PLUGIN tokudb_lock_waits SONAME 'ha_tokudb.so';
We have activated TokuDB engine:
mysql> show engines;
+--------------------+---------+----------------------------------------------------------------------------+--------------+------+------------+
| Engine | Support | Comment | Transactions | XA | Savepoints
|
+--------------------+---------+----------------------------------------------------------------------------+--------------+------+------------+
| FEDERATED | NO | Federated MySQL storage engine | NULL | NULL |
NULL |
| CSV | YES | CSV storage engine | NO | NO | NO |
| MyISAM | YES | MyISAM storage engine | NO | NO | NO |
| BLACKHOLE | YES | /dev/null storage engine (anything you write
to it disappears) | NO | NO | NO |
| MEMORY | YES | Hash based, stored in memory, useful for
temporary tables | NO | NO | NO |
| TokuDB | YES | Percona TokuDB Storage Engine with Fractal
Tree(tm) Technology | YES | YES | YES |
| MRG_MYISAM | YES | Collection of identical MyISAM tables | NO |
NO | NO |
| ARCHIVE | YES | Archive storage engine | NO | NO | NO |
| InnoDB | DEFAULT | Percona-XtraDB, Supports transactions,
row-level locking, and foreign keys | YES | YES | YES |
| PERFORMANCE_SCHEMA | YES | Performance Schema | NO | NO | NO
|
+--------------------+---------+----------------------------------------------------------------------------+--------------+------+------------+
10 rows in set (0.00 sec)
For activating TokuBackup (backup solution) just add into my.cnf under [mysqld_safe]:
[mysqld_safe]
thp-setting=never
preload-hotbackup
Again restart MySQL and install tokudb_backup plugin:
mysql> INSTALL PLUGIN tokudb_backup SONAME
'tokudb_backup.so';
Query OK, 0 rows affected (0.00 sec)
mysql> select plugin_name, plugin_status from
information_schema.plugins where plugin_name like '%toku%';
+-------------------------------+---------------+
| plugin_name | plugin_status |
+-------------------------------+---------------+
| TokuDB | ACTIVE |
| TokuDB_file_map | ACTIVE |
| TokuDB_fractal_tree_info | ACTIVE |
| TokuDB_fractal_tree_block_map | ACTIVE |
| TokuDB_trx | ACTIVE |
| TokuDB_locks | ACTIVE |
| TokuDB_lock_waits | ACTIVE |
| tokudb_backup | ACTIVE |
+-------------------------------+---------------+
8 rows in set (0.00 sec)
Now you are ready with Percona Server + TokuDB + TokuBackup