tar版mysql集群安装

这篇博客详细介绍了如何在Linux环境下安装MySQL集群,包括下载MySQL源码包、解压、配置管理节点、数据节点和服务节点,以及启动和检查各个节点的状态。通过配置文件调整端口和数据存储位置,确保节点间的正确连接。最后,通过创建NDBCluster引擎的表验证安装成功。
摘要由CSDN通过智能技术生成

1. 下载:http://dev.mysql.com/downloads/mysql/5.0.html#linux 可以从这里下载 mysql-5.0.45-linux-i686.tar.gz

此包里已经包含了mysql-max包(mysql集群需要安装mysql-max包)。

2. 解压:

Java代码 复制代码
  1. tar -zxvf apache-tomcat-5.5.25.tar.gz  
tar -zxvf apache-tomcat-5.5.25.tar.gz

  

下载的这个.tar.gz是编译后的文件,只需要解压即可。

3. 配置
比如解压后的文件都放在:/home/mahaibo/mysql-5.0.45-linux-i686目录下。

数据节点(ndbd),管理节点(mgmd),服务节点(mysqld) 三个启动顺序是

mgmd ---> ndbd ---> mysqld

可以在同一台电脑上做个简单的配置和测试。以在同一台电脑上不同端口为例。实际中肯定是需要分布在不同的服务器上的。

A: 配置mgmd,并启动

在/home/mahaibo/mysql-5.0.45-linux-i686建立一个mgmd.cnf和mgmd的数据目录mgmddata  ,编辑mgmd.cnf文件:

Java代码 复制代码

      

# Options affecting ndbd processes on all data nodes:   

[NDBD DEFAULT]       

NoOfReplicas=1    # 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=127.0.0.1           # Hostname or IP address of MGM node ,mgmd's hostname   

datadir=/home/mahaibo/mysql-5.0.45-linux-i686/mgmddata  # Directory for MGM node logfiles   

PortNumber=2203            #default value: 1186  

  

# Options for data node "A":   

[NDBD]                             

                                # (one [NDBD] section per data node)   

hostname=127.0.0.1           # Hostname or IP address ,allow to access   

datadir=/home/mahaibo/mysql-5.0.45-linux-i686/mgmddata   # Directory for this data node's datafiles   

  

# Options for data node "B":   

[NDBD]                             

hostname=127.0.0.1           # Hostname or IP address   

datadir=/home/mahaibo/mysql-5.0.45-linux-i686/mgmddata   # Directory for this data node's datafiles   

  

[MYSQLD]                           

hostname=127.0.0.1           # Hostname or IP address   

                                # (additional mysqld connections can be   

                                # specified for this node for various   

                                # purposes such as running ndb_restore)  

 

# Options affecting ndbd processes on all data nodes:
[NDBD DEFAULT]    
NoOfReplicas=1    # 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 port
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值