blog

How to Deploy Percona XtraDB Cluster Without an Internet Connection

Ashraf Sharif

Published

If you need to deploy a database cluster behind your corporate firewall, on servers with no internet access, then this blog is for you. Most of the installation tutorials out there require servers to have an internet connection, and that would not work very well with companies under strict policies and compliance guidelines.

Our online Galera Configurator supports deployment without Internet connection for Percona XtraDB Cluster. You would need to prepare a minimum of four hosts (three DB nodes and one management node), generate a Deployment Package from the Configurator and copy it to the ClusterControl host. In this post, we will show you how to deploy Percona XtraDB Cluster 5.5 in an environment without internet connection on CentOS 6.5 (installed with minimal installation). Our setup is illustrated below:

Prerequisites

Prior to performing the offline installation:

  • You need to have a full image of the OS distribution ready on DVD (CentOS-6.5-x86_64-bin-DVD1.iso is sufficient)
  • You may need to have an external DVD drive to mount the ISO on the ClusterControl host.
  • All hosts are able to connect to each other via LAN.

Set Up Local Repository

Mount the CentOS installation DVD using the external DVD drive on the ClusterControl host. On this host, we will configure Apache web server to host the local repository via HTTP to be accessed by the database hosts.

  1. Mount our DVD installation disc into /mnt:
    $ mkdir /media/CentOS
    $ mount /dev/cdrom /media/CentOS
    mount: block device /dev/sr0 is write-protected, mounting read-only
  2. Install Apache web server:
    $ yum list --disablerepo=* --enablerepo=c6-media httpd -y
  3. Let’s make the yum command simpler. Instead of doing as above, we can enable the CentOS-Media repo and disable others by moving them out to yum.repos.d.bak directory:
    $ sed -i 's|^enabled=0|enabled=1|g' /etc/yum.repos.d/CentOS-Media.repo
    $ mkdir /etc/yum.repos.d.bak
    $ cd /etc/yum.repos.d
    $ ls -1 | grep -v CentOS-Media.repo | xargs -I{}  mv {} /etc/yum.repos.d.bak

    Now we can directly use:

    $ yum install [package]
  4. Create a custom Apache configuration file to define an alias for the local yum repository under /etc/httpd/conf.d/ directory:
    $ vim /etc/httpd/conf.d/local-repo.conf

    And add following lines:

    Alias /repo /media/CentOS/
    
    
            Options +Indexes
    
  5. Save the configuration file and restart Apache:
    $ service httpd restart

    At this point, all nodes should be able to access the local repository via HTTP server: http://192.168.0.20/repo/

Configuring yum on Database Nodes

Following steps should be performed on each of the database nodes:

  1. Enable CentOS-Media repo and disable others by moving them out to yum.repos.d.bak directory:
    $ sed -i 's|^enabled=0|enabled=1|g' /etc/yum.repos.d/CentOS-Media.repo
    $ mkdir /etc/yum.repos.d.bak
    $ cd /etc/yum.repos.d
    $ ls -1 | grep -v CentOS-Media.repo | xargs -I{}  mv {} /etc/yum.repos.d.bak
  2. Add the local repository URL in CentOS-Media.repo:
    [c6-media]
    name=CentOS-$releasever - Media
    baseurl=http://192.168.0.20/repo
    gpgcheck=1
    enabled=1
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
  3. Save changes and verify with the following command:
    $ yum list
 

Generate Deployment Package

Point your web browser to the Galera Configurator and choose Percona as vendor and MySQL 5.5.x as the MySQL Version (you can also choose 5.6.x if you want). You should see an additional option (No Internet), toggle it to ‘YES’. This allows the configurator to customize the installation scripts accordingly.

Once generated, download the deployment package onto the ClusterControl host.

Download the Correct Packages

In order to deploy Galera Cluster offline, the deployment scripts expect us to manually download a number of packages. All the related packages need to be placed under s9s-galera-percona-[version]-rpm/mysql/repo/ directory. We will be notified of the list of required packages, as per the output below:

Checking cmon-controller-1.2.6-260-1.x86_64.rpm : not found!
Checking cc-ui-1.2.6.tar.gz : not found!
Checking cc-cmonapi-1.2.6.tar.gz : not found!
Checking Percona-XtraDB-Cluster-client-55-5.5.37-25.10.756.el6.x86_64.rpm : not found!
Checking Percona-XtraDB-Cluster-devel-55-5.5.37-25.10.756.el6.x86_64.rpm : not found!
Checking Percona-XtraDB-Cluster-server-55-5.5.37-25.10.756.el6.x86_64.rpm : not found!
Checking Percona-XtraDB-Cluster-shared-55-5.5.37-25.10.756.el6.x86_64.rpm : not found!
Checking Percona-XtraDB-Cluster-test-55-5.5.37-25.10.756.el6.x86_64.rpm : not found!
Checking Percona-XtraDB-Cluster-galera-2-2.10-1.188.rhel6.x86_64.rpm : not found!
Checking percona-xtrabackup-2.1.9-744.rhel6.x86_64.rpm : not found!
Checking Percona-Server-shared-compat-5.5.35-rel33.0.611.rhel6.x86_64.rpm : not found!
Checking epel-release-6-8.noarch.rpm : not found!
FAILED! Download the following files into ../../repo and try ./deploy.sh again
https://severalnines.com/downloads/cmon/cmon-controller-1.2.6-260-1.x86_64.rpm
https://severalnines.com/downloads/cmon/cc-ui-1.2.6.tar.gz
https://severalnines.com/downloads/cmon/cc-cmonapi-1.2.6.tar.gz
http://www.percona.com/downloads/Percona-XtraDB-Cluster/LATEST/RPM/rhel6/x86_64/Percona-XtraDB-Cluster-client-55-5.5.37-25.10.756.el6.x86_64.rpm
http://www.percona.com/downloads/Percona-XtraDB-Cluster/LATEST/RPM/rhel6/x86_64/Percona-XtraDB-Cluster-devel-55-5.5.37-25.10.756.el6.x86_64.rpm
http://www.percona.com/downloads/Percona-XtraDB-Cluster/LATEST/RPM/rhel6/x86_64/Percona-XtraDB-Cluster-server-55-5.5.37-25.10.756.el6.x86_64.rpm
http://www.percona.com/downloads/Percona-XtraDB-Cluster/LATEST/RPM/rhel6/x86_64/Percona-XtraDB-Cluster-shared-55-5.5.37-25.10.756.el6.x86_64.rpm
http://www.percona.com/downloads/Percona-XtraDB-Cluster/LATEST/RPM/rhel6/x86_64/Percona-XtraDB-Cluster-test-55-5.5.37-25.10.756.el6.x86_64.rpm
http://www.percona.com/downloads/Percona-XtraDB-Cluster/LATEST/RPM/rhel6/x86_64/Percona-XtraDB-Cluster-galera-2-2.10-1.188.rhel6.x86_64.rpm
http://www.percona.com/downloads/XtraBackup/LATEST/RPM/rhel6/x86_64/percona-xtrabackup-2.1.9-744.rhel6.x86_64.rpm
http://www.percona.com/downloads/Percona-Server-5.5/Percona-Server-5.5.35-rel33.0/RPM/rhel6/x86_64/Percona-Server-shared-compat-5.5.35-rel33.0.611.rhel6.x86_64.rpm
http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm

The deployment script will lookup the expected files inside the repo directory based on the version defined in s9s-galera-percona-[version]-rpm/mysql/scripts/install/install-rpm-nonet.sh under the following variables:

mysql_ver='55-5.5.37'
mysql_vanilla_ver='5.5.35-rel33.0.611'
mysql_vanilla_ver_dl='5.5.35-rel33.0'
wsrep_ver='25.10'
galera_ver='2-2.10-1.188'
build='756'
arch='x86_64'
verstr="${mysql_ver}-${wsrep_ver}.${build}.${rhel}.${arch}"
xtrabackup_ver='2.1.9-744'

Create the repo directory:

$ mkdir s9s-galera-percona-[version]-rpm/mysql/repo
$ cd s9s-galera-percona-[version]-rpm/mysql/repo

Using a host with Internet connection, download the required files and upload them to the repo directory:

Package Package Name Example URL
Percona XtraDB Cluster (server) Percona-XtraDB-Cluster-server http://www.percona.com/downloads/Percona-XtraDB-Cluster/LATEST/RPM/rhel6/x86_64/Percona-XtraDB-Cluster-server-55-5.5.37-25.10.756.el6.x86_64.rpm
Percona XtraDB Cluster (client) Percona-XtraDB-Cluster-client http://www.percona.com/downloads/Percona-XtraDB-Cluster/LATEST/RPM/rhel6/x86_64/Percona-XtraDB-Cluster-client-55-5.5.37-25.10.756.el6.x86_64.rpm
Percona XtraDB Cluster (galera) Percona-XtraDB-Cluster-galera http://www.percona.com/downloads/Percona-XtraDB-Cluster/LATEST/RPM/rhel6/x86_64/Percona-XtraDB-Cluster-galera-2.10-1.188.el6.x86_64.rpm
Percona XtraDB Cluster (shared) Percona-XtraDB-Cluster-shared http://www.percona.com/downloads/Percona-XtraDB-Cluster/LATEST/RPM/rhel6/x86_64/Percona-XtraDB-Cluster-shared-55-5.5.37-25.10.756.el6.x86_64.rpm
Percona XtraDB Cluster (shared-compat) Percona-Server-shared-compat http://www.percona.com/redir/downloads/Percona-Server-5.5/Percona-Server-5.5.35-rel33.0/RPM/rhel6/x86_64/Percona-Server-shared-compat-5.5.35-rel33.0.611.rhel6.x86_64.rpm
Percona XtraDB Cluster (test) Percona-XtraDB-Cluster-server http://www.percona.com/downloads/Percona-XtraDB-Cluster/LATEST/RPM/rhel6/x86_64/Percona-XtraDB-Cluster-test-55-5.5.37-25.10.756.el6.x86_64.rpm
Percona XtraDB Cluster (devel) Percona-XtraDB-Cluster-server http://www.percona.com/downloads/Percona-XtraDB-Cluster/LATEST/RPM/rhel6/x86_64/Percona-XtraDB-Cluster-devel-55-5.5.37-25.10.756.el6.x86_64.rpm
Percona Xtrabackup percona-xtrabackup http://www.percona.com/downloads/XtraBackup/LATEST/RPM/rhel6/x86_64/percona-xtrabackup-2.1.3-608.rhel6.x86_64.rpm
socat socat http://pkgs.repoforge.org/socat/socat-1.7.2.4-1.el6.rf.x86_64.rpm
ClusterControl Controller cmon-controller https://severalnines.com/downloads/cmon/cmon-controller-1.2.6-260-1.x86_64.rpm
ClusterControl Agent cmon-agent https://severalnines.com/downloads/cmon/cmon-agent-1.2.6-260-1.x86_64.rpm
ClusterControl UI cc-ui https://severalnines.com/downloads/cmon/cc-ui-1.2.6.tar.gz
ClusterControl CMONAPI cc-cmonapi https://severalnines.com/downloads/cmon/cc-cmonapi-1.2.6.tar.gz
EPEL Release epel-release http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm

* Package name/URL might be different after new releases by respective vendors.

Here is what we should have in the repo directory:

$ ls -1 /root/s9s-galera-percona-2.8.0-rpm/mysql/repo
cc-cmonapi-1.2.6.tar.gz
cc-ui-1.2.6.tar.gz
cmon-agent-1.2.6-260-1.x86_64.rpm
cmon-controller-1.2.6-260-1.x86_64.rpm
epel-release-6-8.noarch.rpm
Percona-Server-shared-compat-5.5.35-rel33.0.611.rhel6.x86_64.rpm
percona-xtrabackup-2.1.9-744.rhel6.x86_64.rpm
Percona-XtraDB-Cluster-client-55-5.5.37-25.10.756.el6.x86_64.rpm
Percona-XtraDB-Cluster-devel-55-5.5.37-25.10.756.el6.x86_64.rpm
Percona-XtraDB-Cluster-galera-2-2.10-1.188.rhel6.x86_64.rpm
Percona-XtraDB-Cluster-server-55-5.5.37-25.10.756.el6.x86_64.rpm
Percona-XtraDB-Cluster-shared-55-5.5.37-25.10.756.el6.x86_64.rpm
Percona-XtraDB-Cluster-test-55-5.5.37-25.10.756.el6.x86_64.rpm
socat-1.7.2.4-1.el6.rf.x86_64.rpm

Install Required Package Manually

We need to install socat prior to execution of Severalnines deployment package. This is because the socat package is not available in the local YUM repository and this would fail the deployment process. Socat is a direct dependency of Percona XtraDB Cluster and it is the default when performing SST using xtrabackup.

Install it first on ClusterControl host:

$ cd /root/s9s-galera-percona-2.8.0-rpm/mysql/repo
$ yum localinstall -y socat-1.7.2.4-1.el6.rf.x86_64.rpm

Then copy the package to all database hosts:

$ cd /root/s9s-galera-percona-2.8.0-rpm/mysql/repo
$ scp socat-1.7.2.4-1.el6.rf.x86_64.rpm [email protected]:~
$ scp socat-1.7.2.4-1.el6.rf.x86_64.rpm [email protected]:~
$ scp socat-1.7.2.4-1.el6.rf.x86_64.rpm [email protected]:~

SSH into all DB hosts and install it using localinstall so it installs any missing dependencies:

$ yum localinstall -y socat-1.7.2.4-1.el6.rf.x86_64.rpm

Now we are ready to start the offline deployment.

Let ClusterControl Deploy

Start the deployment script:

$ cd /root/s9s-galera-percona-2.8.0-rpm/mysql/scripts/install
$ bash ./deploy.sh 2>&1 | tee cc.log

Grab some coffee and wait for the success banner:

Installation completed in 556 seconds
*******************************************************************************
*                                                                             *
*                            CONGRATULATIONS                                  *
*                                                                             *
*******************************************************************************
You have now installed one of the most advanced db infrastructures available.
 
Open your browser to http://192.168.0.20/clustercontrol
Logon with your email address and password 'admin'.
This is your ClusterControl API token, ab198c842b6e15bb670e228ea1fbba9629509fc5, keep it for safekeeping if you need to (re)register your cluster again.
 
Don't hesitate to contact us if you have any problems or inquiries. Good luck,
Severalnines AB

Navigate to the ClusterControl UI at http://192.168.0.20/clustercontrol and you should see your Percona XtraDB Cluster:

Note that the following ClusterControl features will not work well without internet connection:

  • Backup > Online Storage – requires connection to AWS.
  • Service Providers > AWS Instances – requires connection to AWS.
  • Service Providers > AWS VPC – requires connection to AWS.
  • Manage > Load Balancer – requires connection to EPEL repository.
  • Manage > Upgrades – requires connection to Percona repository.

You just deployed a Galera Cluster on servers without internet connection, complete with management and monitoring. Happy clustering!

Subscribe below to be notified of fresh posts