In the light of support for Percona XtraDB Cluster (PXC), the DBdeployer anniversary, and the newly released Percona XtraDB Cluster 8.0, I’m happy to announce that Giuseppe Maxia has recently updated DBdeployer to support Percona XtraDB Cluster 8.0.
We at Percona, with my colleague Ramesh Sivaraman, have tested and deployed Percona XtraDB Cluster (PXC) 8.0.18 successfully using DBdeployer.
What is DBdeployer and How Do You Install it?
It’s an open source tool to test and deploy multiple MySQL topologies in a single host using different ports. It allows DBAs and developers to quickly launch and test certain functionalities, syntax, and features. It’s a critical tool to launch MySQL instances with minimum resources.
Here’s a quick rundown of DBdeployer:
DBdeployer use case with PXC-8.0
OS: Ubuntu Xenial
1 2 |
$ wget https://github.com/datacharmer/dbdeployer/releases/download/v1.49.0/dbdeployer-1.49.0.linux.tar.gz $ tar -xzf dbdeployer-1.49.0.linux.tar.gz |
Note: Be sure to check your system and make sure that the packages are installed which Percona XtraDB Cluster 8.0 depends on.
1 2 |
$ sudo apt-get install -y socat libdbd-mysql-perl libaio1 libc6 libcurl3 libev4 libgcc1 libgcrypt20 libgpg-error0 libssl-dev libstdc++6 zlib1g libatomic1 $ mkdir opt; mkdir opt/mysql |
Please select Linux Generic packages if you are downloading PXC from the web:
1 2 3 4 |
$ wget https://www.percona.com/downloads/Percona-XtraDB-Cluster-LATEST/Percona-XtraDB-Cluster-8.0.18-9.3/binary/tarball/Percona-XtraDB-Cluster_8.0.18-9.3_Linux.x86_64.xenial.tar.gz $ sudo mv dbdeployer-1.49.0.linux /usr/local/bin/dbdeployer $ PATH=$PATH:/usr/local/bin/ $ dbdeployer unpack --prefix=pxc Percona-XtraDB-Cluster_8.0.18.9_Linux.x86_64.xenial.tar.gz |
Configure a Single Node Percona XtraDB Cluster
The following command will help you to set up a single node cluster.
1 2 3 4 5 6 7 8 9 10 11 12 |
$ dbdeployer deploy single pxc8.0.18 Database installed in $HOME/sandboxes/msb_pxc8_0_18 run 'dbdeployer usage single' for basic instructions' .. sandbox server started $ $HOME/sandboxes/msb_pxc8_0_18/test_sb ok - version '8.0.18-9' [..] # Tests : 11 # PASS : 11 # fail : 0 $ |
Before moving on to multi-node cluster, remove the single-node cluster.
1 2 3 4 5 6 7 8 |
$ dbdeployer delete msb_pxc8_0_18 List of deployed sandboxes: /home/dba/sandboxes/msb_pxc8_0_18 Running /home/dba/sandboxes/msb_pxc8_0_18/stop stop /home/dba/sandboxes/msb_pxc8_0_18 Running rm -rf /home/dba/sandboxes/msb_pxc8_0_18 Directory /home/dba/sandboxes/msb_pxc8_0_18 deleted $ |
Configure 3 Node Percona XtraDB Cluster
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
$ dbdeployer deploy replication --topology=pxc pxc8.0.18 Installing and starting node 1 ... sandbox server started Installing and starting node 2 .................................... sandbox server started Installing and starting node 3 .................................... sandbox server started Replication directory installed in $HOME/sandboxes/pxc_msb_pxc8_0_18 run 'dbdeployer usage multiple' for basic instructions' $ $ dbdeployer sandboxes --header name type version port ---------------------------- ------------------------ ----------- ---------------------------------------------------------------------------------------------- pxc_msb_pxc8_0_18 : Percona-Xtradb-Cluster pxc8.0.18 [27819 27945 27946 27957 37819 27820 27947 27948 27958 37820 27821 27949 27950 27959 37821 ] $ |
Testing and Verification
There are several pre-set scripts under this deployment. We can start with testing replication status for this cluster.
1 2 3 4 5 6 7 8 9 10 11 12 |
$ $HOME/sandboxes/pxc_msb_pxc8_0_18/test_replication # master 1 # master 2 # master 3 # slave 1 ok - '3' == '3' - Slaves received tables from all masters # slave 2 ok - '3' == '3' - Slaves received tables from all masters # slave 3 ok - '3' == '3' - Slaves received tables from all masters # pass: 3 # fail: 0 |
Also following $HOME/sandboxes/pxc_msb_pxc8_0_18/n[1-3] scripts will help to login to the respective PXC node.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
$ $HOME/sandboxes/pxc_msb_pxc8_0_18/n1 Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 26 Server version: 8.0.18-9 Percona XtraDB Cluster binary (GPL) 8.0.18, Revision a34c3d3, WSREP version 26.4.3 Copyright (c) 2009-2019 Percona LLC and/or its affiliates Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. node1 [localhost:27819] {msandbox} ((none)) > create database mytest; Query OK, 1 row affected (0.79 sec) node1 [localhost:27819] {msandbox} ((none)) > |
You can also check the node status using the following command: