就算我在两台机都添加一个网卡,把两个ETH1连接起来
pc01: ndb+mysql eth0:192.168.3.1/24
         mgm eth1:192.168.4.1
pc02: ndb+mysql eth0:192.168.3.2/24
       eth1:192.168.4.2
#############my.cnf############
# Options for mysqld process:
[MYSQLD]                        
ndbcluster                      # run NDB engine
ndb-connectstring=192.168.4.1  # location of MGM node# Options for ndbd process:
[MYSQL_CLUSTER]                 
ndb-connectstring=192.168.4.1  # location of MGM node############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=192.168.4.1           # 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=192.168.3.1           # 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.3.2           # Hostname or IP address
datadir=/usr/local/mysql/data   # Directory for this data node's datafiles# SQL node options:
[MYSQLD]                        
hostname=192.168.3.1           # Hostname or IP address
                                # (additional mysqld connections can be
                                # specified for this node for various
                                # purposes such as running ndb_restore)
[MYSQLD]
Hostname=192.168.3.2这种情况更惨,所有ndb和mysql节点都连接不上
网线是通的,不要怀疑这种弱智问题

解决方案 »

  1.   

    又或着三台机的方案
    Pc01:mgm eth0 192.168.3.1/24
    Pc02:ndb+mysql eth0 192.168.3.2
    Pc03:ndb + mysql eth0 192.168.3.
    #############my.cnf############
    # Options for mysqld process:
    [MYSQLD]                        
    ndbcluster                      # run NDB engine
    ndb-connectstring=192.168.3.1  # location of MGM node# Options for ndbd process:
    [MYSQL_CLUSTER]                 
    ndb-connectstring=192.168.3.1  # location of MGM node
    ############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=192.168.3.1           # 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=192.168.3.1           # 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.3.2           # Hostname or IP address
    datadir=/usr/local/mysql/data   # Directory for this data node's datafiles# SQL node options:
    [MYSQLD]                        
    hostname=192.168.3.1           # Hostname or IP address
                                    # (additional mysqld connections can be
                                    # specified for this node for various
                                    # purposes such as running ndb_restore)
    [MYSQLD]
    Hostname=192.168.3.2这个时候首次启动群集一切正常,但如果我在pc01运行以下命令(群集其它节点依然保持运行)
    Chkconfg –-level 12345 mysql.server off
    在/etc/rc.d/rc.lo添加以下两行
    nohup /usr/local/mysql/bin/ndbd &
    nohup /etc/init.d/mysql.server start &
    然后shutdown –r now
    重启后pc01的ndb连接正常,但mysql会disconnect
    在/var/lib/mysql-cluster/ndb_1_cluster.log显示以下信息
    Could no alloc node id……………
    我试过在my.cnf把connectstring写成
    Ndb1->        ndb-connectstring=nodeid=2,192.168.3.1
    Ndb2->        ndb-connectstring=nodeid=3,192.168.3.1
    Mysql1->      ndb-connectstring=nodeid=4,192.168.3.1
    Mysql2->      ndb-connectstring=nodeid=5,192.168.3.1Still not work!!!!
    Oh My God!!!!
    Help Me!!!!!!!!
    Qq:23281396
    手机:13424687135