Install the Percona server on CentOS 7

Source: Internet
Author: User
Tags percona percona server

Install the Percona server on CentOS 7

In this article, we will learn about the Percona server, an open-source MySQL and MariaDB alternative. The InnoDB database engine makes the Percona server very attractive. If you need a high-performance, high-reliability, and cost-effective solution, it will be a good choice.

The following describes how to install the Percona server on CentOS7 and how to back up the current data, configure the steps, and recover the backup.

1. What is Percona and why is it used?

Percona is an open-source alternative to MySQL and MariaDB. It is a branch of MySQL. Many improvements and unique features make it more reliable, more powerful, and faster than MYSQL, it is fully compatible with MYSQL, and you can even use replication between Oracle MySQL and Percona.

Unique features in Percona

Adaptive hash search for partitions

Quick Verification Algorithm

Buffer Pool pre-loading

Support for FlashCache

Special features in MySQL Enterprise Edition and Percona

Import tables from different servers

PAM Authentication

Audit Log

Thread Pool

Now, you are very excited to see these good things integrated, we will show you how to install and make basic configuration for PerconaServer.

2. Back up your database

Next, use the SQL command on the command line to create a mydatabases. SQL file to recreate or restore the salesdb and employeedb databases. Replace the database name according to your settings. skip this step if MySQL is not installed:

Mysqldump-uroot-p -- databasesemployeedbsalesdb> mydatabases. SQL

Copy the current configuration file. skip this step if you have not installed MYSQL:

Cpmy. cnfmy. cnf. bkp

3. Delete the previous SQL Server

Stop MYSQL/MariaDB if they are still running:

Systemctlstopmysql. service

Uninstall MariaDB and MYSQL:

YumremoveMariaDB-serverMariaDB-clientMariaDB-sharedmysqlmysql-server

Move the rename to the MariaDB file in/var/lib/mysql. This is safer and faster than just removing, just like 2-level instant backup. :)

Mv/var/lib/mysql/var/lib/mysql_mariadb

4. Use a binary package to install Percona

You can choose among the many Percona installation methods. Using Yum or RPM package in CentOS is usually a better idea, so these are the methods described in this article, download the source file and install it in this article.

Install from the Yum Repository:

First, you need to set the Yum library of Percona:

Yuminstallhttp: // www.percona.com/downloads/percona-release/redhat/0.1-3/percona-release-0.1-3.noarch.rpm

Next, install Percona:

YuminstallPercona-Server-client-56Percona-Server-server-56

The preceding command installs the server and client and shared library of Percona, which may require Perl and Perl modules and other dependent requirements, such as DBI: MySQL. If these are not yet installed, you may need to install more dependent packages.

Install with an RPM package:

We can use the wget command to download all rpm packages:

Wget-r-l1-nd-Arpm-R "* devel *, * debuginfo *"\

Http://www.percona.com/downloads/Percona-Server-5.5/Percona-Server-5.5.42-37.1/binary/redhat/7/x86_64/

Use the rpm tool to install all the rpm packages at one time:

Rpm-ivhPercona-Server-server-55-5.5.42-rel37.1.el7.x86_64.rpm \

Percona-Server-client-55-5.5.42-rel37.1.el7.x86_64.rpm \

Percona-Server-shared-55-5.5.42-rel37.1.el7.x86_64.rpm

Note the backslash '\' At the end of the preceding command Statement (for the convenience of line feed ). If you install a separate software package, remember to resolve the dependency. Before installing the client, you must first install the shared package. Before installing the server, install the client.

5. Configure the Percona Server

Restore the previous configuration

When we migrate data from MariaDB, you can restore the backup file of my. cnf.

Cp/etc/my. cnf. bkp/etc/my. cnf

Create a new my. cnf File

If you need a new configuration file that suits your needs or you have not backed up the configuration file, you can use the following method to generate a new configuration file in a few simple steps.

The following is the my. cnf file that comes with the Percona-server software package.

# PerconaServertemplateconfiguration

[Mysqld]

#

# Removeleading # andsettotheamountofRAMforthemostimportantdata

# CacheinMySQL. Startat70 % oftotalRAMfordedicatedserver, else10 %.

# Innodb_buffer_pool_size = 128 M

#

# Removeleading # toturnonaveryimportantdataintegrityoption: logging

# Changestothebinarylogbetweenbackups.

# Log_bin

#

# Removeleading # tosetoptionsmainlyusefulforreportingservers.

# Theserverdefasarsarefasterfortransactionsandfastselects.

# Adjustsizesasneeded, experimenttofindtheoptimalvalues.

# Join_buffer_size = 128 M

# Sort_buffer_size = 2 M

# Read_rnd_buffer_size = 2 M

Datadir =/var/lib/mysql

Socket =/var/lib/mysql. sock

# Disablingsymbolic-linksisrecommendedtopreventassortedsecurityrisks

Symbolic-links = 0

[Mysqld_safe]

Log-error =/var/log/mysqld. log

Pid-file =/var/run/mysqld. pid

After configuring my. cnf as needed, you can start the service:

Systemctlrestartmysql. service

If everything goes well, it is ready to execute the SQL command. You can run the following command to check whether it has been started properly:

Mysql-uroot-p-e 'showvariableslike "version_comment "'

If you cannot start it normally, you can go to/var/log/mysql/mysqld. log to find the cause. This file can be found in my. set in log-error of [mysql_safe] of cnf.

Tail/var/log/mysql/mysqld. log

You can also find the file in the format of [host name]. err in the/var/lib/mysql/folder, as shown in the following example:

Tail/var/lib/mysql/centos7.err

If you still haven't found the cause, try strace:

Yuminstallstrace & systemctlstopmysql. service & strace-f-fmysqld_safe

The command above is quite long and the output result is relatively simple, but you can find the reason why it cannot be started most of the time.

6. Protect your data

Well, your relational database management system is ready to receive SQL queries, but it is not advisable to put your valuable data on servers without minimum security protection, for security purposes, it is best to install mysqlsecureinstall. This tool helps you delete unused default functions and set the root password to restrict access by this user. You only need to execute this command in shell and follow the instructions on the screen.

Mysql_secure_install

7. Restore backup

If you can restore the database by referring to the previous settings, you only need to use mysqldump once.

Mysqldump-uroot-p <mydatabases. SQL

Congratulations, you have just installed Percona on your CentOS and your server is ready for use. You can use it like using MySQL, your server is fully compatible with it.

Summary

To achieve better performance, you need to make a lot of modifications to the configuration file, but here there are some simple options to improve the performance of the machine. When the InnoDB engine is used, set innodbfileper_table to on. It creates an index table for each table in a file, which means that each table has its own index file, it makes the system much stronger and easier to maintain.

You can modify the innodbbufferpool_size option. InnoDB should have enough cache pools to handle your data set. The size should be 70% to 80% of the available memory.

Set innodb-flush-method to O_DIRECT to disable writing to high-speed cache. If RAID is used, this can improve performance because the cache operation has been completed at the underlying layer.

If your data is not critical and you do not need to be fully compatible with the four basic elements of the correct execution of database transactions, you can set innodbflushlogattrx_commit to 2, which can also improve the system performance.

Receive free brothers IT Education Original linux O & M engineers video/Detailed linux tutorial, details consulting official website Customer Service: http://www.lampbrother.net/linux/

Or hook up Q2430675018.

Welcome to the linux chat group 478068715.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.