AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / dba / 问题 / 133609
Accepted
Shane
Shane
Asked: 2016-03-29 20:51:28 +0800 CST2016-03-29 20:51:28 +0800 CST 2016-03-29 20:51:28 +0800 CST

MySQL 集群:API 节点无法成功启动

  • 772

我正在测试环境中设置 MySQL NDB 集群。我有 1 个管理节点、2 个 SQL 节点和 4 个 NDB 节点。管理节点和 NDB 节点都启动成功。根据MySQL 文档,它们是手动调用的。如果我mysqld_safe手动调用,MySQL 会加载、连接到管理节点并正常运行。但是,如果我调用service mysql start它,它会加载 MySQL 并连接到管理节点,但是它认为没有 NDB 节点并且只是等待。

现在这真的让我感到困惑。如果我运行/etc/init.d/mysql start,我会遇到与运行服务相同的问题。但是,如果我运行cp /etc/init.d/mysql ~; ./mysql start该服务的启动时间只是运行该服务所需时间的一小部分,并且它会正确加载。

MySQL 集群版本是7.4.10。在 CentOS 7 上运行。

MySQL 即服务

[root@MySQL1 mysql]# cat MySQL1.Cluster.err 
160329 12:38:56 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
2016-03-29 12:38:56 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2016-03-29 12:38:56 0 [Note] /usr/sbin/mysqld (mysqld 5.6.28-ndb-7.4.10-cluster-gpl) starting as process 12269 ...
2016-03-29 12:38:56 12269 [Note] Plugin 'FEDERATED' is disabled.
2016-03-29 12:38:56 12269 [Note] InnoDB: Using atomics to ref count buffer pool pages
2016-03-29 12:38:56 12269 [Note] InnoDB: The InnoDB memory heap is disabled
2016-03-29 12:38:56 12269 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2016-03-29 12:38:56 12269 [Note] InnoDB: Memory barrier is not used
2016-03-29 12:38:56 12269 [Note] InnoDB: Compressed tables use zlib 1.2.3
2016-03-29 12:38:56 12269 [Note] InnoDB: Using Linux native AIO
2016-03-29 12:38:56 12269 [Note] InnoDB: Not using CPU crc32 instructions
2016-03-29 12:38:56 12269 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2016-03-29 12:38:56 12269 [Note] InnoDB: Completed initialization of buffer pool
2016-03-29 12:38:57 12269 [Note] InnoDB: Highest supported file format is Barracuda.
2016-03-29 12:38:57 12269 [Note] InnoDB: 128 rollback segment(s) are active.
2016-03-29 12:38:57 12269 [Note] InnoDB: Waiting for purge to start
2016-03-29 12:38:57 12269 [Note] InnoDB: 5.6.28 started; log sequence number 1626423
2016-03-29 12:38:57 12269 [Note] NDB: Changed global value of binlog_format from STATEMENT to MIXED
2016-03-29 12:38:57 12269 [Note] NDB: NodeID is 50, management server '10.0.0.200:1186'
2016-03-29 12:39:27 12269 [Note] NDB[0]: NodeID: 50, no storage nodes connected (timed out)
2016-03-29 12:39:27 12269 [Warning] NDB: server id set to zero - changes logged to bin log with server id zero will be logged with another server id by slave mysqlds
2016-03-29 12:39:27 12269 [Note] NDB Binlog: Starting...
2016-03-29 12:39:27 12269 [Note] NDB Binlog: Started
2016-03-29 12:39:27 12269 [Note] NDB Binlog: Setting up
2016-03-29 12:39:27 12269 [Note] NDB Binlog: Created schema Ndb object, reference: 0x80040032, name: 'Ndb Binlog schema change monitoring'
2016-03-29 12:39:27 12269 [Note] NDB Binlog: Created injector Ndb object, reference: 0x80050032, name: 'Ndb Binlog data change monitoring'
2016-03-29 12:39:27 12269 [Note] NDB Binlog: Setup completed
2016-03-29 12:39:27 12269 [Note] NDB Binlog: Wait for server start completed
2016-03-29 12:39:27 12269 [Note] NDB Util: Starting...
2016-03-29 12:39:27 12269 [Note] NDB Util: Wait for server start completed
2016-03-29 12:39:27 12269 [Note] NDB Index Stat: Starting...
2016-03-29 12:39:27 12269 [Note] NDB Index Stat: Wait for server start completed
2016-03-29 12:39:27 12269 [Note] Server hostname (bind-address): '*'; port: 3306
2016-03-29 12:39:27 12269 [Note] IPv6 is available.
2016-03-29 12:39:27 12269 [Note]   - '::' resolves to '::';
2016-03-29 12:39:27 12269 [Note] Server socket created on IP: '::'.
2016-03-29 12:39:27 12269 [Note] Event Scheduler: Loaded 0 events
2016-03-29 12:39:27 12269 [Note] /usr/sbin/mysqld: ready for connections.
Version: '5.6.28-ndb-7.4.10-cluster-gpl'  socket: '/var/lib/mysql/mysql.sock'  port: 3306  MySQL Cluster Community Server (GPL)
2016-03-29 12:39:27 12269 [Note] NDB Binlog: Check for incidents
2016-03-29 12:39:27 12269 [Note] NDB Binlog: Wait for cluster to start
2016-03-29 12:39:27 12269 [Note] NDB Util: Wait for cluster to start
2016-03-29 12:39:27 12269 [Note] NDB Util: Started
2016-03-29 12:39:27 12269 [Note] NDB Index Stat: Wait for cluster to start
2016-03-29 12:39:27 12269 [Note] NDB Index Stat: Started
2016-03-29 12:39:27 12269 [Note] created index stats Ndb object: reference 0x80070032, name: 'Ndb Index Statistics monitoring'
2016-03-29 12:39:57 12269 [Warning] NDB : Tables not available after 30 seconds.  Consider increasing --ndb-wait-setup value

我可以看到,上面最有趣的几行是:

2016-03-29 12:38:57 12269 [Note] NDB: NodeID is 50, management server '10.0.0.200:1186'
2016-03-29 12:39:27 12269 [Note] NDB[0]: NodeID: 50, no storage nodes connected (timed out)
2016-03-29 12:39:27 12269 [Warning] NDB: server id set to zero - changes logged to bin log with server id zero will be logged with another server id by slave mysqlds

手动调用 mysqld_safe

[root@MySQL1 mysql]# cat MySQL1.Cluster.err 
160329 12:44:15 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
2016-03-29 12:44:16 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2016-03-29 12:44:16 0 [Note] /usr/sbin/mysqld (mysqld 5.6.28-ndb-7.4.10-cluster-gpl) starting as process 12684 ...
2016-03-29 12:44:16 12684 [Note] Plugin 'FEDERATED' is disabled.
2016-03-29 12:44:16 12684 [Note] InnoDB: Using atomics to ref count buffer pool pages
2016-03-29 12:44:16 12684 [Note] InnoDB: The InnoDB memory heap is disabled
2016-03-29 12:44:16 12684 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2016-03-29 12:44:16 12684 [Note] InnoDB: Memory barrier is not used
2016-03-29 12:44:16 12684 [Note] InnoDB: Compressed tables use zlib 1.2.3
2016-03-29 12:44:16 12684 [Note] InnoDB: Using Linux native AIO
2016-03-29 12:44:16 12684 [Note] InnoDB: Not using CPU crc32 instructions
2016-03-29 12:44:16 12684 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2016-03-29 12:44:16 12684 [Note] InnoDB: Completed initialization of buffer pool
2016-03-29 12:44:16 12684 [Note] InnoDB: Highest supported file format is Barracuda.
2016-03-29 12:44:16 12684 [Note] InnoDB: 128 rollback segment(s) are active.
2016-03-29 12:44:16 12684 [Note] InnoDB: Waiting for purge to start
2016-03-29 12:44:16 12684 [Note] InnoDB: 5.6.28 started; log sequence number 1626433
2016-03-29 12:44:16 12684 [Note] NDB: Changed global value of binlog_format from STATEMENT to MIXED
2016-03-29 12:44:16 12684 [Note] NDB: NodeID is 50, management server '10.0.0.200:1186'
2016-03-29 12:44:17 12684 [Note] NDB[0]: NodeID: 50, all storage nodes connected
2016-03-29 12:44:17 12684 [Warning] NDB: server id set to zero - changes logged to bin log with server id zero will be logged with another server id by slave mysqlds
2016-03-29 12:44:17 12684 [Note] NDB Binlog: Starting...
2016-03-29 12:44:17 12684 [Note] NDB Binlog: Started
2016-03-29 12:44:17 12684 [Note] NDB Binlog: Setting up
2016-03-29 12:44:17 12684 [Note] NDB Binlog: Created schema Ndb object, reference: 0x80040032, name: 'Ndb Binlog schema change monitoring'
2016-03-29 12:44:17 12684 [Note] NDB Binlog: Created injector Ndb object, reference: 0x80050032, name: 'Ndb Binlog data change monitoring'
2016-03-29 12:44:17 12684 [Note] NDB Binlog: Setup completed
2016-03-29 12:44:17 12684 [Note] NDB Binlog: Wait for server start completed
2016-03-29 12:44:17 12684 [Note] NDB Util: Starting...
2016-03-29 12:44:17 12684 [Note] NDB Util: Wait for server start completed
2016-03-29 12:44:17 12684 [Note] NDB Index Stat: Starting...
2016-03-29 12:44:17 12684 [Note] NDB Index Stat: Wait for server start completed
2016-03-29 12:44:17 12684 [Note] Server hostname (bind-address): '*'; port: 3306
2016-03-29 12:44:17 12684 [Note] IPv6 is available.
2016-03-29 12:44:17 12684 [Note]   - '::' resolves to '::';
2016-03-29 12:44:17 12684 [Note] Server socket created on IP: '::'.
2016-03-29 12:44:17 12684 [Note] Event Scheduler: Loaded 0 events
2016-03-29 12:44:17 12684 [Note] /usr/sbin/mysqld: ready for connections.
Version: '5.6.28-ndb-7.4.10-cluster-gpl'  socket: '/var/lib/mysql/mysql.sock'  port: 3306  MySQL Cluster Community Server (GPL)
2016-03-29 12:44:17 12684 [Note] NDB Binlog: Check for incidents
2016-03-29 12:44:17 12684 [Note] NDB Binlog: Wait for cluster to start
2016-03-29 12:44:17 12684 [Note] NDB Util: Wait for cluster to start
2016-03-29 12:44:17 12684 [Note] NDB Util: Started
2016-03-29 12:44:17 12684 [Note] NDB Index Stat: Wait for cluster to start
2016-03-29 12:44:17 12684 [Note] NDB Index Stat: Started
2016-03-29 12:44:17 12684 [Note] created index stats Ndb object: reference 0x80070032, name: 'Ndb Index Statistics monitoring'
2016-03-29 12:44:17 12684 [Note] NDB Binlog: DISCOVER TABLE Event: REPL$mysql/ndb_schema
2016-03-29 12:44:17 12684 [Note] NDB Binlog: logging ./mysql/ndb_schema (UPDATED,USE_WRITE)
2016-03-29 12:44:17 12684 [Note] NDB Binlog: DISCOVER TABLE Event: REPL$mysql/ndb_apply_status
2016-03-29 12:44:17 12684 [Note] NDB Binlog: logging ./mysql/ndb_apply_status (UPDATED,USE_WRITE)
2016-03-29 12:44:17 12684 [Note] NDB: Cleaning stray tables from database 'ndbinfo'
2016-03-29 12:44:17 12684 [Note] NDB: Cleaning stray tables from database 'performance_schema'
2016-03-29 12:44:17 12684 [Note] NDB: Cleaning stray tables from database 'test'
2016-03-29 12:44:17 12684 [Note] NDB Binlog: Wait for first event
2016-03-29 12:44:17 [NdbApi] INFO     -- Flushing incomplete GCI:s < 212100/0
2016-03-29 12:44:17 [NdbApi] INFO     -- Flushing incomplete GCI:s < 212100/0
2016-03-29 12:44:17 12684 [Note] NDB Binlog: starting log at epoch 212100/0
2016-03-29 12:44:17 12684 [Note] NDB Binlog: Got first event
2016-03-29 12:44:17 12684 [Note] NDB Binlog: ndb tables writable
2016-03-29 12:44:17 12684 [Note] NDB Binlog: Startup and setup completed
2016-03-29 12:44:17 12684 [Note] NDB Schema dist: Data node: 12 reports subscribe from node 51, subscriber bitmask 800000
2016-03-29 12:44:17 12684 [Note] NDB Schema dist: Data node: 11 reports subscribe from node 51, subscriber bitmask 800000
2016-03-29 12:44:17 12684 [Note] NDB Schema dist: Data node: 13 reports subscribe from node 51, subscriber bitmask 800000
2016-03-29 12:44:17 12684 [Note] NDB Schema dist: Data node: 14 reports subscribe from node 51, subscriber bitmask 800000

如果您查看这些日志中的同一部分,则会发现不同:

2016-03-29 12:44:16 12684 [Note] NDB: NodeID is 50, management server '10.0.0.200:1186'
2016-03-29 12:44:17 12684 [Note] NDB[0]: NodeID: 50, all storage nodes connected
2016-03-29 12:44:17 12684 [Warning] NDB: server id set to zero - changes logged to bin log with server id zero will be logged with another server id by slave mysqlds

在后一种情况下,我还可以看到 API 节点已连接到管理节点,在前一种情况下,管理节点正在等待连接。

mysql mysql-cluster
  • 1 1 个回答
  • 2265 Views

1 个回答

  • Voted
  1. Best Answer
    Shane
    2016-04-01T20:19:16+08:002016-04-01T20:19:16+08:00

    好的。该问题与 SELinux 有关。我将 SELinux 置于许可模式setenforce 0并重新启动 MySQL,它连接良好 - 这很快就放弃了。所以我加载了 audit2why 并从中弄清楚了。我运行以下命令然后setenforce 1重新启用 SELinux,重新启动 MySQL,一切都按预期工作!

    魔术命令:
    setsebool -P mysql_connect_any 1

    看起来正在发生的事情是 MySQL 将连接到管理节点并读取存储节点,但是在尝试连接到存储节点时(我在端口 50501 上配置了我的,而不是随机端口)SELinux 介入并阻止了请求.

    ndb_mgm 的最终输出:

    ndb_mgm> show
    Cluster Configuration
    ---------------------
    [ndbd(NDB)] 4 node(s)
    id=11   @10.0.0.220  (mysql-5.6.28 ndb-7.4.10, Nodegroup: 0, *)
    id=12   @10.0.0.221  (mysql-5.6.28 ndb-7.4.10, Nodegroup: 0)
    id=13   @10.0.0.222  (mysql-5.6.28 ndb-7.4.10, Nodegroup: 1)
    id=14   @10.0.0.223  (mysql-5.6.28 ndb-7.4.10, Nodegroup: 1)
    
    [ndb_mgmd(MGM)] 1 node(s)
    id=1    @10.0.0.200  (mysql-5.6.28 ndb-7.4.10)
    
    [mysqld(API)]   2 node(s)
    id=50   @10.0.0.210  (mysql-5.6.28 ndb-7.4.10)
    id=51   @10.0.0.211  (mysql-5.6.28 ndb-7.4.10)
    
    • 2

相关问题

  • 是否有任何 MySQL 基准测试工具?[关闭]

  • 我在哪里可以找到mysql慢日志?

  • 如何优化大型数据库的 mysqldump?

  • 什么时候是使用 MariaDB 而不是 MySQL 的合适时机,为什么?

  • 组如何跟踪数据库架构更改?

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    连接到 PostgreSQL 服务器:致命:主机没有 pg_hba.conf 条目

    • 12 个回答
  • Marko Smith

    如何让sqlplus的输出出现在一行中?

    • 3 个回答
  • Marko Smith

    选择具有最大日期或最晚日期的日期

    • 3 个回答
  • Marko Smith

    如何列出 PostgreSQL 中的所有模式?

    • 4 个回答
  • Marko Smith

    列出指定表的所有列

    • 5 个回答
  • Marko Smith

    如何在不修改我自己的 tnsnames.ora 的情况下使用 sqlplus 连接到位于另一台主机上的 Oracle 数据库

    • 4 个回答
  • Marko Smith

    你如何mysqldump特定的表?

    • 4 个回答
  • Marko Smith

    使用 psql 列出数据库权限

    • 10 个回答
  • Marko Smith

    如何从 PostgreSQL 中的选择查询中将值插入表中?

    • 4 个回答
  • Marko Smith

    如何使用 psql 列出所有数据库和表?

    • 7 个回答
  • Martin Hope
    Jin 连接到 PostgreSQL 服务器:致命:主机没有 pg_hba.conf 条目 2014-12-02 02:54:58 +0800 CST
  • Martin Hope
    Stéphane 如何列出 PostgreSQL 中的所有模式? 2013-04-16 11:19:16 +0800 CST
  • Martin Hope
    Mike Walsh 为什么事务日志不断增长或空间不足? 2012-12-05 18:11:22 +0800 CST
  • Martin Hope
    Stephane Rolland 列出指定表的所有列 2012-08-14 04:44:44 +0800 CST
  • Martin Hope
    haxney MySQL 能否合理地对数十亿行执行查询? 2012-07-03 11:36:13 +0800 CST
  • Martin Hope
    qazwsx 如何监控大型 .sql 文件的导入进度? 2012-05-03 08:54:41 +0800 CST
  • Martin Hope
    markdorison 你如何mysqldump特定的表? 2011-12-17 12:39:37 +0800 CST
  • Martin Hope
    Jonas 如何使用 psql 对 SQL 查询进行计时? 2011-06-04 02:22:54 +0800 CST
  • Martin Hope
    Jonas 如何从 PostgreSQL 中的选择查询中将值插入表中? 2011-05-28 00:33:05 +0800 CST
  • Martin Hope
    Jonas 如何使用 psql 列出所有数据库和表? 2011-02-18 00:45:49 +0800 CST

热门标签

sql-server mysql postgresql sql-server-2014 sql-server-2016 oracle sql-server-2008 database-design query-performance sql-server-2017

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve