Building a PXC cluster under CentOS8 article describes how to build a Percona Server cluster. In fact, the PXC installation package has been bundled with Percona Server, so some details of Percona Server will be shielded during installation. But sometimes Percona Server may be used alone, so this article separately introduces the installation of Percona Server. It should be noted that Percona Server only supports Linux systems and cannot be installed on other operating systems.
There are two simpler installation methods for Percona Server. One is to download the installation package for local installation, and the other is to install it online through the official rpm
source link.
First go to the official installation document:
Environmental version description:
Local installation needs to download the installation package to the system. The download address of Percona Server's official website is as follows:
Open the above URL, select the corresponding version and operating system, and finally copy the download link of the installation package:
Then go to the command line to download through the wget
command:
[ root@localhost ~]# cd /usr/local/src
[ root@localhost /usr/local/src]# wget https://www.percona.com/downloads/Percona-Server-LATEST/Percona-Server-8.0.18-9/binary/redhat/8/x86_64/Percona-Server-8.0.18-9-r53e606f-el8-x86_64-bundle.tar
Decompress the compressed package of Percona Server as follows:
[ root@localhost /usr/local/src]# mkdir Percona-Server #Create a new directory to store the extracted files
[ root@localhost /usr/local/src]# tar -xvf Percona-Server-8.0.18-9-r53e606f-el8-x86_64-bundle.tar -C Percona-Server #Unzip and save the unzipped file to Percona-Server directory
[ root@localhost /usr/local/src]# ls Percona-Server #After decompression, there are a bunch of.rpm file
percona-mysql-router-8.0.18-9.1.el8.x86_64.rpm
percona-mysql-router-debuginfo-8.0.18-9.1.el8.x86_64.rpm
percona-server-client-8.0.18-9.1.el8.x86_64.rpm
percona-server-client-debuginfo-8.0.18-9.1.el8.x86_64.rpm
percona-server-debuginfo-8.0.18-9.1.el8.x86_64.rpm
percona-server-debugsource-8.0.18-9.1.el8.x86_64.rpm
percona-server-devel-8.0.18-9.1.el8.x86_64.rpm
percona-server-rocksdb-8.0.18-9.1.el8.x86_64.rpm
percona-server-rocksdb-debuginfo-8.0.18-9.1.el8.x86_64.rpm
percona-server-server-8.0.18-9.1.el8.x86_64.rpm
percona-server-server-debuginfo-8.0.18-9.1.el8.x86_64.rpm
percona-server-shared-8.0.18-9.1.el8.x86_64.rpm
percona-server-shared-compat-8.0.18-9.1.el8.x86_64.rpm
percona-server-shared-debuginfo-8.0.18-9.1.el8.x86_64.rpm
percona-server-test-8.0.18-9.1.el8.x86_64.rpm
percona-server-test-debuginfo-8.0.18-9.1.el8.x86_64.rpm
percona-server-tokudb-8.0.18-9.1.el8.x86_64.rpm
percona-server-tokudb-debuginfo-8.0.18-9.1.el8.x86_64.rpm
[ root@localhost /usr/local/src]#
The installation of Percona Server depends on jemalloc, so before installing Percona Server, we have to prepare the rpm
package of jemalloc. You can get the download link from the following website:
Enter the newly created Percona-Server
directory and download the rpm
package of jemalloc:
[ root@localhost /usr/local/src]# cd Percona-Server
[ root@localhost /usr/local/src/Percona-Server]# wget http://rpms.remirepo.net/enterprise/8/remi/x86_64//jemalloc-5.1.0-3.el8.remi.x86_64.rpm
After completing the above steps, you can now install Percona Server locally via the yum
command:
[ root@localhost /usr/local/src/Percona-Server]# yum localinstall -y *.rpm
After waiting for the installation to complete, start Percona Server. The startup command is the same as that of MySQL:
[ root@localhost ~]# systemctl start mysqld
There is a normal listening port 3306
, which means the startup is successful:
[ root@localhost ~]# netstat -lntp |grep mysql
tcp6 00:::33060:::* LISTEN 21964/mysqld
tcp6 00:::3306:::* LISTEN 21964/mysqld
[ root@localhost ~]#
Online installation is simpler than local installation, and the installation can be completed with only a few commands. First install the official yum
repository:
[ root@localhost ~]# yum install -y https://repo.percona.com/yum/percona-release-latest.noarch.rpm
Then enable the warehouse:
[ root@localhost ~]# percona-release setup ps80
Now you can install Percona Server directly through the yum
command:
[ root@localhost ~]# yum install -y percona-server-server
Similarly, after waiting for a moment for the installation to complete, start Percona Server:
[ root@localhost ~]# systemctl start mysqld
There is a normal listening port 3306
, which means the startup is successful:
[ root@localhost ~]# netstat -lntp |grep mysql
tcp6 00:::33060:::* LISTEN 12549/mysqld
tcp6 00:::3306:::* LISTEN 12549/mysqld
[ root@localhost ~]#
Disable the automatic startup of Percona Server:
[ root@localhost ~]# systemctl disable mysqld
Removed /etc/systemd/system/multi-user.target.wants/mysqld.service.
Removed /etc/systemd/system/mysql.service.[root@localhost ~]#
If the system has a firewall enabled, you need to open port 3306
:
[ root@localhost ~]# firewall-cmd --zone=public--add-port=3306/tcp --permanent
success
[ root@localhost ~]# firewall-cmd --reload
success
[ root@localhost ~]#
Modify the configuration file:
[ root@localhost ~]# vim /etc/my.cnf
[ mysqld]
# Set character set
character_set_server=utf8
# Set the listening ip
bind-address=0.0.0.0
# Skip DNS resolution
skip-name-resolve
Restart Percona Server:
[ root@localhost ~]# systemctl restart mysqld
Then modify the default password of the root account. We can find the initial default password in the mysql log file. The red box in the figure below shows the default password:
Then use the mysql_secure_installation
command to change the password of the root account:
[ root@localhost ~]# mysql_secure_installation
For security reasons, the root account generally does not allow remote login, so we need to create a separate database account for remote access:
[ root@localhost ~]# mysql -uroot -p
mysql> create user 'admin'@'%' identified by 'A123456a.';
mysql> grant all privileges on *.* to 'admin'@'%';
mysql> flush privileges;
Finally, use the connection tool to test the remote connection:
So far, we have successfully installed Percona Server on CentOS 8. Since Percona Server is basically compatible with MySQL, all operations are no different from MySQL. You only need to use it as MySQL. I won't go into details here.
Recommended Posts