There was a request to be able to test RonDB using Docker. This is now working.
These commands will set up a RonDB cluster on your local machine that can be used to test RonDB:
Step 1: Download the Docker containers for RonDB
docker pull mronstro/rondb
Step 2: Create a Docker subnet
docker network create mynet --subnet=192.168.0.0/16
Step3: Start the RonDB management server
docker run -d \
--net=mynet \
-v /path/datadir:/var/lib/rondb \
-ip 192.168.0.2 \
-name mgmt1 \
mronstro/rondb ndb_mgmd --ndb-nodeid=65
Step 4: Start the first RonDB data node
docker run -d \
--net=mynet \
-v /path/datadir:/var/lib/rondb \
-ip 192.168.0.4 \
-name ndbd1 \
mronstro/rondb ndbmtd --ndb-nodeid=1
Step 5: Start the second RonDB data node
docker run -d \
--net=mynet \
-v /path/datadir:/var/lib/rondb \
-ip 192.168.0.5 \
-name ndbd2 \
mronstro/rondb ndbmtd --ndb-nodeid=2
Step 6: Check that the cluster has started and is working
This step isn't required, but just to show that the cluster is
up and running, start the RonDB management client and issue the
show command.
docker exec -it mgmt1 ndb_mgm
ndb_mgm> show
This should hopefully show a starting cluster and after about
half a minute the cluster should be started.
Step 7: Start a MySQL Server
Note that the MySQL Server uses /var/lib/mysql as datadir internally
whereas the RonDB management server and data node uses
/var/lib/rondb.
docker run -d \
--net=mynet \
-v /path/datadir:/var/lib/mysql \
-e MYSQL_ROOT_PASSWORD=your_password \
-ip 192.168.0.10 \
-name mysqld1 \
mronstro/rondb mysqld --ndb-cluster-connection-pool-nodeids=67
Step 8: Start a MySQL client
docker exec -it mysqld1 mysql -uroot -p
Password: your_password
Now you are connected to a MySQL client that can issue SQL commands
towards the RonDB cluster. Below is a very simple example of such
commands:
mysql> CREATE DATABASE TEST;
mysql> USE TEST;
mysql> CREATE TABLE t1 (a int primary key) engine=ndb;
mysql> INSERT INTO t1 VALUES (1),(2);
mysql> SELECT * FROM t1;
I tested this on my development machine using Mac OS X. To succeed with the setup
my Docker setup required at least 8 GByte of memory. RonDB is optimised for use
in VMs in the cloud where a minimum of 8 GByte of memory is available for the
data node VMs. Since the default configuration of Docker will presumably mainly
be used for simple tests I decided to decrease the size of the RonDB data nodes
such that they fit in 3 GBytes of memory. It is definitely possible to run
RonDB in an even smaller environment, but I think that the default should at least
be able to load at least 1 GByte of data and a fair amount of tables into RonDB.
RonDB and Docker is documented at https://docs.rondb.com/rondb_docker/
The RonDB documentation has also been improved at the same time.
The GitHub tree for the Docker containers can be found at:
The GitHub tree is based on the MySQL Docker tree at GitHub.
The Docker Hub is found at:
Thanks a lot, it's super useful!
ReplyDelete