Percona, the underlying Database

Percona’s documentation page explains the installation in detail.

In this section we’re setting up a three-node Percona cluster. A three-node cluster can tolerate one crash fault. In production, you probably want to run five nodes, to be able to tolerate up to two faults.

Host names and IP addresses used in the example are listed in the table below.



Percona provides repositories for the YUM and APT package managers. Alternatively you can install from source. For simplicity, we are going to install Percona using the default data directory /var/lib/mysql.

Run the commands below on all nodes of your Percona cluster to configure the Percona repositories and install the service.

wget$(lsb_release -sc)_all.deb
sudo dpkg -i percona-release_0.1-4.$(lsb_release -sc)_all.deb
sudo apt-get update
sudo apt-get install percona-xtradb-cluster-57

The service will start up automatically after the installation, you can confirm that the service is running with service mysql status, start the service with sudo service mysql start and stop with sudo service mysql stop.


Configure the MySQL Root Password (if necessary)

Some distributions allow root access to the database through a Unix domain socket, others require you to find the temporary password in the log file and change it upon first login.

Stop the Service

sudo service mysql stop

Setup replication

Variables you need to change from the defaults are listed in the table below.

Variable NameExampleDescription
wsrep_cluster_addressgcomm://,, addresses of all the cluster nodes (host and port)
wsrep_node_address10.1.0.1The address of the Percona node
wsrep_cluster_namenotary-cluster-1The name of the Percona cluster
wsrep_sst_authusername:passwordThe credentials for SST
wsrep_provider_options“gcache.size=8G”Replication options

Configure all replicas via /etc/mysql/percona-xtradb-cluster.conf.d/wsrep.cnf as shown in the template below.

# Path to Galera library
# TODO set options related to the timeouts for WAN:
# evs.keepalive_period=PT3s
# evs.inactive_check_period=PT10S
# evs.suspect_timeout=PT30S
# evs.install_timeout=PT1M
# evs.send_window=1024
# evs.user_send_window=512

# Cluster connection URL contains IPs of nodes
#If no IP is found, this implies that a new cluster needs to be created,
#in order to do that you need to bootstrap this node
wsrep_cluster_address="gcomm://{{ your_cluster_IPs }}"

# In order for Galera to work correctly binlog format should be ROW

# MyISAM storage engine has only experimental support

# Slave thread to use
wsrep_slave_threads= 8


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

# Node IP address
wsrep_node_address={{ node_address }}

# Cluster name
wsrep_cluster_name={{ cluster_name }}

#If wsrep_node_name is not specified,  then system hostname will be used

#pxc_strict_mode allowed values: DISABLED,PERMISSIVE,ENFORCING,MASTER

# SST method

#Authentication for SST method
wsrep_sst_auth={{ sst_user }}:{{ sst_pass }}

The file /etc/mysql/percona-xtradb-cluster.conf.d/mysqld.cnf contains additional settings like the data directory. We’re assuming you keep the default /var/lib/mysql.

Configure AppArmor, SELinux or other Kernel Security Module

If you’re changing the location of the database data directory, you might need to configure your security module accordingly.

On the first Percona node

Start the Database

sudo /etc/init.d/mysql bootstrap-pxc

Watch the logs using tail -f /var/log/mysqld.log. Look for a log entry like WSREP: Setting wsrep_ready to true.

Create the Corda User

CREATE USER corda IDENTIFIED BY '{{ password }}';

Create the Database and Tables


CREATE TABLE IF NOT EXISTS corda.notary_committed_states (
                              issue_transaction_id BINARY(32) NOT NULL,
                              issue_transaction_output_id INT UNSIGNED NOT NULL,
                              consuming_transaction_id BINARY(32) NOT NULL,
                              CONSTRAINT id PRIMARY KEY (issue_transaction_id, issue_transaction_output_id)

GRANT SELECT, INSERT ON corda.notary_committed_states TO 'corda';

CREATE TABLE IF NOT EXISTS corda.notary_request_log (
                              consuming_transaction_id BINARY(32) NOT NULL,
                              requesting_party_name TEXT NOT NULL,
                              request_signature BLOB NOT NULL,
                              request_date TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
                              request_id INT UNSIGNED NOT NULL AUTO_INCREMENT,
                              CONSTRAINT rid PRIMARY KEY (request_id)

GRANT INSERT ON corda.notary_request_log TO 'corda';

Create the SST User

CREATE USER ‘{{ sst_user }}’@localhost IDENTIFIED BY ‘{{ sst_pass }}‘;

On all other Nodes

Once you have updated the wsrep.cnf on all nodes, start MySQL on all the remaining nodes of your cluster. Run this command on all nodes of your cluster, except the first one.

service mysql start

Watch the logs using tail -f /var/log/mysqld.log. Make sure you can start the MySQL client on the command line and access the corda database on all nodes.

mysql> use corda;
# The output should be `Database changed`.

In the next section, we’re Setting up the Notary Service. You can read about Percona Monitoring, Backup and Restore (Advanced) in a later section of this tutorial.