热门关键字:  ubuntu  分区  函数  Fedora  linux系统进程

mysql负载均衡集群架设

来源: 作者: 时间:2007-12-18 Tag: 点击:

4         配置Management管理节点

在192.168.0.1机器上

#mkdir /var/lib/mysql-cluster

#cd /var/lib/mysql-cluster

#vi config.ini

[NDBD DEFAULT]      # Options affecting ndbd processes on all data nodes:

NoOfReplicas=2      # Number of replicas

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

IndexMemory=52M     # 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 DEFAULT]       # TCP/IP options:

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=192.168.0.1        # 管理节点Hostname or IP address of MGM node

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

# Options for data node "A"(定义群集数据节点.)

# (one [NDBD] section per data node)

[NDBD]

hostname=192.168.0.160      # 节点Hostname or IP address

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

# Options for data node "B"(定义群集数据节点.)

[NDBD]

hostname=192.168.0.161      # 节点Hostname or IP address

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

# SQL node options(定义Sql server节点.)

[MYSQLD]

hostname=192.168.0.100      # SQL节点Hostname or IP address

#datadir=/usr/local/mysql/data  # Directory for SQL node's datafiles

                    # (additional mysqld connections can be

                    # specified for this node for various

                    # purposes such as running ndb_restore)

[NDB_MGMD]:后面不能有任何注释信息,否则提示:

Error line 17: [TCP] Unknown parameter: [NDB_MGMD]   # Management process options

Error line 17: Could not parse name-value pair in config file.

[SHM]: Defines shared-memory connections between nodes. 在MySQL 4.1.9之前,这个功能必须使用--with-ndb-shm option编译进去, 从MySQL 4.1.9-max版本开始, it is enabled by default
5         启动mysql集群
5.1      初始化启动mysql集群服务

1)启动MysqlManagement管理节点(192.168.0.1)

#ndb_mgmd -f /var/lib/mysql-cluster/config.ini

2)启动Data  Node节点(192.168.0.160,192.168.0.161)

#ndbd --initial

(注意:这个参数只能在第一次启动DataNode节点时使用,因为―initial参数会删除一些ndbd 实例先前创建的所有文件)

最新评论共有 4 位网友发表了评论
发表评论
评论内容:不能超过250字,需审核,请自觉遵守互联网相关政策法规。
用户名: 密码:
匿名?
注册