Subversion Repository Mirroring using svnsync

Mirroring a svn repository is a good way to keep a backup of all the work under your source control in case of a disaster (hardware failure or other disrupting event). svnsync is the subversion remote repository mirroring tool.

In any mirroring scenario, there are two repositories: the source repository, and the mirror (or “sink”) repository. The source repository is the repository from which svnsync pulls revisions. The mirror repository is the destination for the revisions pulled from the source repository. Each of the repositories may be local or remote—they are only ever addressed by their URLs.

The svnsync process requires only read access to the source repository; it never attempts to modify it. But obviously, svnsync requires both read and write access to the mirror repository.

The steps to setup a mirror repository are based on the assumption that we already have svn setup on both master and slave machines (if not follow the steps listed here to set one up) and repositories (if any) are  accessible via apache.

1. On the master host

a. Create a new repository(as root)

svnadmin create <SVNParentPath>/<new_repository_name>

e.g.  svnadmin create /svn/repos/myrepo

b. Change the owner of the new respoitory

chown -R <owner>:<owner>  <SVNParentPath>/<new_repository_name>

e.g.  chown -R csvn:csvn  /svn/repos/myrepo

2. On the slave host

a. Create the same new repository (as root) by repeating steps 1 and 2 explained above.

b. Since this is a read-only mirror repository its good to create a svnsync user account (for mirroring purpose only), having read-write access to this repository

/opt/CollabNet_Subversion/bin/htpasswd –b <PathTo>/svn_auth_file <user_name> <user_password>

e.g. /opt/CollabNet_Subversion/bin/htpasswd –b /etc/opt/CollabNet_Subversion/conf/svn_auth_file svnsync password

Add the svnsync user to the access file. Edit the svn_access_file and find the section for the repository concerned and then add a line with the user’s access permissions.

# vi /etc/opt/CollabNet_Subversion/conf/svn_access_file

[/]

svnsync = rw

At present all users in the “/” list will have access to all repositories.

c. Limit the read-write access to the repository, to svnsync user only, by creating a start-commit hook. Create the file /svn/repos/myrepo/hooks/start-commit

#!/bin/bash
USER=”$2″
if [ “$USER” = “svnsync” ];
then exit 0;
fi
echo “Only the svnsync user may commit changes/revisions to this repository” >&2 exit 1

d. We also need to ensure that svnsync is the only user that is able to add, modify or delete revision properties. This can be done by adding another hook pre-revprop-change. Create the file /svn/repos/myrepo/hooks/pre-revprop-change

#!/bin/bash
USER=”$3″
if [ “$USER” = “svnsync” ];
then exit 0;
fi
echo “Only the svnsync user can change revision properties” >&2
exit 1

e. Assign execute permission to both the scripts created above:

chown csvn:csvn /svn/repos/myrepo/hooks/start-commit
chmod +x /svn/repos/myrepo/hooks/start-commit

chown csvn:csvn /svn/repos/myrepo/hooks/pre-revprop-change
chmod +x /svn/repos/myrepo/hooks/pre-revprop-change

This completes the setup required on slave host for mirroring.

3. On the master host

a. Initialize svnsync. Create a user account on master host for mirroring purpose following the steps listed in 2b

svnsync initialize http://slave_host:81/svn/myrepo/ http://master_host:81/svn/myrepo/ –sync-username svnsync –sync-password password –source-username svnsync –source-password password

b. We need to setup our master repository so that it should run svnsync after every commit. This is achieved by post-commit script. Create the file /svn/repos/myrepo/hooks/post-commit

!/bin/bash
SVNSYNC=/opt/CollabNet_Subversion/bin/svnsync
TO=http://slave_host:81/svn/myrepo
SYNC_USER=svnsync
SYNC_PASS=password
SOURCE_USER=svnsync
SOURCE_PASS=password
$SVNSYNC –non-interactive sync $TO \
–sync-username $SYNC_USER –sync-password $SYNC_PASS \
–source-username $SOURCE_USER –source-password $SOURCE_PASS &  exit 0

Set the file owner and permissions

chown csvn:csvn /svn/repos/myrepo/hooks/post-commit
chmod +x /svn/repos/myrepo/hooks/post-commit

c. Finally we need to ensure that changes to revision properties are also synced. To do this you’ll need to set up a post-revprop-change hook script. Create the file /svn/repos/myrepo/hooks/post-revprop-change

#!/bin/bash
SVNSYNC=/opt/CollabNet_Subversion/bin/svnsync
TO=http://slave_host:81/svn/myrepo
SYNC_USER=svnsync
SYNC_PASS=password
SOURCE_USER=svnsync
SOURCE_PASS=password

$SVNSYNC –non-interactive copy-revprops $TO \
–sync-username $SYNC_USER –sync-password $SYNC_PASS \
–source-username $SOURCE_USER –source-password $SOURCE_PASS $2 & exit 0

d. Assign execute permission to both the scripts created above:

chown csvn:csvn /svn/repos/myrepo/hooks/post-commit
chmod +x /svn/repos/myrepo/hooks/post-commit

chown csvn:csvn /svn/repos/myrepo/hooks/post-revprop-change
chmod +x /svn/repos/myrepo/hooks/post-revprop-change

 

Synchronizing an existing repository

In order to synchronize already existing repositories and set them up for mirroring, run all the steps listed in 2 and 3 and then execute below command from master host for each repository(do not perform step 1)

svnsync –non-interactive sync http://slave_host:81/svn/myrepo/ –sync-username svnsync –sync-password password –source-username svnsync –source-password password

This completes the setup of svn mirroring and hopefully you should be able to see your revisions being synced to the slave as soon as you commit changes at master. I have tested this for most of my repositories and this is working fine. Comments and feedback welcome.

Subversion: Installation on Solaris 10 SPARC

April 13, 2012 4 comments

Subversion is an open source version control system. Here are the steps that I followed to setup subversion on Solaris 10 SPARC. Most of the steps have been picked up from original installation guide.

1. Platform and configuration

Product: CollabNet Subversion client

Platforms: SunOS 5.10 Generic_142900-02 sun4u sparc SUNW, Sun-Fire-V440

2. Prerequisite: You must be a superuser (root) to install and uninstall subversion

3. Download required software from internet:

A. CollabNet certificate

# wget http://www.collab.net/nonav/downloads/subversion/certificate/certificate.pem

B. Subversion client

# wget http://www.open.collab.net/files/documents/61/2476/CSVNclnt-1.5.7.2-sparc-local.gz

C. Subversion server

# wget http://www.open.collab.net/files/documents/61/2477/CSVNsrvr-1.5.7.2-sparc-local.gz

D. Subversion Extras (Subversion python bindings and ViewVC)

# wget http://downloads-guests.open.collab.net/files/documents/61/2478/CSVNxtrs-1.5.7.2-sparc-local.gz

4. Installation

A. CollabNet Subversion Solaris packages are signed. As a one-time task,

import the CollabNet certificate using the command:

# pkgadm addcert -ty certificate.pem

B. Run below command to verify that certificate is imported properly

# pkgadm listcert

                 Keystore Alias: Alexander Thomas(AT)

              Common Name: Alexander Thomas(AT)

              Certificate Type: Trusted Certificate

   Issuer Common Name: Alexander Thomas(AT)

    Validity Dates: <Jul 31 11:44:46 2008 GMT> – <Mar 10 11:44:46 2014 GMT>

   MD5 Fingerprint: 0D:95:50:E9:89:F6:AD:99:9A:B9:6D:F4:21:2D:67:4E

  SHA1 Fingerprint: 66:F5:28:DF:21:C4:79:22:AC:1D:F2:E6:1B:88:5E:91:3F:7C:69:2B

C. Install subversion client

# gunzip /path_to/CSVNclnt-1.5.2.1-sparc-local.gz

# pkgadd –d /path_to/CSVNclnt-1.5.2.1-sparc-local

Follow the prompt and enter appropriate values wherever required(press ENTER for default) and you should see below message at the end

Installation of <CSVNclnt> was successful.

D. Install subversion server

# gunzip /path_to/CSVNsrvr-1.5.7.2-sparc-local.gz

# pkgadd –d /path_to/CSVNsrvr-1.5.7.2-sparc-local

Follow as explained in step 4C

E. Install Subversion Extras (Subversion python bindings and ViewVC)

# gunzip /path_to/CSVNxtrs-1.5.7.2-sparc-local.gz

# pkgadd –d /path_to/CSVNxtrs-1.5.7.2-sparc-local

Follow as explained in step 4C

5. Post-installation instructions

A. CollabNet Subversion installs into /opt/CollabNet_Subversion, which is probably not on the executable search path for your system. Add the directory /opt/CollabNet_Subversion/bin to your $PATH environment variable. In order to make this change affect all users of your system and persists across reboots, add the following line to /etc/profile:

    PATH=/opt/CollabNet_Subversion/bin:$PATH

B. CollabNet Subversion provides man pages and localizations for several languages. To take advantage of these features, update your MANPATH and/or LOCPATH environment variables to include the CollabNet Subversion directories.  For example:

# export MANPATH=/opt/CollabNet_Subversion/share/man:$MANPATH

# export LOCPATH=/opt/CollabNet_Subversion/share/locale:$LOCPATH

C. Configure-CollabNet-Subversion script allows you to choose which Subversion server process you want to run (either Apache or the custom svnserve daemon) and configure it. The script also walks you through creating Subversion repositories. Run the interactive script and follow the prompt(A sample run is shown below)

# /opt/CollabNet_Subversion/bin/Configure-CollabNet-Subversion

CollabNet Subversion Server is a free download of open-source Subversion, compiled and tested by CollabNet. For more information about CollabNet Subversion, visit the CollabNet community at http://open.collab.net.

Would you like to configure the CollabNet Subversion Server now? [yes]

Welcome to CollabNet Subversion Server setup.

You will now be asked some questions to configure CollabNet Subversion.

Defaults are given in square brackets. If a default is okay for you

Just hit [Enter] to continue.

This setup can configure either Apache or svnserve as Subversion

server, for you. Would you like to configure Apache as your

Subversion server now? [yes]

Continuing with apache Subversion server configuration …

Specify the base directory for Subversion repositories: [/var/svn/repositories] /path_to/my_repo1

Searching for existing Subversion repositories …

No repositories found under /path_to/my_repo1

Should I use this path? [yes]

Would you like to create a new Subversion repository? [yes]

What should be your new Subversion repository name? test_repo

New repository created.

Would you like to initialize the repository with trunk/branches/tags folders? [no] yes

Done.

Would you like to create another Subversion repository? [yes] no

Would you like to give the name and port that the server uses to identify itself? [yes]

Registered DNS name or IP address: 192.168.1.1

Server port number: 81

Allow anonymous read access? [no]

0 users currently have access to this repository:

Would you like to create a new Subversion account? [yes]

Account username

(To re-create or delete a Subversion account, enter an existing username): user1

Account password:

Retype account password:

Adding password for user user1

Account created

Would you like to create another user account? [yes] no

Would you like to configure ViewVC?  [yes]

Stopping CollabNet Subversion:

httpd (no pid file) not running

OK

Starting CollabNet Subversion:

OK

Congratulations! You have successfully configured the CollabNet

Subversion server.

You can access your repositories at the following URL:

http://192.168.1.1:81/svn/YOUR-REPOS-NAME

http://192.168.1.1:81/viewvc/YOUR-REPOS-NAME

This completes the subversion installation on solaris. A few handy commands that may help you getting info regarding your subversion setup are:

To Stop or Start Subversion(login as root)

# /etc/init.d/collabnet_subversion stop

# /etc/init.d/collabnet_subversion start

To find out where the Subversion configuration directory is:

# /opt/CollabNet_Subversion/bin/collabnetsvn-config –confdir

//etc/opt/CollabNet_Subversion

To find out where the Subversion repository Parent Path is: 

# /opt/CollabNet_Subversion/bin/collabnetsvn-config –repository

/path_to/my_repo1

To create a new repository under the Parent Path

# svnadmin create <SVNParentPath>/<new_repository_name>

Change the owner of the new respoitory to be csvn

# cd  <SVNParentPath>

# chown -R csvn:csvn  <new_repository_name>

The new repository can now be accessed via URL:

http://server:port/svn/new_repository_name

http://server:port/viewvc/new_repository_name

To add a new user or change a users password (Login as root and cd to the Subversion configuration directory)

# cd /etc/opt/CollabNet_Subversion/conf

# /opt/CollabNet_Subversion/bin/htpasswd –b svn_auth_file <user_name> <user_password>

When adding a new user you must add the user to the access file. Edit the svn_access_file and find the section for the repository concerned and then add a line with the users access permissions.

# vi svn_access_file

[/]

<user_name> = rw

At present all users in the “/” list will have access to all repositories.

This completes our subversion setup. Feedback and comments welcome.

Jenkins: Monitoring external jobs

Jenkins CI is the leading open-source continuous integration server.  It’s primarily used for:

  1. Building/testing software projects continuously
  2. Monitoring executions of externally-run jobs

Today we will discuss about using Jenkins CI for Monitoring executions of externally-run jobs. I used to receive various daily reports via cron in my mailbox from different servers. Then I had to fill an excel sheet with all these to produce a final report on server health status. This was an annoying task. I found Jenkins a great tool to overcome this boring task without any extra cost and with very little effort. Here are the basic steps on how this can be done.

These steps were performed on “SunOS 5.10 Generic_142900-02 sun4u sparc SUNW,Sun-Fire-V440” platform. However, these can be executed on any LINUX/UNIX platform without much changes.

Make sure you have java present on your hosts. You may check this by

$which java

/usr/jdk/jdk1.6.0_21/bin/java

$java -version

java version “1.6.0_21”
Java(TM) SE Runtime Environment (build 1.6.0_21-b06)
Java HotSpot(TM) Server VM (build 17.0-b16, mixed mode)

If java is missing then install java

1. Download Jenkins

$wget http://jenkins.mirror.isppower.de/war/1.451/jenkins.war

(In no wget or server behind a firewall blocking internet access, the download on your local PC and scp/ftp to your host)

2. Install and start jenkins by running below command

$nohup java -jar jenkins.war > jenkins.log 2>&1 &

The new build server should now be available at:

http://host1:8080/

If everything has gone well you would be able to see the Jenkins Dashboard. You may wish to configure few basic things as per your need by clicking “Manage Jenkins” –> “Configure System”.

Next, lets configure a job which monitors an external job, on a remote server. There are 2 ways of doing this and we will discuss both.

Method 1(using crontab)

1.1. On Jenkins Dashboard Click “New Job

1.2. Put a Job name e.g. Report1

1.3. Check “Monitor an external job” and click “OK

1.4. Put a brief Description(optional) about the job on next page, click “Save” and return back to the dashboard. You will notice that this Job cannot be executed from Jenkins Dashboard (the build button against this job is missing)!

Next steps(1.5 to 1.9) have to be executed on remote server, host2 (which you want to monitor via jenkins)

Logon to host2, make sure you have java installed on this host too.

1.5a. $export JENKINS_HOME=http://host1:8080

If you have enabled security on Jenkins server and only authorized users can run a Job, then JENKINS_HOME should be:

1.5b. $ export JENKINS_HOME=http://user_id:password@host1:8080

where user_id and password are that of an account in Jenkins, authorized to execute the build.

1.6. SCP/FTP below files from host1 ~/.jenkins/war/WEB-INF/lib/ directory to, a new directory preferably, on host2(say ~/jenkins/).

jenkins-core-1.451.jar

xstream-1.3.1-jenkins-9.jar

ant-1.8.0.jar

commons-lang-2.4.jar

jenkins-core-1.451.jar

remoting-2.12.jar

xstream-1.3.1-jenkins-9.jar

commons-io-1.4.jar

jna-posix-1.0.3.jar

1.7. If your report is generated by a script myreport.sh then this can be done by executing

$ java -jar /path_to/jenkins/jenkins-core-*.jar “Report1” /path_to/myreport.sh 2>&1 > /dev/null

Job “Report1” should now be executed and details of execution can now be seen on Jenkins dashboard. This was a manual execution which you do not want to do daily. You want this to happen automatically. So lets put this in crontab on host2.

1.8. Add below 2 lines to a new script say, jenkins_report.sh

export JENKINS_HOME=http://user_id:password@host1:8080

java -jar /path_to/jenkins/jenkins-core-*.jar “Report1” /path_to/myreport.sh 2>&1 > /dev/null

Save the script and grant execute permissions to the script by

$ chmod 755 jenkins_report.sh

1.9. Add below entry in your crontab by executing

$ crontab -e

15 06 * * * /path_to/jenkins_report.sh

This should now execute the script for the build job “Report1” at 06:15 am daily and same can be monitored via Jenkins Dashboard.

Method 2

2.1. On Jenkins Dashboard click “Manage Jenkins” –> “Manage Plugins” and from “Available” plugins tab, install “Jenkins SSH Plugin“. This plugin executes shell commands remotely using SSH protocol.

2.2. On Jenkins Dashboard click “Manage Jenkins” –> “Configure System” and under “SSH remote hosts” section click “Add“. Fill in the details(fields listed below) of your remote server where you wish to execute a command or script.  You only need to fill either Password/Passphrase or Keyfile.

Hostname

Port

User Name

Password/Passphrase

Keyfile

Click save at the the bottom of the page and return to Jenkins Dashboard.

2.3. On Jenkins Dashboard click “New Job

2.4. Put a Job name e.g. Report2

2.5. Check “Build a free-style software project” and click “OK

2.6. Now configure below sections:

Description: <any meaningful description. this is optional>

Source Code Management

Select None

Build Triggers

Check Build periodically and enter as below(this would execute the build to 06:15 AM every day, you can set this to any desired value)

15 06 * * *

You can configure (if you desire) this job to be executed after another job, depending upon your requirement. But most of us would go with the option explained above.

Build

Click Add build step and select Execute shell script on remote host using SSH

Select the SSH site from drop down that was added in step 2.2

Paste the contents of script e.g. myreport.sh(mentioned in step 1.7) in Command section or any command/script you wish to execute on remote server.

Post-build Actions

Select an option that suits your requirements the best. A good practice would be to send an E-mail Notification –> Send e-mail for every unstable build. Fill the Receipients e-mail addresses seperated by a space(in case of multiple receipients) and click Save.

This completes the job setup which would build the job daily at and same can be monitored via the Jenkins dashboard. Run the build manually once to check if all works as expected.

Have fun!

Feedback welcome.

MySQL Cluster Installation

MySQL is one of most popular Open Source SQL database management system.

A MySQL cluster consists of four nodes, ideally each on a separate host computer. However, here we will discuss the steps to install or setup a MySQL cluster using just 3 separate UNIX/LINUX hosts have 1 management node, 2 data nodes and 2 SQL nodes.

Node

IP Address

Hostname

Management node (mgmd)

192.168.0.3

mysql3.mydomain.com

SQL node “A” (mysqld)

192.168.0.2

mysql2.mydomain.com

Data node “A” (ndbd)

192.168.0.2

mysql2.mydomain.com

SQL node “B” (mysqld)

192.168.0.1

mysql1.mydomain.com

Data node “B” (ndbd)

192.168.0.1

mysql1.mydomain.com

Notes:
You MUST have a third server as a management node but this can be shut down after the cluster starts. Also note that its not recommended to shut down the management server.Although it is possible to set the cluster up on two physical servers you you can not run a MySQL Cluster with just two servers and have true redundancy. For this you need a third server running the management node.Servers 1 and 2 will be our Data nodes(ndbd) and SQL nodes(mysql). Server 3 will be the management server(mgmd)Prerequisites:
– Ensure that mysql user(LINUX/UNIX) account exists on the servers, if not get this account created or do it yourself if you have root privileges on these servers

– Download the latest MySQL package from http://dev.mysql.com/downloads/cluster/#downloads as per your LINUX platform using wget or FTP/SCP from your local machine to all 3 hosts.

1: Setup the Management Node on 192.168.0.3
1. Logon as mysql user and make sure you are at the home directory while running below steps(here our home directory is /home/mysql)
2. tar -zxvf <path_to_mysql_package>/mysql-cluster-gpl-7.1.13-linux-x86_64-glibc23.tar.gz > /dev/null
3. ln -s $HOME/mysql-cluster-gpl-7.1.13-linux-x86_64-glibc23 mysql-cluster
4. mkdir -p ~/data/mgmt
5. mkdir ~/config
6. vi ~/config/config.ini
[NDBD DEFAULT]
NoOfReplicas= 2
UndoIndexBuffer=64M
RedoBuffer=256M
NoOfFragmentLogFiles=144
TimeBetweenLocalCheckpoints=11

[NDB_MGMD DEFAULT]
DataDir= /home/mysql/data/mgmt

# Managment Server
[NDB_MGMD]
NodeId=1
HostName= 192.168.0.3 # the IP of THIS SERVER

[NDBD]
NodeId=11
HostName= 192.168.0.1 # the IP of the FIRST SERVER
DataDir= /home/mysql/data/data1

[NDBD]
NodeId=12
HostName= 192.168.0.2 # the IP of the SECOND SERVER
DataDir= /home/mysql/data/data2

[MYSQLD DEFAULT]
[MYSQLD]
NodeId=111
HostName= 192.168.0.1 # the IP of the FIRST SERVER

[MYSQLD]
NodeId=112
HostName= 192.168.0.2 # the IP of the SECOND SERVER

2: Setup the Storage Node
Install MySQL on the hosts 1 and 2:
Run following steps on both the hosts:

1. Logon as mysql user and make sure you are at the home directory while running below steps(here our home directory is /home/mysql)
2. tar -zxvf <path_to_mysql_archive>/mysql-cluster-gpl-7.1.13-linux-x86_64-glibc23.tar.gz > /dev/null
3. ln -s $HOME/mysql-cluster-gpl-7.1.13-linux-x86_64-glibc23 mysql-cluster
Below step on 1st host only
4. mkdir -p config data/data1
Below step on 2nd host only
5. mkdir -p config data/data2
6. vi config/my.cnf
[mysqld]
ndbcluster
ndb-connectstring = 192.168.0.3 # the IP of the MANAGMENT (THIRD) host
basedir= /home/mysql/mysql-cluster
language= /home/mysql/mysql-cluster/share/english
datadir= /home/mysql/data/data1 # on 2nd server replace data1 with data2
socket=/home/mysql/api1.sock # on 2nd server replace api1.sock with api2.sock
max_connections = 500
[mysql_cluster]
ndb-connectstring = 192.168.0.3 # the IP of the MANAGMENT (THIRD) host
port=3306
[client]
socket=/home/mysql/api1.sock # on 2nd server replace api1.sock with api2.sock

7. Add ~/mysql-cluster/bin/ to PATH variable by export PATH=$PATH:~/mysql-cluster/bin/ (do this on all 3 hosts). Best would to do this in your .profile or .bash_profile file.
8. cd mysql-cluster
9. scripts/mysql_install_db –datadir=$HOME/data/data1

3: Start MySql Cluster
1. Start the management node on 192.168.0.3:
ndb_mgmd -f $HOME/config/config.ini –config-dir=$HOME/config/
2. Start the storage engine on other 2 servers(192.168.0.1 and 192.168.0.2):
ndbd –ndb-connectstring=192.168.0.3
Note: ONLY use –initial if you are either starting from scratch or have changed the config.ini
3. Start MySql on other 2 hosts(192.168.0.1 and 192.168.0.2). Wait for the Data Nodes to finish starting before starting the MySQL Server:
mysqld –defaults-file=$HOME/config/my.cnf &
4. Check the status of the Cluster from management node by executing below command
ndb_mgm -e show

A sample output looks like this:

Connected to Management Server at: localhost:1186
Cluster Configuration
———————
[ndbd(NDB)] 2 node(s)
id=2 @192.168.0.1 (mysql-5.1.56 ndb-7.1.13, Nodegroup: 0, Master)
id=3 @192.168.0.2 (mysql-5.1.56 ndb-7.1.13, Nodegroup: 0)

[ndb_mgmd(MGM)] 1 node(s)
id=1 @192.168.0.3 (mysql-5.1.56 ndb-7.1.13)

[mysqld(API)] 2 node(s)
id=4 (mysql-5.1.56 ndb-7.1.13)
id=5 (mysql-5.1.56 ndb-7.1.13)

5. Now create password for localhost (both hosts)
mysqladmin –protocol=tcp -u root password ‘newpassword’
6. Assign privileges to root user (both hosts)
mysql –protocol=tcp -u root -p
use mysql;
mysql>CREATE USER ‘root’@’%’ IDENTIFIED BY ‘newpassword’;
mysql>grant all privileges on *.* to ‘root’@’%’ WITH GRANT OPTION;

Above root user will have access to MySQL cluster from any host(%). You may restrict the access to preferred hosts by replacing % with appropriate host name but I do not prefer this level of security. Your organization firewall should be good enough to take care of any external threats.

4: Test the setup
On either server 192.168.0.1 or 192.168.0.2 enter the following commands
1. mysql –protocol=tcp -u root -p
2. use test;
3. create table mytable (id int not null primary key) engine=NDBCLUSTER;
4. insert into mytable values (1),(3),(5),(7);
5. select * from mytable;
+—-+

id

+—-+

1
3
5
7

+—-+

Now go to the other server and run the same SELECT statement and it should return the same output as 1st server. Insert from that host and go back to host 1 and see if it works you should see the newly inserted row on server 1. This completes our “simple” MySQL-cluster setup.