我正在尝试部署一个带有1个节点管理器,1个sql节点和2个数据节点的mysql集群(4台机器)。我正在关注这些来自官方mysql网站的免费赠送(first part,second part,third part,fourth 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)
非常感谢您的帮助!!
答案 0 :(得分: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
. *