我和我的MySQL Cluster測試,安裝的煩惱:MySQL集羣錯誤:1005年:無法創建表「ndb_schema」(錯誤:13)
我運行Ubuntu和碼頭工人兩臺機器(使用多主機網絡)和每個節點(ndb_mgm
,ndbd
和mysqld
)通過Docker運行。設置如下:
機1:
- ndb_mgmd
- ndbd1
- mysqld1
機2:
- ndbd2
- mysqld2
當我開始mysqld
在一臺機器,它連接到經理,並希望發起集羣,但它無法創建表,整個NDB日誌上mysqld
實例重新開始後:
2016-08-02 09:08:57 135 [Note] NDB: Changed global value of binlog_format from STATEMENT to MIXED
2016-08-02 09:08:58 135 [Note] NDB: NodeID is 4, management server 'ndb_mgmd:1186'
2016-08-02 09:08:58 135 [Note] NDB[0]: NodeID: 4, all storage nodes connected
2016-08-02 09:08:58 135 [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-08-02 09:08:58 135 [Note] NDB Binlog: Starting...
2016-08-02 09:08:58 135 [Note] NDB Binlog: Started
2016-08-02 09:08:58 135 [Note] NDB Binlog: Setting up
2016-08-02 09:08:58 135 [Note] NDB Binlog: Created schema Ndb object, reference: 0x80040004, name: 'Ndb Binlog schema change monitoring'
2016-08-02 09:08:58 135 [Note] NDB Binlog: Created injector Ndb object, reference: 0x80050004, name: 'Ndb Binlog data change monitoring'
2016-08-02 09:08:58 135 [Note] NDB Binlog: Setup completed
2016-08-02 09:08:58 135 [Note] NDB Binlog: Wait for server start completed
2016-08-02 09:08:58 135 [Note] NDB Util: Starting...
2016-08-02 09:08:58 135 [Note] NDB Util: Wait for server start completed
2016-08-02 09:08:58 135 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: bf07c00a-5890-11e6-83a3-02420a000a1e.
2016-08-02 09:08:58 135 [Note] NDB Index Stat: Starting...
2016-08-02 09:08:58 135 [Note] NDB Index Stat: Wait for server start completed
2016-08-02 09:08:58 135 [Note] Server hostname (bind-address): '*'; port: 3306
2016-08-02 09:08:58 135 [Note] IPv6 is available.
2016-08-02 09:08:58 135 [Note] - '::' resolves to '::';
2016-08-02 09:08:58 135 [Note] Server socket created on IP: '::'.
2016-08-02 09:08:58 135 [Note] Event Scheduler: Loaded 0 events
2016-08-02 09:08:58 135 [Note] /usr/local/mysql-cluster-gpl-7.4.12-linux-glibc2.5-x86_64/bin/mysqld: ready for connections.
Version: '5.6.31-ndb-7.4.12-cluster-gpl' socket: '/tmp/mysql.sock' port: 3306 MySQL Cluster Community Server (GPL)
2016-08-02 09:08:58 135 [Note] NDB Util: Wait for cluster to start
2016-08-02 09:08:58 135 [Note] NDB Util: Started
2016-08-02 09:08:58 135 [Note] NDB Binlog: Check for incidents
2016-08-02 09:08:58 135 [Note] NDB Binlog: Wait for cluster to start
2016-08-02 09:08:58 135 [Note] NDB Index Stat: Wait for cluster to start
2016-08-02 09:08:58 135 [Note] NDB Index Stat: Started
2016-08-02 09:08:58 135 [Note] created index stats Ndb object: reference 0x80070004, name: 'Ndb Index Statistics monitoring'
2016-08-02 09:08:58 135 [Note] NDB: Creating mysql.ndb_schema
2016-08-02 09:08:58 135 [ERROR] NDB: Query 'CREATE TABLE IF NOT EXISTS mysql.ndb_schema (db VARBINARY(63) NOT NULL,name VARBINARY(63) NOT NULL,slock BINARY(32) NOT NULL,query BLOB NOT NULL,node_id INT UNSIGNED NOT NULL,epoch BIGINT UNSIGNED NOT NULL,id INT UNSIGNED NOT NULL,version INT UNSIGNED NOT NULL,type INT UNSIGNED NOT NULL,PRIMARY KEY USING HASH (db,name)) ENGINE=NDB CHARACTER SET latin1' failed, error: 1005: Can't create table 'ndb_schema' (errno: 13)
最後一行顯示,其無法創建一個表:
NDB: Query 'CREATE TABLE ...' failed, error: 1005: Can't create table 'ndb_schema' (errno: 13)
如果我檢出ndb_mgm
配置,每個節點似乎正確連接:
ndb_mgm> show
Connected to Management Server at: localhost:1186
Cluster Configuration
---------------------
[ndbd(NDB)] 2 node(s)
id=2 @10.0.10.20 (mysql-5.6.31 ndb-7.4.12, Nodegroup: 0, *)
id=3 @10.0.10.21 (mysql-5.6.31 ndb-7.4.12, Nodegroup: 0)
[ndb_mgmd(MGM)] 1 node(s)
id=1 @10.0.10.10 (mysql-5.6.31 ndb-7.4.12)
[mysqld(API)] 2 node(s)
id=4 @10.0.10.30 (mysql-5.6.31 ndb-7.4.12)
id=5 @10.0.10.31 (mysql-5.6.31 ndb-7.4.12)
爲ndb_mgmd
的配置:
[ndbd default]
NoOfReplicas=2
DataMemory=80M
IndexMemory=18M
[ndb_mgmd]
hostname=10.0.10.10
datadir=/var/lib/mysql-cluster
[ndbd]
hostname=10.0.10.20
datadir=/usr/local/mysql/data
[ndbd]
hostname=10.0.10.21
datadir=/usr/local/mysql/data
[mysqld]
hostname=10.0.10.30
[mysqld]
hostname=10.0.10.31
每個mysqld
被配置如下:
[mysqld]
ndbcluster
log-error=/var/log/mysql/error.log
運行狀態集羣上的一個mysqld
實例顯示沒有錯誤:
mysql> SHOW ENGINE NDB STATUS
-> ;
+------------+-----------------------+--------------------------------------------------------------------------------------------------------------------------------------------------+
| Type | Name | Status |
+------------+-----------------------+--------------------------------------------------------------------------------------------------------------------------------------------------+
| ndbcluster | connection | cluster_node_id=4, connected_host=ndb_mgmd, connected_port=1186, number_of_data_nodes=2, number_of_ready_data_nodes=2, connect_count=0 |
| ndbcluster | NdbTransaction | created=2, free=2, sizeof=368 |
| ndbcluster | NdbOperation | created=4, free=4, sizeof=944 |
| ndbcluster | NdbIndexScanOperation | created=0, free=0, sizeof=1152 |
| ndbcluster | NdbIndexOperation | created=0, free=0, sizeof=952 |
| ndbcluster | NdbRecAttr | created=0, free=0, sizeof=88 |
| ndbcluster | NdbApiSignal | created=16, free=16, sizeof=144 |
| ndbcluster | NdbLabel | created=0, free=0, sizeof=200 |
| ndbcluster | NdbBranch | created=0, free=0, sizeof=32 |
| ndbcluster | NdbSubroutine | created=0, free=0, sizeof=72 |
| ndbcluster | NdbCall | created=0, free=0, sizeof=24 |
| ndbcluster | NdbBlob | created=0, free=0, sizeof=496 |
| ndbcluster | NdbReceiver | created=0, free=0, sizeof=128 |
| ndbcluster | NdbLockHandle | created=0, free=0, sizeof=48 |
| ndbcluster | binlog | latest_epoch=0, latest_trans_epoch=200377404227594, latest_received_binlog_epoch=0, latest_handled_binlog_epoch=0, latest_applied_binlog_epoch=0 |
+------------+-----------------------+--------------------------------------------------------------------------------------------------------------------------------------------------+
15 rows in set (0.00 sec)
如果我要在集羣上手動創建一個表,我得到以下錯誤:
mysql> CREATE DATABASE cluster;
Query OK, 1 row affected (0.00 sec)
mysql> CREATE TABLE cluster_test (name VARCHAR(20), value VARCHAR(20)) ENGINE=ndbcluster;
ERROR 1296 (HY000): Got error 4009 'Cluster Failure' from NDBCLUSTER
mysql> show warnings;
+-------+------+--------------------------------------------------+
| Level | Code | Message |
+-------+------+--------------------------------------------------+
| Error | 1296 | Got error 4009 'Cluster Failure' from NDBCLUSTER |
+-------+------+--------------------------------------------------+
1 row in set (0.00 sec)
我不知道從哪裏得到詳細的錯誤描述。如果我是對的Errno 13通常是某種權限錯誤,但每個節點都有權限訪問這些文件夾(他們實際上寫了一些文件)。如果您需要詳細的文件夾權限列表,請告訴我。
感謝您的建議!