MySQL Cluster 7.3 安装(二)------初始化配置 MySQL Cluster 7.3

来源:互联网 发布:tomcat 配置端口 编辑:程序博客网 时间:2024/06/05 16:12
以下配置不同操作系统通用

0.网络环境和规划
NodeIP AddressManagement node (mgmd)192.168.0.10SQL node (mysqld)192.168.0.20Data node "A" (ndbd)192.168.0.30Data node "B" (ndbd)192.168.0.40
如果不希望在下面的配置中使用IP地址,也可以使用主机名
CentOS
#  ndb1 /etc/hosts:127.0.0.1   ndb1.cluster ndb1 localhost.localdomain localhost
#  ndb2 /etc/hosts:127.0.0.1   ndb2.cluster ndb2 localhost.localdomain localhost
Windows
C:\WINDOWS\system32\drivers\etc\hosts


每个数据节点(Data Node)和SQL节点(SQL Node)都必须一个my.cnf文件,它提供了两个信息,一是连接字符串,使每个节点都能找到管理节点,另一个是告诉MySQL服务在这个节点(数据节点)提供存储引擎
管理节点(Management Node)需要config.ini文件,获取节点信息,用于位数据和索引在每个数据节点分配内存,寻找数据节点,保存树蕨到每个节点,以及寻找sql节点
2.配置 data nodes 和 SQL nodes 
my.cnf应该在/etc文件夹下,如果 不存在则创建一个
编辑如下
########################################################
[mysqld]# Options for mysqld process:ndbcluster                      # run NDB storage engine[mysql_cluster]# Options for MySQL Cluster processes:
ndb-connectstring=nodeid=21,192.168.0.10  # location of management server
注意这里的id和节点所在的ip应该和managment配置文件中的匹配,如果有多个管理节点,使用逗号隔开
########################################################
为每个节点做类似的配置
2.配置 management 
首先创建可以找到的目录,然后创建文件
例如
shell> mkdir /var/lib/mysql-cluster
shell> cd /var/lib/mysql-cluster
shell> vi config.ini
编辑config.ini如下
#########################################################
[ndbd default]# Options affecting ndbd processes on all data nodes:NoOfReplicas=2    # Number of replicasDataMemory=80M    # How much memory to allocate for data storageIndexMemory=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 default]# TCP/IP options:portnumber=2202   # This the default; however, you can use any                  # port that is free for all the hosts in the cluster                  # Note: It is recommended that you do not specify the port                  # number at all and simply allow the default value to be used                  # instead[ndb_mgmd]# Management process options:
id=1hostname=192.168.0.10           # Hostname or IP address of MGM nodedatadir=/var/lib/mysql-cluster  # Directory for MGM node log files[ndbd]# Options for data node "A":
id=11                           # (one [ndbd] section per data node)hostname=192.168.0.30           # Hostname or IP addressdatadir=/usr/local/mysql/data   # Directory for this data node's data files[ndbd]# Options for data node "B":id=12
hostname=192.168.0.40           # Hostname or IP address
datadir=/usr/local/mysql/data   # Directory for this data node's data files[mysqld]# SQL node options:
id=21hostname=192.168.0.20           # Hostname or IP address                                # (additional mysqld connections can be                                # specified for this node for various                                # purposes such as running ndb_restore)

###############################################################
注意 必须在存储节点手动建立datadir路径,本文为例,分别在存储节点192.168.0.40,192.168.0.30建立/usr/local/mysql/data路径,data是文件夹
默认情况下,每个节点都需要防火墙允许330611862202端口




未经允许,请勿转载 交流群 129268869


0 0
原创粉丝点击