- Installing a Localhost MySQL Cluster
- Requirements
- Download the script
- Step 1. Store the script in a user writable directory
- Step 2. Non-root Installation
- Step 3. Choose your Computer Architecture
- Step 4. Choose the Localhost Installation Option
- Step 4. Download MySQL Binaries
- Step 5. Store the MySQL Binaries in a User-Level Directory ( …
- Step 6. Store NDB Data in a User-Level Directory ( ~/.mysql/ndb[-version] …
- Step 7. Setup Symbolic Links to MySQL Binaries and NDB Data Directory
- Step 8. Configure Cluster Variables
- Step 9. Install MySQL Server Option
- Step 10. Configure MySQL Server Socket and Port
- Step 11. The MySQL Default Databases are Installed
- Step 12. Start the Cluster Running
- Step 13. Instructions for Using the Cluster
- Directory Layout of your Installation
Download the script ¶
Option 1 (Browser-based): Right-Click here and click "Save Link as" and save the ndbinstaller.sh file in a local directory (for example, /tmp/).
Option 2 (Command-line):
wget http://www.jimdowling.info/ndbinstaller/ndbinstaller.sh
# or
svn co http://www.jimdowling.info/ndbinstaller/
Step 1. Store the script in a user writable directory ¶
cd $HOME
mkdir ndbinstaller
cp ~/Desktop/ndbinstaller.sh ndbinstaller
Make the script executable ¶
chmod +x ndbinstaller.sh
./ndbinstaller.sh
Step 2. Non-root Installation ¶
Check the text on the installation screen to make sure you are installing the cluster as a normal user.
It should display the following line:
"You are running install as non-root user"
Step 3. Choose your Computer Architecture ¶
If you have a pentium processor, choose option 1. If you a Pentium D or AMD processor, choose option 2.
Step 4. Choose the Localhost Installation Option ¶
Choose the localhost installation option. You can find out more information about the options by pressing the 'h' key.
Step 4. Download MySQL Binaries ¶
Do you have to go through a proxy to access the Internet?
If you do not, select 'n'. If you do, select 'y', and then enter the address of the proxy server, your username and password.
If the binaries were successfully downloaded, they should be unzipped, with a subsequent Information Step:
Step 5. Store the MySQL Binaries in a User-Level Directory ( ~/.mysql/mysql[-version] by default) ¶
Step 6. Store NDB Data in a User-Level Directory ( ~/.mysql/ndb[-version] by default) ¶
Step 7. Setup Symbolic Links to MySQL Binaries and NDB Data Directory ¶
This step is useful when managing multiple versions of cluster, or when programing cluster. After installation, you can set NDB_HOME environment variable to point to the symbolic link
export NDB_HOME=/home/yourusername/.mysql/ndb/
Step 8. Configure Cluster Variables ¶
This is an important step for configuring your cluster.
You can configure parameters such as:
- How many copies of the data (Number of Replicas) should be stored in the cluster? The more replicas, the lower the chance that your cluster will fail because a node in the cluster has failed. If you have only 1 Replica of the data, and a Data Node fails, then the cluster will fail. There needs to be at least one copy of the data available in the cluster, otherwise the cluster will shutdown.
- Here we choose the default "2 Replicas". So if a single Data Node fails, our cluster will still have a copy of the data available, and the cluster will continue to function correctly. The failed data node, can later be restarted to rejoin the cluster.
- Here you can setup the amount (in RAM) of Data Memory you want your data nodes to store. The default value of 80MB is quite low. Here, we'll increase it to 512MB RAM per data node. Your localhost should have at least 2GB of available RAM for this: we will install 2 Data Nodes on this machine, and we need space for Index Memory and some overhead for the operating system.
- The installer recalculates the recommended amount of Index Memory required based on the size of Data Memory we entered (1/5th the size of Data Memory). Here we accept the suggested size of Index Memory.
- If you're not sure what the NumFragmentLogFiles parameter means, use the help function. Help tells you that this variable represents how big my Redo Log on disk could become. Do I have 3072MB of disk space available? If yes, I'll accept it. You may choose a lower or higher number depending on your requirements.
- I will also accept the default suggestions for the other parameters, details for which can be found in the MySQL Cluster Manual
A Summary of your Configuration of the Cluster is then displayed:
You can edit your configuration after installation by updating the $NDB_HOME/config-X.ini file(s):
Step 9. Install MySQL Server Option ¶
This step involves setting up the data directories for a MySQL Server:
Step 10. Configure MySQL Server Socket and Port ¶
Configure the MySQL Server (settings written to a my-[version].cnf file in $NDB_HOME): Default values are normally ok, unless you are already running a MySQL Server on this machine - in which case you should change the location of the socket and the port number.
Step 11. The MySQL Default Databases are Installed ¶
The mysql_install_db script is run to install the default databases in the MySQL Server.
Step 12. Start the Cluster Running ¶
This step allows you to choose the size of cluster you want to start (only 2-node and 4-node clusters are supported for localhost installations).
Step 13. Instructions for Using the Cluster ¶
This step tells the user some simple commands for initialising the cluster, starting the cluster (after it has been initialised), shutting down the cluster, and observing the cluster,
Directory Layout of your Installation ¶
Your directory layout should look like the following: