mysql群集.ppt
文本预览下载声明
对于我们的4节点、4主机MySQL簇,需要编写4个配置文件,每个节点/主机1个。 · 每个数据节点或SQl节点需要1个f文件,该文件提供了两类信息:connectstring(连接字符串),用于通知节点到哪里找到MGM节点;以及一行,用于通知该主机(容纳数据节点的机器)上的MySQL服务器运行在NDB模式下。 关于连接字符串的更多信息,请参见MySQL 手册节,“MySQL簇连接字符串”。 · 管理节点需要config.ini文件,该文件通知节点有多少需要维护的副本,需要在每个数据节点上为数据和索引分配多少内存,数据节点的位置,在每个数据节点上保存数据的磁盘位置,以及SQL节点的位置。 数据节点所需的f文件相当简单。配置文件应位于/etc目录下,并能用任何文本编辑器进行编辑 (如有必要,创建该文件),例如: vi /etc/f 对于本示例中的每个数据节点和SQL节点,f文件类似于: # Options for mysqld process: [MYSQLD] ndbcluster # run NDB engine ndb-connectstring=0 # location of MGM node # Options for ndbd process: [MYSQL_CLUSTER] ndb-connectstring=0 # location of MGM node 输入上述内容后,保存文件并退出文本编辑器。在容纳数据节点“A”、数据节点“B”和SQL节点的机器上分别执行上述操作。 配置MGM节点的第一步是创建目录,该目录用于存放配置文件,然后创建配置文件本身。例如(以根用户身份运行): mkdir /var/lib/mysql-cluster cd /var/lib/mysql-cluster vi config.ini 在此使用了vi来创建文件,不过,任何文本编辑器均应能胜任。 对于我们的典型设置,config.ini文件应类似于: # Options affecting ndbd processes on all data nodes: [NDBD DEFAULT] NoOfReplicas=2 # Number of replicas DataMemory=80M # 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=0 # 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=0 # Hostname or IP address datadir=/usr/local/mysql/data # Directory for this data nodes datafiles # Options for data node B: [NDBD] hostname=0 # Hostname or IP address datadir=/usr/local/mysql/data # Directory fo
显示全部