mysql - SQL 节点未连接到 mysql 集群中

标签 mysql sql database mysql-cluster

我正在尝试部署一个带有 1 个节点管理器、1 个 sql 节点和 2 个数据节点的 mysql 集群(4 台机器)。我正在关注这些来自 mysql 官方网站的免费教程(first partsecond partthird partfourth part)。但是,我的 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
  . * 

关于mysql - SQL 节点未连接到 mysql 集群中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29443427/

相关文章:

mysql - 从 MySQL 数据库最畅销产品中选择一个好、更好、最好的建议

php - echo 链接 mysql 变量取决于

mysql - 插入 SQL 数据库?

mysql查询连接,比较两个表并返回第一个表中的所有记录

mysql - 如何优化我的 mysql 查询

sql-server - 有没有人使用(或考虑使用)Sql Server Compact Edition?

java - 生成数据库错误以进行异常处理的方法

java - 将.xls文件导入数据库Jboss

php - Codeigniter 更新未按预期执行

.net - 如何计算满足和不满足条件的记录数量