MYSQL_QuickStartGuide-6.5.1

download MYSQL_QuickStartGuide-6.5.1

of 12

Transcript of MYSQL_QuickStartGuide-6.5.1

  • 7/30/2019 MYSQL_QuickStartGuide-6.5.1

    1/12

    TokuDB v6.5.1 with Fractal Tree Indexingfor

    MySQL v5.1.65 and v5.5.24MariaDB v5.2.10 and v5.5.25

    Quick Start Guide for Linux

    Notice: Tokutek and TokuDB are registered trademarks and Fractal Tree is a trademark of Tokutek, Inc.MySQL, InnoDB, and Oracle are registered trademarks of Oracle Corporation.MariaDB is registered trademark of Monty Program AB.

    1TokuDB Quick Start Guide TokuDB v6.5.1

  • 7/30/2019 MYSQL_QuickStartGuide-6.5.1

    2/12

  • 7/30/2019 MYSQL_QuickStartGuide-6.5.1

    3/12

    1. Getting StartedThis guide provides instructions for installing and getting started with TokuDB for MySQL.

    TokuDB is a highly scalable, zero-maintenance downtime storage engine for MySQL and MariaDB that usesFractal Tree Indexes. It enables MySQL and MariaDB to scale from GBs to TBs and provides improved

    query performance, excellent compression, and hot schema flexibility. TokuDB requires no changes to MySQLapplications or code and is fully ACID and MVCC compliant.Providing near seamless compatibility for MySQL applications, data is loaded, inserted, and queried usingstandard MySQL commands, with no restrictions or special requirements. Tables can be individually defined touse TokuDB, MyISAM, InnoDB or other MySQL-compliant storage engines.

    Additional features unique to TokuDB include: Hot schema changes

    Hot index creation: TokuDB tables support insertions, deletions and queries with no down timewhile indexes are being added to that table

    Hot column addition, deletion, expansion, and rename: TokuDB tables support insertions,

    deletions and queries with minimal down time when an alter table adds, deletes, expands, orrenames columns. Fast recovery time (seconds, not hours or days) Immunity to database disorder or "aging" and the gradual performance degradation it causes Up to 25x data compression Eliminates slave lag

    2. System and Hardware Requirements

    Operating Systems: TokuDB v6.5.1 is currently supported on 64-bit Linux only. Formal support is provided forCentOS v5.1-v6.2. TokuDB is expected to work on other Linux distributions, although support will be provided

    only on a best effort basis.

    A virtual machine image is available for evaluations on Windows and Mac, please contact us [email protected] for more information.

    Memory: TokuDB Requires at least 1GB of main memory but for best results, we recommend to run with atleast 2GB of main memory.

    Disk space and configuration: Please make sure to allocate enough disk space for data, indexes and logs.In our users' experience, TokuDB achieves up to 25x space savings on data and indexes over InnoDB due tohigh compression.

    3. Installation

    Tokutek provides a binary version of MySQL 5.1.61, MySQL 5.5.24, MariaDB 5.2.10, or MariaDB 5.5.25 with afew minor changes to support TokuDB. The TokuDB, MyISAM and InnoDB storage engines are included in thedistribution files. The Tokutek distribution includes both the MySQL server and client for your system.

    3TokuDB Quick Start Guide TokuDB v6.5.1

    mailto:[email protected]:[email protected]:[email protected]:[email protected]:[email protected]:[email protected]
  • 7/30/2019 MYSQL_QuickStartGuide-6.5.1

    4/12

    The installation of MySQL from a tarball release file is described nicely in the MySQL 5.5 reference manual:http://dev.mysql.com/doc/refman/5.5/en/installing-binary.html . The following instructions are based on it withinformation specific to TokuDB.

    3.1 DownloadingTo get started, navigate to Tokutek's Support Page: http://www.tokutek.com/support

    Login and download this file to your download directory. The file name should follow the convention: [mysql|mariadb]--tokudb--linux-x86_64.tar.gz. For the purposesof this document, we'll use the name of the tarball corresponding to MySQL 5.5.24 with TokuDB v6.5.1 build49887, make sure you use the name of the tarball corresponding to the file you downloaded.

    After downloading, optionally verify the MD5 checksum by comparing the results of the following command tothe MD5 checksum on the support page:

    md5sum mysql-5.5.24-tokudb-6.5.1-49887-linux-x86_64.tar.gz

    At this point it is a good idea to determine the type of installation you wish to perform. The options are:

    Installing TokuDB on a new server with no previous MySQL installation (see 3.2)

    Installing TokuDB to replace MySQL (see 3.2 and 3.4)

    Upgrading from a previous TokuDB version (see 3.3)

    Local or user space installation, optionally using MySQL Sandbox (see 3.5)

    3.2 Installing TokuDB From Scratch

    All the operations have to be performed with administration privileges (aka 'root' user) since you will need toperform privileged operations. Please check with your specific Linux distribution the appropriate method toperform privileged operations.

    a. Create a MySQL specific group. For CentOS distributions, the group id or GID is set to 27. OtherLinux distributions may vary, even across instances of the same distribution. It is a good idea to set auniform GID across all servers. We will use GID 927 for the rest of this document.

    groupadd -g 927 mysql

    b. Create a MySQL system user. Similar to GID, UID in CentOS distributions is set to 27. The userneeds to be defined as a 'system user', which implies that it won't have a login shell and homedirectory. As with the GID, we will use UID 927 for the rest of this document.

    useradd -r -u 927 -g mysql mysql

    c. Create the installation base directory. You may specify a different sub-directory tree to follow yourinstallations standard.

    mkdir -pv /opt/tokutek

    d. Expand the tarball you downloaded from our website under the base directory. You may use otherdirectories (ie: /usr/local or a private directory).

    cd /opt/tokutek

    4

    TokuDB Quick Start Guide TokuDB v6.5.1

    http://dev.mysql.com/doc/refman/5.5/en/installing-binary.htmlhttp://www.tokutek.com/supporthttp://www.tokutek.com/supporthttp://www.tokutek.com/supporthttp://www.tokutek.com/supporthttp://www.tokutek.com/supporthttp://www.tokutek.com/supporthttp://www.tokutek.com/supporthttp://www.tokutek.com/supporthttp://www.tokutek.com/supporthttp://www.tokutek.com/supporthttp://dev.mysql.com/doc/refman/5.5/en/installing-binary.htmlhttp://dev.mysql.com/doc/refman/5.5/en/installing-binary.htmlhttp://dev.mysql.com/doc/refman/5.5/en/installing-binary.htmlhttp://dev.mysql.com/doc/refman/5.5/en/installing-binary.htmlhttp://dev.mysql.com/doc/refman/5.5/en/installing-binary.htmlhttp://dev.mysql.com/doc/refman/5.5/en/installing-binary.htmlhttp://dev.mysql.com/doc/refman/5.5/en/installing-binary.htmlhttp://dev.mysql.com/doc/refman/5.5/en/installing-binary.htmlhttp://dev.mysql.com/doc/refman/5.5/en/installing-binary.htmlhttp://dev.mysql.com/doc/refman/5.5/en/installing-binary.htmlhttp://dev.mysql.com/doc/refman/5.5/en/installing-binary.htmlhttp://dev.mysql.com/doc/refman/5.5/en/installing-binary.htmlhttp://dev.mysql.com/doc/refman/5.5/en/installing-binary.htmlhttp://dev.mysql.com/doc/refman/5.5/en/installing-binary.htmlhttp://dev.mysql.com/doc/refman/5.5/en/installing-binary.htmlhttp://dev.mysql.com/doc/refman/5.5/en/installing-binary.htmlhttp://dev.mysql.com/doc/refman/5.5/en/installing-binary.htmlhttp://dev.mysql.com/doc/refman/5.5/en/installing-binary.htmlhttp://dev.mysql.com/doc/refman/5.5/en/installing-binary.html
  • 7/30/2019 MYSQL_QuickStartGuide-6.5.1

    5/12

    tar xvzf /path/to/mysql-5.5.24-tokudb-6.5.1-49887-linux-x86_64.tar.gz

    e. Create a symbolic link pointing to the newly create directory. This will simplify future upgrades and/orre-installations by redifining the symbolic link to a new directory:

    ln -sv mysql-5.5.24-tokudb-6.5.1-49887-linux-x86_64 mysql

    f. Change the ownership of the new directory and it's contents to mysql:mysql:

    cd mysqlchown -Rv mysql:mysql .

    g. Create the system tables by running the follow script. If needed, you may specify the options 'basedir'and 'datadir' with the proper paths before the 'user' option:

    scripts/mysql_install_db --user=mysql

    h. Create a default configuration file. You will have to edit this file as needed. You may leave most ofthe default memory allocation values as-is to allow TokuDB to use as much RAM as possible.

    cp -v support-files/my-small.cnf /etc/my.cnf

    i. You might need to edit the resulting/etc/my.cnfto accommodate for non-default data and binary logpaths.

    j. Create a link in/etc/init.d to start TokuDB's server daemon as a service. You will need to:

    i. Edit the 'mysql.server' file and make sure that basedir is set properly. Look for the line startingwith 'basedir=' and add '/opt/tokutek/mysql' (or the directory under which you installed thetarball) after the '=' sign.

    ii. Create a symbolic link under /etc/init.d pointing to the mysql.server script:

    ln -sv /opt/tokutek/mysql/support-files/mysql.server /etc/init.d/mysql

    k. Start MySQL service:

    service mysql start

    You may want to modify your PATH environment variable to include the sub-directory with the client utilities: /opt/tokutek/mysql/bin .Please refer to the section 3.6 Verify the Installation to confirm that everything is running as expected.

    3.3 Upgrading From a Previous Releases of TokuDBTokuDB v6.5.1 supports automatic upgrades from TokuDB versions 4.1, 5.x, and 6.0 using the sameconfiguration and data files from the older versions.It is highly recommended that you have a full working backup of your data before upgrading any MySQLversion. The backup should include the MySQL configuration files as well.

    5TokuDB Quick Start Guide TokuDB v6.5.1

  • 7/30/2019 MYSQL_QuickStartGuide-6.5.1

    6/12

    All the operations have to be performed with administration privileges (aka 'root' user) since you will need toperform privileged operations. Please check with your specific Linux distribution the appropriate method toperform privileged operations.

    a. Create the installation base directory, unless it already exists. You may specify a differentsubdirectory tree to follow your installations standard.

    mkdir -pv /opt/tokutek

    b. Expand the tarball you downloaded from our website under the base directory.

    cd /opt/tokutektar xvzf /path/to/mysql-5.5.24-tokudb-6.5.1-49887-linux-x86_64.tar.gz

    c. Shutdown the existing instance. Make sure that it was a clean shutdown. It is important to makesure there are no pending transactions in the log files prior to the upgrade to avoid any potential datacorruption.

    mysqladmin shutdown

    d. Create a symbolic link pointing to the newly created directory.

    ln -sv mysql-5.5.24-tokudb-6.1.0-48167-linux-x86_64 mysql

    e. Create a link in /etc/init.d to start TokuDB's server daemon as a server. You will need to:

    a. Edit the 'mysql.server' file and make sure that basedir is set properly. Look for the line startingwith 'basedir=' and add '/opt/tokutek/mysql' (or the directory under which you installed thetarball) after the '=' sign.

    b. Create a symbolic link under /etc/init.d pointing to the mysql.server script:

    ln -sv /opt/tokutek/mysql/support-files/mysql.server /etc/init.d/mysql

    f. Start the new MySQL instance. Make sure there were no errors after the startup completed byinspecting the error log.

    service mysql start

    g. Run mysql_upgrade to update the system tables with any changes since the last release. It isimportant that you run the 'mysql_upgrade' utility provided with our binaries.

    /opt/tokutek/mysql/bin/mysql_upgrade

    Please refer to the section 3.6 Verify TokuDB Installation to confirm that everything is running as expected.You should also verify the application data.

    3.4 Replace an Existing MySQL InstanceThe procedure to replace an existing MySQL instance should be the same as to upgrade from an existingTokuDB instance (section 3.3). After converting your tables to TokuDB, you should comment out the globaloptions related to memory caches (ie: innodb_buffer_pool%).

    6TokuDB Quick Start Guide TokuDB v6.5.1

  • 7/30/2019 MYSQL_QuickStartGuide-6.5.1

    7/12

    NOTE 1: When upgrading from a MySQL 5.1 version using InnoDB plugin to MySQL 5.5 or MariaDB, youneed to comment out the lines specifying the InnoDB plugin libraries in yourmy.cnffile. To verify whether ornot the options are enabled, you can use the command:

    my_print_defaults mysqld | grep "ha_inno"

    This command should return no results for TokuDB to start cleanly.

    NOTE 2: Starting with version TokuDB v6.1.0, TokuDB is set to be the default storage engine. Whenmigrating from an existing MySQL or MariaDB installation, you need to specify the default storage engine toInnoDB or MyISAM before the first run. Set one of the following options in the [mysqld] section of the my.cnffile:

    default-storage-engine=MyISAM

    ordefault-storage-engine=InnoDB

    This setting can be removed once the installation has been completed.

    After running the mysql_upgrade script, run the following SQL commands to setup the TokuDB plug-in. Usethe 'mysql' utility. You will need to login into MySQL with a user with sufficient privileges to run the install plugincommand:

    install plugin tokudb soname 'ha_tokudb.so';install plugin tokudb_user_data soname 'ha_tokudb.so';install plugin tokudb_user_data_exact soname 'ha_tokudb.so';install plugin tokudb_file_map soname 'ha_tokudb.so';set global default_storage_engine=TokuDB;

    Please refer to the section 3.6 Verify the Installation to confirm that everything is running as expected. Youshould also verify the application data.

    3.5 Local or User Space InstallationIt is possible to run TokuDB as any regular user. In order to do so, you can extract the tarball in a privatedirectory and run the commands from there. You have to make sure that a number of conditions are met toavoid having permission issues:

    No other MySQL instance should be running on the machine. If there is another one in place, you haveto make sure your configuration will use a different port, log and data files, and configuration files toavoid conflicts.

    Make sure that you set up the log and data directories to a path where your user has full read and writeaccess

    Read the MySQL Documentation section on running multiple instances for full details on how to specifythe different options: 5.3.3. Running Multiple MySQL Instances on Unix.

    The variable 'tokudb_cache_size' is set to 50% of physical RAM on the server. When running multipleinstances of MySQL you may need to adjust it to a more sensible value to avoid memory over

    7TokuDB Quick Start Guide TokuDB v6.5.1

    http://dev.mysql.com/doc/refman/5.5/en/multiple-unix-servers.htmlhttp://dev.mysql.com/doc/refman/5.5/en/multiple-unix-servers.htmlhttp://dev.mysql.com/doc/refman/5.5/en/multiple-unix-servers.htmlhttp://dev.mysql.com/doc/refman/5.5/en/multiple-unix-servers.htmlhttp://dev.mysql.com/doc/refman/5.5/en/multiple-unix-servers.htmlhttp://dev.mysql.com/doc/refman/5.5/en/multiple-unix-servers.htmlhttp://dev.mysql.com/doc/refman/5.5/en/multiple-unix-servers.htmlhttp://dev.mysql.com/doc/refman/5.5/en/multiple-unix-servers.htmlhttp://dev.mysql.com/doc/refman/5.5/en/multiple-unix-servers.htmlhttp://dev.mysql.com/doc/refman/5.5/en/multiple-unix-servers.htmlhttp://dev.mysql.com/doc/refman/5.5/en/multiple-unix-servers.htmlhttp://dev.mysql.com/doc/refman/5.5/en/multiple-unix-servers.htmlhttp://dev.mysql.com/doc/refman/5.5/en/multiple-unix-servers.html
  • 7/30/2019 MYSQL_QuickStartGuide-6.5.1

    8/12

    allocation, which may cause the server to become unresponsive or crash different processes, includingMySQL instances.

    If you decide to use this option, consider using MySQL Sandbox. MySQL Sandbox offers a number of toolsto install one or more MySQL instances as a regular user taking care of all configuration details automatically.Each instance can be run independently or it can set up different replication topologies as well. As a result ofthe installation process, the end user will have a number of scripts to start, stop and connect to each individualinstance without the need to be aware of the configuration and run-time details.

    The procedure to install TokuDB for MySQL Sandbox is no different than regular MySQL. You can read theinstructions to create a single sandbox here.

    3.6 Verify the Installation

    Start a mysql client session in a command line window to verify the TokuDB storage engine installation. Start

    the mysql client utility with the following command:

    /opt/tokutek/mysql/bin/mysql

    The default socket for mysqld is /tmp/mysql.sock. At the command prompt execute the following commands:

    show plugins;

    The output should include the following lines:

    | TokuDB | ACTIVE | STORAGE ENGINE | ha_tokudb.so

    | TokuDB_user_data | ACTIVE | INFORMATION SCHEMA | ha_tokudb.so

    | TokuDB_user_data_exact | ACTIVE | INFORMATION SCHEMA | ha_tokudb.so

    | TokuDB_file_map | ACTIVE | INFORMATION SCHEMA | ha_tokudb.so

    Also execute the following command:

    show engines;

    The output should include the following line:

    | TokuDB | YES | Tokutek TokuDB Storage Engine

    4. Creating Tables and Loading Data

    4.1 Creating TokuDB Tables

    TokuDB tables are created the same way as other tables in MySQL by specifying engine=TokuDB in the table

    definition. For example,

    create table TABLENAME (ID int(11) not null) engine=TokuDB;

    8TokuDB Quick Start Guide TokuDB v6.5.1

    http://www.mysqlsandbox.net/http://search.cpan.org/~gmax/MySQL-Sandbox-3.0.25/lib/MySQL/Sandbox/Recipes.pm#Creating_a_single_sandboxhttp://search.cpan.org/~gmax/MySQL-Sandbox-3.0.25/lib/MySQL/Sandbox/Recipes.pm#Creating_a_single_sandboxhttp://www.mysqlsandbox.net/http://www.mysqlsandbox.net/http://www.mysqlsandbox.net/
  • 7/30/2019 MYSQL_QuickStartGuide-6.5.1

    9/12

    creates a table with name TABLENAME with a single column ID and uses the TokuDB storage engine to store

    its data.

    4.2 Loading Data

    Once TokuDB tables have been created, data can be inserted or loaded using standard MySQL insert or bulk

    load operations. For example:

    load data infile DATA_FILE into table TABLE_NAME;

    loads the data from DATA FILE into the table TABLE NAME. See the MySQL 5.5 reference manual for more

    information on loading data. Please see the user guide for details on how to manage the log sizes in this case.

    Please see the TokuDB Users Guide for details on how to manage the log size in this case.

    4.3 Migrating Data from an Existing Database

    To convert an existing table from another storage engine to use the TokuDB engine,

    alter table engine=TokuDB;

    If you prefer to retain the original table or to manage log size more effectively, you can dump and re-load data

    into a TokuDB table instead. See the FAQ section in the TokuDB Users Guide for details on dumping and re-

    loading and for details on managing the log size.

    5. Additional Questions and Support

    Tokutek looks forward to your feedback on this product and we encourage you to contact us by e-mail at

    [email protected]. Our Technical Services team monitors this email address to ensure prompt andpersonal service.

    The TokuDB User Guide and Frequently Asked Questions (FAQ) are available on our website at http://

    www.tokutek.com/resources/product-docs .

    Our Evaluation Guide will help you understand all the capabilities of TokuDB and how they apply to your

    specific use-case, it can be downloaded at http://www.tokutek.com/resources/tokudb-eval-guide .

    Visit us at http://www.tokutek.com/support for more information.

    A. Appendix

    A.1. Bulk Loading DataThe TokuDB bulk loader imports data much faster than regular MySQL with InnoDB. To make use of the

    loader you need flat files in either comma separated or tab separated format. The MySQL LOAD DATA

    9TokuDB Quick Start Guide TokuDB v6.5.1

    mailto:[email protected]://www.tokutek.com/resources/product-docshttp://www.tokutek.com/resources/product-docshttp://www.tokutek.com/resources/tokudb-eval-guidehttp://www.tokutek.com/supporthttp://www.tokutek.com/supporthttp://www.tokutek.com/supporthttp://www.tokutek.com/supporthttp://www.tokutek.com/supporthttp://www.tokutek.com/supporthttp://www.tokutek.com/supporthttp://www.tokutek.com/supporthttp://www.tokutek.com/supporthttp://www.tokutek.com/supporthttp://www.tokutek.com/resources/tokudb-eval-guidehttp://www.tokutek.com/resources/tokudb-eval-guidehttp://www.tokutek.com/resources/tokudb-eval-guidehttp://www.tokutek.com/resources/tokudb-eval-guidehttp://www.tokutek.com/resources/tokudb-eval-guidehttp://www.tokutek.com/resources/tokudb-eval-guidehttp://www.tokutek.com/resources/tokudb-eval-guidehttp://www.tokutek.com/resources/tokudb-eval-guidehttp://www.tokutek.com/resources/tokudb-eval-guidehttp://www.tokutek.com/resources/tokudb-eval-guidehttp://www.tokutek.com/resources/tokudb-eval-guidehttp://www.tokutek.com/resources/tokudb-eval-guidehttp://www.tokutek.com/resources/tokudb-eval-guidehttp://www.tokutek.com/resources/tokudb-eval-guidehttp://www.tokutek.com/resources/tokudb-eval-guidehttp://www.tokutek.com/resources/product-docshttp://www.tokutek.com/resources/product-docshttp://www.tokutek.com/resources/product-docshttp://www.tokutek.com/resources/product-docshttp://www.tokutek.com/resources/product-docshttp://www.tokutek.com/resources/product-docshttp://www.tokutek.com/resources/product-docshttp://www.tokutek.com/resources/product-docshttp://www.tokutek.com/resources/product-docshttp://www.tokutek.com/resources/product-docshttp://www.tokutek.com/resources/product-docshttp://www.tokutek.com/resources/product-docshttp://www.tokutek.com/resources/product-docsmailto:[email protected]:[email protected]:[email protected]:[email protected]:[email protected]
  • 7/30/2019 MYSQL_QuickStartGuide-6.5.1

    10/12

    INFILE statement will invoke the bulk loader if the table is empty. Keep in mind that while this is the most

    convenient and, in most cases, the fastest way to initialize a TokuDB table, it may not be replication safe if

    applied to the master. Please check MySQL's documentation on the subject.

    The procedure to obtain the logical backup and then bulk load into TokuDB should follow these steps:

    1. Create a logical backup of the original table. The easiest way to achieve this is using SELECT INTO

    OUTFILE. Keep in mind that the file will be created on the server.

    SELECT * FROM my_table INTO OUTFILE 'file_name.csv';

    2. The output file should either be copied to the destination server or the client machine from where you

    plan to load it from.

    3. To load the data into the server use LOAD DATA INFILE. If loading from a machine other than the

    server use the keyword LOCAL to point to the file on local machine. Keep in mind that you will need

    enough disk space on the temporary directory on the server since the local file will be copied onto the

    server by the MySQL client utility.

    LOAD DATA [LOCAL] INFILE 'file_name.csv';

    It is possible to create the CSV file using either 'mysqldump' or the 'mysql' client utility as well, in which case

    the resulting file will reside on a local directory. In these 2 cases you have to make sure to use the correct

    command line options to create a file compatible with LOAD DATA INFILE.

    The bulk loader will use more space than normal for logs and temporary files while running, make sure that

    your file system has enough disk space to process your load. As a rule of thumb, it should be approximately

    1.5x the size of the raw data. If disk space is a concern, you can instruct the bulk loader to avoid using

    temporary files by setting the value of 'tokudb_load_save_space' global variable to ON before starting the load.For example using the statement:

    SET GLOBAL tokudb_load_save_space = ON;

    Note 1: Please read the original MySQL documentation to understand the needed privileges and replicationissues needed around LOAD DATA INFILE.

    A.2. Considerations to Run TokuDB in Production

    In most cases the default options should be left in-place to run TokuDB, however it is a good idea to reviewsome of the configuration parameters.

    A.2.1. Memory allocation

    TokuDB will allocate 50% of the installed RAM for its own cache (global variable 'tokudb_cache_size'). Whilethis is optimal in most situations, there are cases where it may lead to memory over allocation. If the systemtries to allocate more memory than is available the machine will begin swapping and run much slower thannormal.

    10

    TokuDB Quick Start Guide TokuDB v6.5.1

    http://dev.mysql.com/doc/refman/5.5/en/load-data.htmlhttp://dev.mysql.com/doc/refman/5.5/en/select-into.htmlhttp://dev.mysql.com/doc/refman/5.5/en/select-into.htmlhttp://dev.mysql.com/doc/refman/5.5/en/load-data.htmlhttp://dev.mysql.com/doc/refman/5.5/en/replication-features-load-data.htmlhttp://dev.mysql.com/doc/refman/5.5/en/replication-features-load-data.htmlhttp://dev.mysql.com/doc/refman/5.5/en/replication-features-load-data.htmlhttp://dev.mysql.com/doc/refman/5.5/en/replication-features-load-data.htmlhttp://dev.mysql.com/doc/refman/5.5/en/replication-features-load-data.htmlhttp://dev.mysql.com/doc/refman/5.5/en/load-data.htmlhttp://dev.mysql.com/doc/refman/5.5/en/load-data.htmlhttp://dev.mysql.com/doc/refman/5.5/en/load-data.htmlhttp://dev.mysql.com/doc/refman/5.5/en/load-data.htmlhttp://dev.mysql.com/doc/refman/5.5/en/load-data.htmlhttp://dev.mysql.com/doc/refman/5.5/en/select-into.htmlhttp://dev.mysql.com/doc/refman/5.5/en/select-into.htmlhttp://dev.mysql.com/doc/refman/5.5/en/select-into.htmlhttp://dev.mysql.com/doc/refman/5.5/en/select-into.htmlhttp://dev.mysql.com/doc/refman/5.5/en/select-into.htmlhttp://dev.mysql.com/doc/refman/5.5/en/load-data.htmlhttp://dev.mysql.com/doc/refman/5.5/en/load-data.htmlhttp://dev.mysql.com/doc/refman/5.5/en/load-data.htmlhttp://dev.mysql.com/doc/refman/5.5/en/load-data.htmlhttp://dev.mysql.com/doc/refman/5.5/en/load-data.html
  • 7/30/2019 MYSQL_QuickStartGuide-6.5.1

    11/12

    The 2 most frequent cases when it is necessary to set the 'tokudb_cache_size' to a value other than the defaultare:

    Running other memory heavy processes on the same server as TokuDB: In many cases thedatabase process needs to share the system with other server processes like additional databaseinstances, http server, application server, email server, monitoring systems and others. In order toproperly configure TokuDB's memory consumption, it's important to understand how much free memory

    will be left and assign a sensible value for TokuDB. There is no fixed rule, but a conservative choicewould be 50% of available RAM while all the other processes are running. If the result is under 2GB,you should consider moving some of the other processes to a different system or using a dedicateddatabase server.

    'tokudb_cache_size' is a static variable, so it needs to be set before starting the server and cannot bechanged while the server is running. For example, to set up TokuDB's cache to 4G, add the followingline to your my.cnf file:

    tokudb_cache_size = 4G

    System using InnoDB and TokuDB: When using both the TokuDB and InnoDB storage engines you

    need to manage the cache size for each. For example, on a server with 16G of RAM you could use thefollowing values in your configuration file:

    innodb_buffer_pool_size = 2Gtokudb_cache_size = 8G

    A.2.2. Specifying the Location for Files

    As with InnoDB it is possible to specify different locations than the default for TokuDB's data, log andtemporary files. This way you may distribute the load and control the disk space. The 3 variables are:

    tokudb_data_dir: This variable configures the directory name where the TokuDB tables are stored.The default location for TokuDB's data files is the MySQL data directory.

    tokudb_log_dir: This variable configures the directory name where the TokuDB log files are stored.

    The default location for TokuDB's log files is the MySQL data directory. Configuring a separate log

    directory is somewhat involved and should be done only if absolutely necessary. We recommend to

    keep the data and log files under the same directory.

    tokudb_tmp_dir: This variable configures the directory name where the TokuDB bulk loader stores

    temporary files. The bulk loader can create large temporary files while it is loading a table, so putting

    these temporary files on a disk separate from the data directory can be useful. For example, it canmake sense to use a high-performance disk for the data directory and a very inexpensive disk for the

    temporary directory. The default location for TokuDB's temporary files is the MySQL data directory.

    A.3 Installing TokuDB for MariaDB on Ubuntu Server

    11

    TokuDB Quick Start Guide TokuDB v6.5.1

  • 7/30/2019 MYSQL_QuickStartGuide-6.5.1

    12/12

    TokuDB for MariaDB has an unmatched dependency on Ubuntu Server v12.04. Our MariaDB build is

    dependent on libevent v1.4, Ubuntu Servers install libevent v2.0 by default.

    When trying to start the MySQL service without installing the proper library, it will fail with the following error in

    the log file:

    /opt/tokutek/mysql/bin/mysqld: error while loading shared libraries: libevent-1.4.so.2:

    cannot open shared object file: No such file or directory

    To verify which version you have in place you may use the following command:

    dpkg-query -l libevent-*

    | Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend

    |/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)

    ||/ Name Version Description

    +++-===========================-===========================-

    ======================================================================

    ii libevent-1.4-2 1.4.14b-stable-0ubuntu1 asynchronous event

    notification libraryii libevent-2.0-5 2.0.16-stable-1 Asynchronous event

    notification library

    If the line for libevent-1.4* is not in the list, you may install it by issuing the command:sudo apt-get install libevent-1.4

    12

    TokuDB Quick Start Guide TokuDB v6.5.1