Page 1 of 1

How to install Percona XtraDB Cluster on VestaCP

Posted: Sun Sep 16, 2018 4:00 pm
by tom256
Hi, I'm very interested in Percona XtraDB Cluster, called PXC.
today I tried to start a Percona XtraDB Cluster on Ubuntu 16.04, I'm using vestacp, so Mysql is already installed.
In the first step of installing written in the percona website in third note of Prerequisites, I saw this note:
Note
If you previously had MySQL installed on the server, there might be an AppArmor profile which will prevent Percona XtraDB Cluster nodes from communicating with each other. The best solution is to remove the apparmor package entirely:

Code: Select all

$ sudo apt-get remove apparmor
If you need to have AppArmor enabled due to security policies or for other reasons, it is possible to disable or extend the MySQL profile.
Very bad, dangerous and unacceptable solution by Percona!!!
As mentioned in comment sections of this tutorial, Disabling AppArmor in a wrong way will break your Ubuntu 14x -16x system and will remove a lot of programs!!

I tried sudo apt-get remove apparmor which was the solution of Percona, and I got this:
The following packages were automatically installed and are no longer required:
libcgi-fast-perl libcgi-pm-perl libevent-core-2.0-5 libfcgi-perl libhtml-template-perl linux-headers-4.4.0-131
linux-headers-4.4.0-131-generic linux-image-4.4.0-131-generic linux-image-extra-4.4.0-131-generic mysql-server-core-5.7
python3-apparmor python3-libapparmor
Use 'sudo apt autoremove' to remove them.
The following packages will be REMOVED:
apparmor apparmor-utils liblxc1 lxc-common lxd mysql-server mysql-server-5.7 snapd
0 upgraded, 0 newly installed, 8 to remove and 0 not upgraded.
After this operation, 150 MB disk space will be freed.
As you can see it is going to uninstall the Mysql, and as a result, it will break my whole vestacp server! Fortunately, I answered No and was able to save my life!

My question is what is the right solution to install PXC when Mysql is already installed?

PS: I was googling the whole day and found this tutorial:
https://www.percona.com/blog/2018/08/09 ... b-cluster/

But I couldn't understand it completely, it was a little confusing.
1- First of all, Is it the solution I need for installing PXC when Mysql is already installed
2- What is that Start iterating title mean? Is it a mandatory step?
3- In top of the tutorial is written "you can just grab my profile"
Can I skip all the steps for even first node, and do these below steps for all nodes (without doing anything else! none of the other steps!)
(first installing apparmor-utils which is not mentioned in “Copy the profile” section):

Code: Select all

apt install apparmor-utils
cd /etc/apparmor.d

wget https://gist.githubusercontent.com/y-trudeau/dc62a324817df643eae0ccb39d719c91/raw/94e7c4416de0eb26cbd29fe638a6740a70b90485/usr.bin.mysqld_safe
aa-enforce usr.bin.mysqld_safe

Re: How to install Percona XtraDB Cluster on VestaCP

Posted: Sun Sep 16, 2018 8:01 pm
by tom256
I broke my server! Urgent help is needed!

I was installing Percona XtraDB Cluster by this tutorial:
https://www.percona.com/doc/percona-xtr ... t.html#apt

after:

Code: Select all

sudo apt-get install percona-xtradb-cluster-57
it showed me it is going to install some packages and removing some packages like mysql-server:

Code: Select all

The following packages were automatically installed and are no longer required:
  libcgi-fast-perl libcgi-pm-perl libevent-core-2.0-5 libfcgi-perl libhtml-template-perl linux-headers-4.4.0-131
  linux-headers-4.4.0-131-generic linux-image-4.4.0-131-generic linux-image-extra-4.4.0-131-generic
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
  debsums iproute libdbd-mysql-perl libdbi-perl libdpkg-perl libev4 libfile-fcntllock-perl libfile-fnmatch-perl libmecab2
  percona-xtrabackup-24 percona-xtradb-cluster-client-5.7 percona-xtradb-cluster-common-5.7 percona-xtradb-cluster-server-5.7
  qpress socat
Suggested packages:
  libclone-perl libmldbm-perl libnet-daemon-perl libsql-statement-perl debian-keyring tinyca pv
The following packages will be REMOVED:
  mysql-client-5.7 mysql-client-core-5.7 mysql-server-5.7 mysql-server-core-5.7
The following NEW packages will be installed:
  debsums iproute libdbd-mysql-perl libdbi-perl libdpkg-perl libev4 libfile-fcntllock-perl libfile-fnmatch-perl libmecab2
  percona-xtrabackup-24 percona-xtradb-cluster-57 percona-xtradb-cluster-client-5.7 percona-xtradb-cluster-common-5.7
  percona-xtradb-cluster-server-5.7 qpress socat
0 upgraded, 16 newly installed, 4 to remove and 0 not upgraded.
Need to get 19.9 MB of archives.
After this operation, 18.9 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
I've entered yes, and then it asked me there are some data in /var/lib/mysql ,backup it, and I cp the directory to somewhere else in my server, then it asked me the new mysql root password, which I skiped and entered nothing.
This is the installation log:

Code: Select all

Preconfiguring packages ...
/usr/bin/locale: Cannot set LC_ALL to default locale: No such file or directory
Selecting previously unselected package libdpkg-perl.
(Reading database ... 153043 files and directories currently installed.)
Preparing to unpack .../libdpkg-perl_1.18.4ubuntu1.4_all.deb ...
Unpacking libdpkg-perl (1.18.4ubuntu1.4) ...
Selecting previously unselected package libfile-fnmatch-perl.
Preparing to unpack .../libfile-fnmatch-perl_0.02-2build2_amd64.deb ...
Unpacking libfile-fnmatch-perl (0.02-2build2) ...
Selecting previously unselected package debsums.
Preparing to unpack .../archives/debsums_2.1.2_all.deb ...
Unpacking debsums (2.1.2) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up libdpkg-perl (1.18.4ubuntu1.4) ...
Setting up libfile-fnmatch-perl (0.02-2build2) ...
Setting up debsums (2.1.2) ...
locale: Cannot set LC_ALL to default locale: No such file or directory
Selecting previously unselected package percona-xtradb-cluster-common-5.7.
(Reading database ... 153202 files and directories currently installed.)
Preparing to unpack .../percona-xtradb-cluster-common-5.7_5.7.22-29.26-1.xenial_amd64.deb ...
Unpacking percona-xtradb-cluster-common-5.7 (5.7.22-29.26-1.xenial) ...
dpkg: mysql-server-5.7: dependency problems, but removing anyway as you requested:
 mysql-server depends on mysql-server-5.7.

(Reading database ... 153212 files and directories currently installed.)
Removing mysql-server-5.7 (5.7.23-0ubuntu0.16.04.1) ...
locale: Cannot set LC_ALL to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
update-alternatives: using /etc/mysql/my.cnf.fallback to provide /etc/mysql/my.cnf (my.cnf) in auto mode
Removing mysql-server-core-5.7 (5.7.23-0ubuntu0.16.04.1) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up percona-xtradb-cluster-common-5.7 (5.7.22-29.26-1.xenial) ...
update-alternatives: using /etc/mysql/percona-xtradb-cluster.cnf to provide /etc/mysql/my.cnf (my.cnf) in auto mode
Selecting previously unselected package percona-xtradb-cluster-server-5.7.
(Reading database ... 153041 files and directories currently installed.)
Preparing to unpack .../percona-xtradb-cluster-server-5.7_5.7.22-29.26-1.xenial_amd64.deb ...
.
Unpacking percona-xtradb-cluster-server-5.7 (5.7.22-29.26-1.xenial) ...
dpkg: error processing archive /var/cache/apt/archives/percona-xtradb-cluster-server-5.7_5.7.22-29.26-1.xenial_amd64.deb (--unpack):
 trying to overwrite '/usr/share/man/man1/mysqlman.1.gz', which is also in package mysql-client-5.7 5.7.23-0ubuntu0.16.04.1
dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
Processing triggers for man-db (2.7.5-1) ...
Errors were encountered while processing:
 /var/cache/apt/archives/percona-xtradb-cluster-server-5.7_5.7.22-29.26-1.xenial_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
And now I can't even login to a DB with PHPmyadmin.
And mysql is not running in: MY_IP:8083/list/server/

what happend? How to fix it?


Please help.