How VPS - How to use/setup VPS
  • Home
  • Management guides
    • Web servers software
      • Directadmin
      • Hocvps Script
      • Centmin Mod
      • CWP
      • Kloxo-MR
      • Plesk
    • Control Panels
    • Securing VPS/Servers
      • SSL Certificates
      • Upgrading
      • Authentication
  • Operating System
    • CentOS
    • Fedora
    • Debian
    • Linux
    • Arch
    • BSD
    • CoreOS
  • Reviews
  • Coupon
    • Domain Coupon
    • Hosting Coupon
No Result
View All Result
  • Home
  • Management guides
    • Web servers software
      • Directadmin
      • Hocvps Script
      • Centmin Mod
      • CWP
      • Kloxo-MR
      • Plesk
    • Control Panels
    • Securing VPS/Servers
      • SSL Certificates
      • Upgrading
      • Authentication
  • Operating System
    • CentOS
    • Fedora
    • Debian
    • Linux
    • Arch
    • BSD
    • CoreOS
  • Reviews
  • Coupon
    • Domain Coupon
    • Hosting Coupon
No Result
View All Result
How VPS - How to use/setup VPS
No Result
View All Result
Home Operating System Debian

Setup Percona on Debian 7

How VPS by How VPS
November 1, 2019
in Debian
0
0
SHARES
18
VIEWS
Share on FacebookShare on Twitter

Contents

  1. Prerequisites
  2. Getting Started
    1. SSH into your virtual machines.
    2. Add Percona’s repositories.
    3. Install Percona-XtraDB Cluster.
    4. Configure the first node.
    5. Configure the second node.
    6. Testing the cluster.
  3. Want to contribute?


MySQL multi-master replication is an excellent feature within MySQL. However, there is only one problem; standard multi-master replication seems to never be as stable as something like master-slave replication. It is always in need of attention. That is where Percona comes into play. The Percona team has developed an amazing product dubbed Percona XtraDB cluster. XtraDB features world class multi-master replication powered by Galera. So, what are we waiting for? Let’s get started.

Prerequisites

  • A Linux distro of your choice. In this guide, we will be using Debian 7. You can use a different distro if you would like. (Note that you may need to adapt this guide to work with the distro of your choice)
  • Two nodes running the same OS.
  • Basic knowledge of the command line and SSH.

Getting Started

SSH into your virtual machines.

VM 1:

ssh [email protected]

VM 2:

ssh [email protected]
Add Percona’s repositories.

On both nodes, execute the following command:

echo -e "deb http://repo.percona.com/apt wheezy main/ndeb-src http://repo.percona.com/apt wheezy main" >> /etc/apt/sources.list.d/percona.list && apt-key adv --keyserver keys.gnupg.net --recv-keys 1C4CBDCDCD2EFD2A

Now we need to update the sources:

apt-get update
Install Percona-XtraDB Cluster.

The installation is straightforward:

apt-get install percona-xtradb-cluster-56

If you are familiar with MySQL, then this next screen should look familiar. Simply follow the on-screen instructions for entering a password.

Configure the first node.

The configuration is quite simple. You simply need to add a few lines to the MySQL config file. In this case, I am going to be using Nano, but you can use your text editor of choice.

Use this to open the file on both machines:

nano /etc/mysql/my.cnf

Go down to bind-address = 127.0.0.1 and add a # before it. Add the following lines immediately after the (commented-out) bind-address line:

### Galera library.

wsrep_provider=/usr/lib/libgalera_smm.so

### IP addresses of your two nodes.

wsrep_cluster_address=gcomm://xxx.xxx.xxx.xx,yyy.yyy.yyy.yyy

### This will not work unless binlog is formatted to ROW.

binlog_format=ROW

### This changes how InnoDB autoincrement locks are managed and is a requirement for Galera

innodb_autoinc_lock_mode=2
### Node #1 address (The node you are ssh`d into now.)

wsrep_node_address=xxx.xxx.xxx.xx

### SST Method

wsrep_sst_method=xtrabackup-v2

### Cluster name

wsrep_cluster_name=xtradb

### Node Name, in this case we will just call it xtradb1

wsrep_node_name=xtradb1

### Authentication, REMEMBER THIS.

wsrep_sst_auth="sstuser:yoursecretpass"

Save and exit the file (Ctrl+X).

Now, let’s bootstrap the node:

/etc/init.d/mysql bootstrap-pxc

Next, we need to create the user and give it privileges, this is why you need to remember that password. You will need to login to the MySQL shell (mysql -u root -p) and type in the following (Do not include the mysql>):

mysql> CREATE USER 'sstuser'@'localhost' IDENTIFIED BY 'yoursecretpass';
mysql> GRANT RELOAD, LOCK TABLES, REPLICATION CLIENT ON *.* TO 'sstuser'@'localhost';
mysql> FLUSH PRIVILEGES;
Configure the second node.

The configuration for the second node is identical to the first, except for two values. Once again, comment out bind-address = 127.0.0.1 and paste the following immediately after it. Remember to edit the values accordingly.

### Galera library.

wsrep_provider=/usr/lib/libgalera_smm.so

### IP addresses of your two nodes.

wsrep_cluster_address=gcomm://xxx.xxx.xxx.xx,yyy.yyy.yyy.yyy

### This will not work unless binlog is formatted to ROW.

binlog_format=ROW

### This changes how InnoDB autoincrement locks are managed and is a requirement for Galera

innodb_autoinc_lock_mode=2

### Node #2 address (The node you are ssh`d into now.)

wsrep_node_address=yyy.yyy.yyy.yyy

### SST Method

wsrep_sst_method=xtrabackup-v2

### Cluster name

wsrep_cluster_name=xtradb

### Node Name, in this case we will just call it xtradb1

wsrep_node_name=xtradb1

### Authentication, REMEMBER THIS.

wsrep_sst_auth="sstuser:yoursecretpass"

Next, type /etc/init.d/mysql start. You will see the following output:

[....] Starting MySQL (Percona XtraDB Cluster) database server: mysqld . .
[....] State transfer in progress [ok]

That’s it! You’ve configured a multi-master XtraDB cluster! This is a worry-free XtraDB cluster with great performance.

Testing the cluster.

On node 1, type in mysql -u root -p then create database demo;. On the opposite node, login to MySQL with root, and type show databases;. If everything worked correctly, then you will see the database you created on the opposite node!

Want to contribute?

You could earn up to $300 by adding new articles

Submit your article
Suggest an update
Request an article
How VPS

How VPS

Related Posts

Debian

How to Install WonderCMS on Debian 9

November 1, 2019
Debian

Using MySQL Views on Debian 7

November 1, 2019
Debian

How to Install and Configure TaskBoard on Debian 9

November 1, 2019
Next Post

HTTP Git Server With Nginx on Debian 8

How to Install Grav CMS on Debian 9

How to Install Cachet on Debian 10

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Follow Us

  • 121 Followers
  • 87.2k Followers

Recommended

Building Packages on Arch Linux (Including the AUR)

4 years ago

4 Ways to Batch Convert Your PNG to JPG and Vice-Versa

4 years ago

10 7zip (File Archive) Command Examples in Linux

4 years ago

Installing Akaunting on CentOS 7

3 years ago

Instagram

    Please install/update and activate JNews Instagram plugin.

Categories

  • Arch
  • Authentication
  • Backups
  • BSD
  • Centmin Mod
  • CentOS
  • Control Panels
  • CoreOS
  • CWP
  • Debian
  • Directadmin
  • Encryption
  • Fedora
  • Firewalls
  • Hocvps Script
  • Hosting providers
  • Kloxo-MR
  • Linux
  • Mitigations
  • Operating System
  • Plesk
  • Reviews
  • Securing VPS/Servers
  • Security Patches
  • SSL Certificates
  • Uncategorized
  • Upgrading
  • VPS/Servers management guides
  • Vulnerability Detection
  • Web servers software
  • Webhosting Control Panel

Topics

Apache Web Server Bluehost Review 2019 Bluehost Review 2020 Bluehost Review 2021 Centmin Mod CentminMod centos install htop fsck htop install HTTP DoS attack Install Snort on an Ubuntu install Zabbix on CentOS install Zabbix on CentOS 7 Linux Commands linux guide linux install htop linux vps setup guide MariaDB MariaDB Error Mysql mysqld error optimize MariaDB optimize Mysql snort Ubuntu
No Result
View All Result

Highlights

Top Free Web Hosting Control Panels To Manage VPS/Dedicated Servers

Webmin Reviews

Virtualmin Reviews

CentOS Web Panel Reviews

Ajenti Reviews

ISPConfig Reviews

Trending

Failed to download metadata for repo 'appstream' on Centos 8
CentOS

How to fix error: Failed to download metadata for repo ‘appstream’ on Centos 8

by How VPS
February 25, 2022
0

I tried to update some extensions by use yum on centOs which I specified in Dockerfile. After...

How to Fix MySQL Error "Plugin 'InnoDB' registration as a STORAGE ENGINE failed"?

How to Fix MySQL Error “Plugin ‘InnoDB’ registration as a STORAGE ENGINE failed”?

November 17, 2020
How to optimize Mysql or MariaDB

How to optimize Mysql or MariaDB

November 3, 2020
Top Free Web Hosting Control Panels To Manage VPS/Dedicated Servers

Top Free Web Hosting Control Panels To Manage VPS/Dedicated Servers

February 17, 2020
Webmin Reviews

Webmin Reviews

February 17, 2020
How VPS – How to use/setup VPS

We bring you the best Premium WordPress Themes that perfect for news, magazine, personal blog, etc. Visit our landing page to see all features & demos.
LEARN MORE »

Recent News

  • How to fix error: Failed to download metadata for repo ‘appstream’ on Centos 8 February 25, 2022
  • How to Fix MySQL Error “Plugin ‘InnoDB’ registration as a STORAGE ENGINE failed”? November 17, 2020
  • How to optimize Mysql or MariaDB November 3, 2020

Categories

  • Arch
  • Authentication
  • Backups
  • BSD
  • Centmin Mod
  • CentOS
  • Control Panels
  • CoreOS
  • CWP
  • Debian
  • Directadmin
  • Encryption
  • Fedora
  • Firewalls
  • Hocvps Script
  • Hosting providers
  • Kloxo-MR
  • Linux
  • Mitigations
  • Operating System
  • Plesk
  • Reviews
  • Securing VPS/Servers
  • Security Patches
  • SSL Certificates
  • Uncategorized
  • Upgrading
  • VPS/Servers management guides
  • Vulnerability Detection
  • Web servers software
  • Webhosting Control Panel

[mc4wp_form]

© 2018 JNews - City News Magazine WordPress theme. All rights belong to their respective owners.
JNews is a top selling 2018 WordPress News, Blog, Newspaper & Magazine Theme.

No Result
View All Result
  • Home

© 2023 JNews - Premium WordPress news & magazine theme by Jegtheme.