WEB开发网
开发学院数据库MySQL How To Set Up A Load-Balanced MySQL Cluster - ... 阅读

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

 2007-11-11 15:44:35 来源:WEB开发网   
核心提示:3 Set Up The MySQL(和PHP搭配之最佳组合) Cluster Nodes (Storage Nodes)Now we install MySQL(和PHP搭配之最佳组合)-max-5.0.19 on both sql1.example.com and sql2.example.com:sql1.exa

3 Set Up The MySQL(和PHP搭配之最佳组合) Cluster Nodes (Storage Nodes)

Now we install MySQL(和PHP搭配之最佳组合)-max-5.0.19 on both sql1.example.com and sql2.example.com:

sql1.example.com / sql2.example.com:

groupadd MySQL(和PHP搭配之最佳组合)
useradd -g MySQL(和PHP搭配之最佳组合) MySQL(和PHP搭配之最佳组合)
cd /usr/local/
wget http://dev.MySQL(和PHP搭配之最佳组合).com/get/Downloads/MySQL(和PHP搭配之最佳组合)-5.0/MySQL(和PHP搭配之最佳组合)-max-5.0.19-linux-i686-\
glibc23.tar.gz/from/http://www.mirrorservice.org/sites/ftp.MySQL(和PHP搭配之最佳组合).com/
tar xvfz MySQL(和PHP搭配之最佳组合)-max-5.0.19-linux-i686-glibc23.tar.gz
ln -s MySQL(和PHP搭配之最佳组合)-max-5.0.19-linux-i686-glibc23 MySQL(和PHP搭配之最佳组合)
cd MySQL(和PHP搭配之最佳组合)
scripts/MySQL(和PHP搭配之最佳组合)_install_db --user=MySQL(和PHP搭配之最佳组合)
chown -R root:MySQL(和PHP搭配之最佳组合) .
chown -R MySQL(和PHP搭配之最佳组合) data
cp support-files/MySQL(和PHP搭配之最佳组合).server /etc/init.d/
chmod 755 /etc/init.d/MySQL(和PHP搭配之最佳组合).server
update-rc.d MySQL(和PHP搭配之最佳组合).server defaults
cd /usr/local/MySQL(和PHP搭配之最佳组合)/bin
mv * /usr/bin
cd ../
rm -fr /usr/local/MySQL(和PHP搭配之最佳组合)/bin
ln -s /usr/bin /usr/local/MySQL(和PHP搭配之最佳组合)/bin

Then we create the MySQL(和PHP搭配之最佳组合) configuration file /etc/my.cnf on both nodes:

sql1.example.com / sql2.example.com:

vi /etc/my.cnf

[MySQL(和PHP搭配之最佳组合)d]
ndbcluster
# IP address of the cluster management node
ndb-connectstring=192.168.0.103

[MySQL(和PHP搭配之最佳组合)_cluster]
# IP address of the cluster management node
ndb-connectstring=192.168.0.103

Make sure you fill in the correct IP address of the MySQL(和PHP搭配之最佳组合) cluster management server.

Next we create the data directories and start the MySQL(和PHP搭配之最佳组合) server on both cluster nodes:

sql1.example.com / sql2.example.com:

mkdir /var/lib/MySQL(和PHP搭配之最佳组合)-cluster
cd /var/lib/MySQL(和PHP搭配之最佳组合)-cluster
ndbd --initial
/etc/init.d/MySQL(和PHP搭配之最佳组合).server start

(Please note: we have to run ndbd --initial only when the start MySQL(和PHP搭配之最佳组合) for the first time, and if /var/lib/MySQL(和PHP搭配之最佳组合)-cluster/config.ini on loadb1.example.com changes.)

Now is a good time to set a password for the MySQL(和PHP搭配之最佳组合) root user:

sql1.example.com / sql2.example.com:

MySQL(和PHP搭配之最佳组合)admin -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:

sql1.example.com / sql2.example.com:

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

Tags:How To Set

编辑录入:coldstar [复制链接] [打 印]
赞助商链接