How To Set Up A Load-Balanced MySQL Cluster - Page 2

3 Set Up The MySQL Cluster Nodes (Storage Nodes)

Now we install mysql-max-5.0.19 on both and /

groupadd mysql
useradd -g mysql mysql
cd /usr/local/
tar xvfz mysql-max-5.0.19-linux-i686-glibc23.tar.gz
ln -s mysql-max-5.0.19-linux-i686-glibc23 mysql
cd mysql
scripts/mysql_install_db --user=mysql
chown -R root:mysql .
chown -R mysql data
cp support-files/mysql.server /etc/init.d/
chmod 755 /etc/init.d/mysql.server
update-rc.d mysql.server defaults
cd /usr/local/mysql/bin
mv * /usr/bin
cd ../
rm -fr /usr/local/mysql/bin
ln -s /usr/bin /usr/local/mysql/bin

Then we create the MySQL configuration file /etc/my.cnf on both nodes: /

vi /etc/my.cnf

# IP address of the cluster management node

# IP address of the cluster management node

Make sure you fill in the correct IP address of the MySQL cluster management server.

Next we create the data directories and start the MySQL server on both cluster nodes: /

mkdir /var/lib/mysql-cluster
cd /var/lib/mysql-cluster
ndbd --initial
/etc/init.d/mysql.server start

(Please note: we have to run ndbd --initial only when the start MySQL for the first time, and if /var/lib/mysql-cluster/config.ini on changes.)

Now is a good time to set a password for the MySQL root user: /

mysqladmin -u root password yourrootsqlpassword

We want to start the cluster nodes at boot time, so we create an ndbd init script and the appropriate system startup links: /

echo 'ndbd' > /etc/init.d/ndbd
chmod 755 /etc/init.d/ndbd
update-rc.d ndbd defaults

Share this page:

Suggested articles

0 Comment(s)

Add comment


From: falko