- Installing a Distributed MySQL Cluster as root user
- Open a shell for each of the hosts that will be included in your cluster
- Ping all nodes in cluster to make sure they are all reachable in the …
- Download the script to all the Hosts in the Cluster
- Step 1. Store the script in a writable directory on each node
- Step 2. Start Installation as root on the management server host
- Step 3. Install the management server
- Step 4. Download the binaries and choose an installation directory
- Step 5. Choose username that the MySQL Cluster Process will be run as
- Step 6. Create the UNIX user account (if it does not already exist)
- Step 7. Select directory for NDB Data Directory and Setup Symbolic Links
- Step 8. Enter Management Server Details
- Step 9. Enter Data Node Details
- Step 10. Enter Cluster Configuration Details
- Step 11. Generate ssh keys to allow remote start of Data Nodes
- Step 12. Setup a MySQL Server
- Step 13. Install System Configuration Files
- Step 14. Data Node Installation
- Step 15. Change to Data Node, Select Data Node during installation
- Step 16. Enter the Node ID for the Data Node (You assigned Node-IDs to …
- Step 17. Enter the hostname for the Management Server
- Step 18. Get the ssh keys from the Management Server Host
- Step 19. Add Other Data Nodes
- Step 20. Add Other MySQL Servers
- Step 21. Starting the cluster
Installing a Distributed MySQL Cluster as root user
- Requirements:
- Software Requirements for Management Server host: wget, ssh, ssh-keygen, scp
- Software Requirements for Data Node and MySQL hosts: wget, ssh, scp
- All hosts that will be data nodes and management servers should have the same computer architecture (e.g., all pentium, all AMD64)
- Optional (recommended)
- root access to the hosts to be included in the cluster
Installation Tips
- Video Demo of these detailed installation steps for a MySQL Cluster on 3 hosts (19 minutes).
- I have had problems getting a cluster with both 32-bit and 64-bit data nodes to start.
- This script will prompt you to create a UNIX user account, under which cluster will run. The default username will be 'mysql', and a home directory will be created in the default location. If you would like to create your own user account, do so before running the script, and select that account username when prompted.
- The ndbd and mysqld processes are started on remote nodes using ssh, and you are asked for your password for every process on every host. To avoid entering the password many times, you can use ssh-add to cache it in the local machine. If you get the error msg 'Could not open a connection to your authentication agent.', then your session is not running under the ssh-agent. You can get around this by restarting a new shell under the agent by running: 'exec ssh-agent bash'
- The ndbinstaller script needs to be run on all the machines in the cluster. A distributed cluster can, for testing purposes, be installed on a single host, but you should use the public hostname or public IP address (localhost does not work - although 127.0.0.1 works for testing purposes).
Open a shell for each of the hosts that will be included in your cluster
Write down the name (or IP address) of the machines, and then connect to them by opening terminals from a single machine, e.g., login using ssh.
In this cluster, I have 4 hosts:
- jim-eth0 (192.168.0.13) (management server, MySQL Server) [Ubuntu Feisty, 2GB, dual-core pentium 32-bit inspiron 6400]
- lqist-eth1 (192.168.0.5) (data node 1) [Fedora Core 4, 1GB, pentium 32-bit inspiron 6000]
- server (192.168.0.2) (data node 2) [Debian Etch, 1GB, pentium 4 32-bit dell]
- linda (192.168.0.7) (MySQL Server) [Ubuntu Feisty, 512MB, pentium 3 32-bit old box]
As MySQL Cluster is an in-memory database (with disk-based storage support), you will need to have enough memory available in the data nodes for the (Data Memory + Index Memory) parameters that you configure during installation.
Note that we will install both a management server and a MySQL server on host jim-eth0. Both data nodes have the same amount of RAM, and machines are 32-bit pentium (cluster does not support mixed computer architectures (pentium + ppc) yet. I tested 32-bit pentium + 64-bit pentium data nodes, and it didn't work, although this may be fixed for the official release of 5.1. However, 32-bit MySQL Servers and Management Servers should work with 64-bit Data Nodes (although i haven't tested this).
The hosts are all connected on a private LAN switch (gigabit ethernet is recommended):
| server (ndbd) | lqist-eth1 (ndbd) |
| | | | |
| linda (mysqld) | jim-eth0 (ndb_mgmd, mysqld) |
Ping all nodes in cluster to make sure they are all reachable in the network
Here, I ping each node to each other node. Nodes in a MySQL Cluster are fully-connected, so all nodes must be able to reach one another.
If any nodes are behind a firewall, you need to resolve this by disabling the firewall. Nodes must have fixed IP addresses or host names.
Here I use local hostnames, stored in /etc/hosts. This is the recommended connection method. DNS resolved hostnames should not be used as this introduces a potential point of fialures.
Download the script to all the Hosts in the Cluster
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/trunk/ndbinstaller.sh # or svn co http://www.jimdowling.info/ndbinstaller/trunk/ ndbinstaller
Step 1. Store the script in a writable directory on each node
cd /opt/ svn co http://www.jimdowling.info/ndbinstaller/trunk ndbinstaller cd ndbinstaller ls
Make the script executable and run it:
su root chmod +x ndbinstaller.sh ./ndbinstaller.sh # sudo ./ndbinstaller (for ubuntu)
Step 2. Start Installation as root on the management server host
Here, we start installation on our host "jim-eth0".
Check the text on the installation screen to make sure you are installing the cluster as a root user.
It should display the following line:
"You are running install as root user"
Step 3. Install the management server
Step 4. Download the binaries and choose an installation directory
The default installation directory for the MySQL binaries is:
/usr/local/mysql[-version]
Step 5. Choose username that the MySQL Cluster Process will be run as
Choose the user that the cluster processes will run as (default is 'mysql'):
Step 6. Create the UNIX user account (if it does not already exist)
if the user account has already been created, this is acknowledged:
Step 7. Select directory for NDB Data Directory and Setup Symbolic Links
Step 8. Enter Management Server Details
Step 9. Enter Data Node Details
Important: You need to remember the node-id for the hostnames you enter.
Later, when you install the data nodes on these hosts, you need to enter the node-id assigned at this step.
Step 10. Enter Cluster Configuration Details
Step 11. Generate ssh keys to allow remote start of Data Nodes
Step 12. Setup a MySQL Server
Choose an installation directory for the MySQL Data directory, and both the socket and port number where the MySQL Server will listen.
If you already have a MySQL Server running on this host, make sure to pick a different port number (3306 is the default port number), and socket file.
Step 13. Install System Configuration Files
Step 14. Data Node Installation
Step 15. Change to Data Node, Select Data Node during installation
# Open the window to host 'server' su root ./ndbinstaller
Step 16. Enter the Node ID for the Data Node (You assigned Node-IDs to hosts, when you installed the management server)
Remember which node-id you assigned to this host when you installed the management server. Enter that number here.
Step 17. Enter the hostname for the Management Server
Step 18. Get the ssh keys from the Management Server Host
Step 19. Add Other Data Nodes
Here, I followed the same steps as above, but entered the host name as 'lqist-eth1' and entered the node-id as '1'.
Step 20. Add Other MySQL Servers
I followed installation step (5) and added a MySQL Server on host 'linda'. Note: The final step of adding the MySQL Server start/shutdown to the cluster startup/shutdown scripts is not yet supported for distributed MySQL Servers.
You will need to start/stop this Mysql Server explicitly, by calling:
su mysql cd $NDB_HOME/scripts/ ./start-mysqld-1.sh
Step 21. Starting the cluster
On the management host, jim-eth0, I started the cluster
su mysql cd /var/lib/mysql-cluster/ndb/scripts ./init-start-cluster-2node.sh
We are prompted for the ssh-keygen passwords we entered when we installed the management server. These passwords authorize the script to start the Data Nodes on hosts 'server' and 'lqist-eth1'.
Here is the output of my installed cluster, using ./mgm-client.sh script, and the 'show' command for the management client:
./mgm-client.sh -e show
Attachments
- pingable.png (226.5 kB) - added by jdowling 16 months ago.
- root-installation.png (29.5 kB) - added by jdowling 16 months ago.
- username.png (19.2 kB) - added by jdowling 16 months ago.
- mgm-server.png (37.1 kB) - added by jdowling 16 months ago.
- ndb-engine.png (63.2 kB) - added by jdowling 16 months ago.
- user-exists.png (17.1 kB) - added by jdowling 16 months ago.
- ndb-engine.2.png (63.2 kB) - added by jdowling 16 months ago.
- mgm-details.png (25.7 kB) - added by jdowling 16 months ago.
- ndbd-details.png (31.5 kB) - added by jdowling 16 months ago.
- config-details.png (51.5 kB) - added by jdowling 16 months ago.
- ssh-keygen.png (82.0 kB) - added by jdowling 16 months ago.
- system-conf.png (39.3 kB) - added by jdowling 16 months ago.
- ndbd-step.png (25.7 kB) - added by jdowling 16 months ago.
- select-ndbd.png (37.0 kB) - added by jdowling 16 months ago.
- nodeid.png (17.0 kB) - added by jdowling 16 months ago.
- enter-mgm.png (25.6 kB) - added by jdowling 16 months ago.
- get-sshkeys.png (46.4 kB) - added by jdowling 16 months ago.
- useradd.png (45.6 kB) - added by jdowling 16 months ago.
- distributed-finished.png (62.9 kB) - added by jdowling 16 months ago.
- init-cluster-distributed.png (99.0 kB) - added by jdowling 16 months ago.



















