Ubuntu Server部署MySQL集群(二)

2014-11-24 18:25:35 · 作者: · 浏览: 4
eleyDB
#
# Using BerkeleyDB is now discouraged as its support will cease in 5.1.12.
skip-bdb
#
# * MyISAM
#
# MyISAM is enabled by default with a 10MB datafile in /var/lib/mysql/.
# Read the manual for more MyISAM related options. There are many!
# You might want to disable MyISAM to shrink the mysqld process by circa 100MB.
#skip-innodb
#
# * Security Features
#
# Read the manual, too, if you want chroot!
# chroot = /var/lib/mysql/
#
# For generating SSL certificates I recommend the OpenSSL GUI “tinyca”.
#
# ssl-ca=/etc/mysql/cacert.pem
# ssl-cert=/etc/mysql/server-cert.pem
# ssl-key=/etc/mysql/server-key.pem
#如下是管理节点的ip地址


ndbcluster
ndb-connectstring=192.168.68.8

[mysqldump]
quick
quote-names
max_allowed_packet = 16M
[mysql]
#no-auto-rehash # faster start of mysql but no tab completition
[isamchk]
key_buffer = 16M
#
# * NDB Cluster
#
# See /usr/share/doc/mysql-server-*/README.Debian for more information.
#
# The following configuration is read by the NDB Data Nodes (ndbd processes)
# not from the NDB Management Nodes (ndb_mgmd processes).
#
[MYSQL_CLUSTER]
ndb-connectstring=192.168.68.8

#
# * IMPORTANT: Additional settings that can override those from this file!
# The files must end with ‘.cnf’, otherwise they’ll be ignored.
#
!includedir /etc/mysql/conf.d/
ubuntu@ubuntu:~$



2. 管理节点服务器中配置(192.168.68.8)中配置ndb_mgmd.cnf。
复制:


/usr/share/doc/mysql-server-5.0/examples/ndb_mgmd.cnf 至/etc/mysql/ndb_mgmd.cnf


3. 管理节点服务器中配置(192.168.68.8)中编辑ndb_mgmd.cnf。
ubuntu@ubuntu:~$ sudo vim /etc/mysql/ndb_mgmd.cnf
[NDBD DEFAULT]
NoOfReplicas=2
DataMemory=10MB
IndexMemory=25MB
MaxNoOfTables=256
MaxNoOfOrderedIndexes=256
MaxNoOfUniqueHashIndexes=128
[MYSQLD DEFAULT]
[NDB_MGMD DEFAULT]
[TCP DEFAULT]
[NDB_MGMD]
Id=1 # the NDB Management Node (this one)
HostName=192.168.68.8
DataDir= /var/lib/mysql-cluster

[NDBD]
Id=2 # the first NDB Data Node
HostName=192.168.68.5
DataDir= /var/lib/mysql-cluster
[NDBD]
Id=3 # the second NDB Data Node
HostName=192.168.68.6
DataDir=/var/lib/mysql-cluster
[MYSQLD]
Id=4 # the first SQL node
HostName=192.168.68.5
[MYSQLD]
Id=5 # the first SQL node
HostName=192.168.68.6


4. 服务器管理节点服务器(192.168.68.8)中的mysql-ndb-mgm服务。
sudo /etc/init.d/mysql-ndb-mgm start


5. 启动数据存储服务器(192.168.68.5\6)中服务mysql-ndb。
sudo /etc/init.d/mysql-ndb start


6. 最后启动,3台服务器中(192.168.68.5\6\8)启动mysql服务。
sudo /etc/init.d/mysql start