gpt4 book ai didi

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

转载 作者:搜寻专家 更新时间:2023-10-30 23:45:22 24 4
gpt4 key购买 nike

我正在尝试部署一个带有 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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com