MySQL Cluster Sandbox - pre-defined packages
MySQL Cluster Sandbox let's you get going within seconds. The packages contains a number of scripts to install, setup, and run MySQL CLuster and are intended for localhost installation only. They can be used for evaluation and development, as well as getting familiar with MySQL Cluster. Disk intensive, i.e write intensive apps, should use a real distributed setup. Otherwise there is a big chance that you will overload the disk subsystem. The data nodes will complain about "Redo logs overloaded" or something about "Redobuffer". If you want to have a real distributed setup, please use the configurator!
The packages comes with:
- 1 management server
- 2 data nodes
- 2 mysql servers
All processes are running on localhost! Please read the README to see the directory structure of the packages.
You can install the packages as any user! It will be self-contained in one single directory! You can also chose ports so that you can test with several versions, or also setup replication between two clusters on localhost!
Choose if you want to use the Pre-packaged configurations (fixed ports) or create a Custom configuration where you set the ports yourself.
Whatever you chose the scripts can automatically download and compile the latest source code release, or you can download the latest binary release from dev.mysql.com/downloads/cluster
mac osx users
- install GNU getopt from MacPorts ( port install getopt )
- download macos.sh and put in mysqlcluster-71-small
- sh macosh.sh
Follow the instructions further down.
If you don't want to follow the three steps above to prepare your Mac, then you need to use the custom sandbox for now. Make sure you tick the 'Mac OS X?' checkbox. You only have to press the "Send me the config package.." after having entered a valid email address, and the sandbox will be sent to you. In a short time, i will generate ready-made sandboxes.
Binaries are downloaded from dev.mysql.com and then run ./dist-tgz.sh mysql-cluster-gpl-7.1.9a-osx10.6-x86_64.tar.gz where mysql-cluster-gpl-7.1.9a-osx10.6-x86_64.tar.gz is the binary tar.gz you have downloaded from mysql.
If you want to build from source, you also need to download apple xcode and wget.
Try out the Custom sandbox for more tunables.
Pre-packaged
You can choose from three types of Sandboxes (no replication, master cluster and slave cluster) and also thee different sizes:
- Small - suitable for a computer with 1-2GB of RAM. 2GB is required if fully loaded up with data.
- Medium - suitable for a computer with ~4GB of RAM. 4GB is required if fully loaded up with data.
- Large - suitable for a computer with ~8GB of RAM.
The following ports are used in the packages (see below for details): 1186 and 1187 (management server), 3306, 3307, 3310, 3311 (mysql servers).
Small
| package | ports used | download | extra info | cluster version |
|---|---|---|---|---|
| no replication | 1186, 3306, 3307 | mysqlcluster-71-small.tar.gz | DataMemory=256M | mysql-cluster-gpl-7.1.14 |
| master cluster | 1186, 3306, 3307 | mysqlcluster-71-small-master.tar.gz | DataMemory=256M | mysql-cluster-gpl-7.1.14 |
| slave cluster | 1187, 3310, 3311 | mysqlcluster-71-small-slave.tar.gz | DataMemory=256M | mysql-cluster-gpl-7.1.14 |
Medium
| package | ports used | download | extra info | cluster version |
|---|---|---|---|---|
| no replication | 1186, 3306, 3307 | mysqlcluster-71-medium.tar.gz | DataMemory=1024M | mysql-cluster-gpl-7.1.14 |
| master cluster | 1186, 3306, 3307 | mysqlcluster-71-medium-master.tar.gz | DataMemory=1024M | mysql-cluster-gpl-7.1.14 |
| slave cluster | 1187, 3310, 3311 | mysqlcluster-71-medium-slave.tar.gz | DataMemory=1024M | mysql-cluster-gpl-7.1.14 |
Large
| package | ports used | download | extra info | cluster version |
|---|---|---|---|---|
| no replication | 1186, 3306, 3307 | mysqlcluster-71-large.tar.gz | DataMemory=2560M | mysql-cluster-gpl-7.1.14 |
| master cluster | 1186, 3306, 3307 | mysqlcluster-71-large-master.tar.gz | DataMemory=2560M | mysql-cluster-gpl-7.1.14 |
| slave cluster | 1187, 3310, 3311 | mysqlcluster-71-large-slave.tar.gz | DataMemory=2560M | mysql-cluster-gpl-7.1.14 |
Installation - Pre-packaged and Custom
- Download the package you want and unpack it. E.g something like:
- tar xvfz mysqlcluster-71-<type>.tar.gz
- cd mysqlcluster-71-<type>
- Continue from either "To build from source" (MySQL makes source releases for frequently than binary builds) or "Using a tar.gz distro"
To build from source
Personally I recommend building from source since you get the latest version of MySQL Cluster. I don't update the scripts with a new Cluster version the same day as it is released, but wait usually one week so that potential regression problems have been spotted by someone else.
You must have installed
- gcc and g++ e.g,
apt-get install gcc g++oryum install gcc.x86_64 - wget e.g,
apt-get install wgetoryum install wget.x86_64 - ncurses-dev e.g,
apt-get install libncurses5-devoryum install ncurses-devel.x86_64
Then run the following four scripts
- download-and-compile.sh - gets the latest officially released cluster source, configure, and build. The resulting build is in the build/ directory
- dist-src-build.sh - Distribute the binary located in build/mysql... to the hosts in the cluster
- bootstrap.sh - sets up directory structures and installs the mysql servers configured with a hostname. The script will delete any old information (if a previous mysqld data directory exists on the same location) located on a host. Configuration files (my.cnf and config.ini) will be installed in /etc/mysql/
- start-cluster.sh --initial - starts the management server(s), the data nodes and the mysql server(s) configured with a hostname
Using a tar.gz distro
- Download the binary tar package (RPMs etc does not work with this) from mysql
- dist-tgz.sh
- Distribute the binary and upacks them on to the hosts in the cluster - bootstrap.sh - sets up directory structures and installs the mysql servers configured with a hostname. The script will delete any old information (if a previous mysqld data directory exists on the same location) located on a host. Configuration files (my.cnf and config.ini) will be installed in /etc/mysql/
- start-cluster.sh --initial - starts the management server(s), the data nodes and the mysql servers
After this you can the use the other scripts:
- show.sh - shows the nodes connected to the cluster
- status.sh - prints the status of the data nodes in the cluster
- mysqlclient-1.sh - a mysql client that connects to mysql server one,
mysql -S /tmp/mysql.sock.3306does also work, unless you use a slave sandbox, thenmysql -S /tmp/mysql.sock.3310 - mysqlclient-2.sh - a mysql client that connects to mysql server two,
mysql -S /tmp/mysql.sock.3306does also work, unless you use a slave sandbox, thenmysql -S /tmp/mysql.sock.3311 - start-backup.sh "directory" - starts a backup and copies the backup files from the data nodes and puts them in the "directory" (which must exist) and removes the local backup on the data nodes.
There are also scripts to stop the cluster, start and stop individual nodes. E.g:
- start-ndbd-... - start a ndbd node on a particular host (there are also scripts to start with --initial)
- stop-ndbd-... - stops a ndbd node on a particular host
- start-mysqld-... - starts a mysqld on a particular host
- stop-mysqld-... - stops a mysqld node on a particular host
- stop-cluster.sh - stops management servers, data nodes and also the mysql servers (if present in the script variable 'mysql_hostnames')
- rolling-restart.sh... - updates the cluster with a new version or with changed configuration parameters (such as more mysql servers or more data memory (you must recalculate the size of the redo log then). Please note that some parameter changes requires an initial rolling restart (especially file system related parameters. See the reference manual). Moreover, you should update the config/config.ini since that is the one being distributed to the management servers. Please not that you can't change NoOfReplicas or add more data nodes using rolling restart (yet). If you try you will have a cluster failure to sort out. You can also upgrade to a new version (never downgrade) using dist.sh (which will download a new version if it exists) and then use rolling-restart.sh to upgrade to that version.
- rolling-restart.sh --initial... - For parameters requiring an initial rolling restart..(NoOfFragmentLogfiles, FragmentLogFileSize, DataDir...)
Common issues
Error loading shared libraries - LD_LIBRARY_PATH not set
If you get the something like the following error message when starting the mysql client (or any other mysql tool):
/usr/local/mysql/mysql/bin/mysql: error while loading shared libraries: libmysqlclient.so.16: cannot open shared object file: No such file or directory
Then you need to set the LD_LIBRARY_PATH
E.g:
export LD_LIBRARY_PATH=/usr/local/mysql/mysql/lib/mysql:$LD_LIBRARY_PATH
or
export LD_LIBRARY_PATH=/usr/local/mysql/lib/mysql:$LD_LIBRARY_PATH
or
export LD_LIBRARY_PATH=/usr/local/mysql/mysql/lib/:$LD_LIBRARY_PATH
or
export LD_LIBRARY_PATH=/usr/local/mysql/lib/:$LD_LIBRARY_PATH
are common LD_LIBRARY_PATHSs
[MgmSrvr] ERROR -- Error opening '.../config.ini'
If you get the following error:
[MgmSrvr] ERROR -- Error opening '/.../mysqlcluster-71/scripts/../config/config.ini', error: 2, No such file or directory
Then you have forgot to run:
sh bootstrap.sh
Make sure you have run the download, dist and bootstrap scripts.
Support
Let us know if you have issues with the scripts by mailing support at severalnines dot com