SQL节点未连接到mysql集群中



我正在尝试部署一个mysql集群(4台机器),其中包括1个节点管理器、1个sql节点和2个数据节点。我正在遵循这些教程,这些教程是免费的(第一部分,第二部分,第三部分,第四部分)从mysql官方网站。然而,我对SQL节点有一个问题,它总是没有连接,正如您在节点管理器中看到的那样:

   $ sudo ndb_mgm -e show
   Connected to Management Server at: localhost:1186
   Cluster Configuration
   ---------------------
   [ndbd(NDB)]  2 node(s) 
   id=2 @10.31.35.40  (mysql-5.6.23 ndb-7.4.5, starting, Nodegroup: 0)
   id=3 @10.31.35.42  (mysql-5.6.23 ndb-7.4.5, starting, Nodegroup: 0)
   [ndb_mgmd(MGM)]  1 node(s)
   id=1 @10.31.37.108  (mysql-5.6.23 ndb-7.4.5)
   [mysqld(API)]    1 node(s)
   id=4 (not connected, accepting connect from 10.31.35.41)

我不知道为什么SQL节点没有连接到管理节点!!我在谷歌上寻找类似的问题,但我仍然无法解决我的问题!

我试了好几次:

   /etc/init.d/mysql.server stop

   /etc/init.d/mysql.server start

但徒劳无功。

以下也是mysqld在详细模式下的输出,其中提到了一个问题,我不知道它的原因是什么:

   ubuntu@10-31-35-41:/usr/local/mysql/bin$ sudo mysqld --verbose --help
   150404  5:26:00 [Note] Plugin 'FEDERATED' is disabled.
   150404  5:26:00 [ERROR] mysqld: unknown option '--ndbcluster'
   ......

此外,当我试图查看mysqld_safe的位置时(我认为这是不正常的,因为正如你在教程的第一部分中看到的,文件夹被放在/usr/local/mysql中(我应该使用mysql.server,不是吗?),我有

   $ which mysqld_safe 
   /usr/bin/mysqld_safe

此外,我不知道是否与之前安装的mysql 包有冲突

这是/etc/mysql/my.cnf(在sql节点中,与工作数据节点相同):

   [mysqld]
   # Options for mysqld process:
   ndbcluster                      # run NDB storage engine
   [mysql_cluster]
   # Options for MySQL Cluster processes:
   ndb-connectstring=10.31.37.108  # location of management server

这是ndb_mgm:中的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=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:
   hostname=10.31.37.108           # Hostname or IP address of MGM node
   datadir=/var/lib/mysql-cluster  # Directory for MGM node log files
   [ndbd]
   # Options for data node "A":
                            # (one [ndbd] section per data node)
   hostname=10.31.35.40           # Hostname or IP address
   datadir=/usr/local/mysql/data   # Directory for this data node's data files
   [ndbd]
   # Options for data node "B":
   hostname=10.31.35.42           # Hostname or IP address
   datadir=/usr/local/mysql/data   # Directory for this data node's data files
   [mysqld]
   # SQL node options:
   hostname=10.31.35.41           # Hostname or IP address
                            # (additional mysqld connections can be
                            # specified for this node for various
                            # purposes such as running ndb_restore)

提前非常感谢您的帮助!!

为了解决这个问题,我更改了/usr/local/mysql/data目录的权限,如下所示:

  sudo chown -R ubuntu data/

所以现在不是:

  $ /usr/local/mysql/support-files/mysql.server restart
  * MySQL server PID file could not be found!
  Starting MySQL
  . * The server quit without updating PID file (/usr/local/mysql/data/ip-172-31-46-103.pid).

我现在明白了:

  $ /usr/local/mysql/support-files/mysql.server restart
  Shutting down MySQL
  .. * 
  Starting MySQL
  . * 

最新更新