技术开发 频道

MySQL Cluster 实作

  安装设定Management&SQLnode

  到官方下载需要的套件文件,请参考上方表格的内容。

  MySQL-5.0.67MySQL-6.3.20

  rpm -ivh MySQL-client-community-5.0.67-0.rhel5.i386.rpmrpm -ivh MySQL-shared-compat-5.0.67-0.rhel5.i386.rpm

  rpm -ivh MySQL-devel-community-5.0.67-0.rhel5.i386.rpm

  rpm -ivh MySQL-server-community-5.0.67-0.rhel5.i386.rpm

  以上套件是SQLnode会用到的

  rpm -ivh perl-HTML-Template-2.9-1.el5.rf.noarch.rpm

  rpm -ivh MySQL-clustermanagement-community-5.0.67-0.rhel5.i386.rpm

  rpm -ivh MySQL-clustertools-community-5.0.67-0.rhel5.i386.rpm

  以上套件是Managementnode会用到,其中perl-HTML-Template不在官方网站的下载连结,请自行用Google搜寻。

  新增配置文件:

  /etc/my.cnf(SQLnode 会用到)

  # Options for mysqld process:

  [MYSQLD]

  ndbcluster # run NDB engine

  ndb-connectstring=10.10.10.131 # location of MGM node

  # Options for ndbd process:

  [MYSQL_CLUSTER]

  ndb-connectstring=10.10.10.131 # location of MGM node

  /var/lib/mysql-cluster/config.ini(Managementnode会用到)

  # Options affecting ndbd processes on all data nodes:

  [NDBD DEFAULT]

  NoOfReplicas=2 # Number of replicas

  DataMemory=256M # How much memory to allocate for data storage

  IndexMemory=18M # How much memory to allocate for index storage

  # For DataMemory and IndexMemory, we have used the

  # default values. Since the "world" database takes up

  # only about 500KB, this should be more than enough for

  # this example Cluster setup.

  # TCP/IP options:

  [TCP DEFAULT]

  portnumber=2202 # This the default; however, you can use any

  # port that is free for all the hosts in cluster

  # Note: It is recommended beginning with MySQL 5.0 that

  # you do not specify the portnumber at all and simply allow

  # the default value to be used instead

  # Management process options:

  [NDB_MGMD]

  hostname=10.10.10.131 # Hostname or IP address of MGM node

  datadir=/var/lib/mysql-cluster # Directory for MGM node logfiles

  # Options for data node "A":

  [NDBD]

  # (one [NDBD] section per data node)

  hostname=10.10.10.132 # Hostname or IP address

  datadir=/mysql-data # Directory for this data node's datafiles

  # Options for data node "B":

  [NDBD]

  hostname=10.10.10.133 # Hostname or IP address

  datadir=/mysql-data # Directory for this data node's datafiles

  # SQL node options:

  [MYSQLD]

  hostname=10.10.10.131 # Hostname or IP address

  # (additional mysqld connections can be

  # specified for this node for various

  # purposes such as running ndb_restore)

0
相关文章