1

我正在尝试部署一个带有 1 个节点管理器、1 个 sql 节点和 2 个数据节点的 mysql 集群(4 台机器)。我正在关注官方 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)

非常感谢您的帮助!

4

1 回答 1

1

为了解决这个问题,我更改了 /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
  . * 
于 2015-04-04T21:44:41.307 回答