Mysql cluster 安装部署分管理节点、存储节点、SQL 节点的安装
1. [root@bogon ~]# cd /temp
2. [root@bogon temp]# dir
3. MySQL-Cluster-gpl-7.4.10-1.el6.x86_64.rpm-bundle.tar
4. [root@bogon temp]# tar -xvfMySQL-Cluster-gpl-7.4.10-1.el6.x86_64.rpm-bundle.tar
5. MySQL-Cluster-shared-gpl-7.4.10-1.el6.x86_64.rpm
6. MySQL-Cluster-server-gpl-7.4.10-1.el6.x86_64.rpm
7. MySQL-Cluster-embedded-gpl-7.4.10-1.el6.x86_64.rpm
8. MySQL-Cluster-shared-compat-gpl-7.4.10-1.el6.x86_64.rpm
9. MySQL-Cluster-devel-gpl-7.4.10-1.el6.x86_64.rpm
10. MySQL-Cluster-test-gpl-7.4.10-1.el6.x86_64.rpm
11. MySQL-Cluster-client-gpl-7.4.10-1.el6.x86_64.rpm
12. [root@bogon temp]# userdelmysql
13. userdel: user 'mysql' does notexist
14. [root@bogon temp]# groupaddmysql
15. [root@bogon temp]# useraddmysql -g mysql
16. [root@bogon temp]# mkdir -p/var/mysql/data/
17. [root@bogon temp]# chmod -R 777/var/mysql/data/
18. [root@bogon temp]# chownmysql:mysql /var/mysql/data
19. [root@bogon temp]# mkdir -p/var/mysql/log/
20. [root@bogon temp]# chmod -R 777/var/mysql/log/
21. [root@bogon temp]# chownmysql:mysql /var/mysql/log/
22. [root@bogon temp]# rpm -ivhMySQL-Cluster-server-gpl-7.4.10-1.el6.x86_64.rpm
23. warning:MySQL-Cluster-server-gpl-7.4.10-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature,key ID 5072e1f5: NOKEY
24. Preparing... ########################################### [100%]
25. 1:MySQL-Cluster-server-gp###########################################[100%]
26. 2016-04-11 10:00:57 0 [Warning]TIMESTAMP with implicit DEFAULT value is deprecated. Please use--explicit_defaults_for_timestamp server option (see documentation for moredetails).
27. 2016-04-11 10:00:57 0 [Note]/usr/sbin/mysqld (mysqld 5.6.28-ndb-7.4.10-cluster-gpl) starting as process2492 ...
28. 2016-04-11 10:00:57 2492 [Note]InnoDB: Using atomics to ref count buffer pool pages
29. 2016-04-11 10:00:57 2492 [Note]InnoDB: The InnoDB memory heap is disabled
30. 2016-04-11 10:00:57 2492 [Note]InnoDB: Mutexes and rw_locks use GCC atomic builtins
31. 2016-04-11 10:00:57 2492 [Note]InnoDB: Memory barrier is not used
32. 2016-04-11 10:00:57 2492 [Note]InnoDB: Compressed tables use zlib 1.2.3
33. 2016-04-11 10:00:57 2492 [Note]InnoDB: Using Linux native AIO
34. 2016-04-11 10:00:57 2492 [Note]InnoDB: Using CPU crc32 instructions
35. 2016-04-11 10:00:57 2492 [Note]InnoDB: Initializing buffer pool, size = 128.0M
36. 2016-04-11 10:00:57 2492 [Note]InnoDB: Completed initialization of buffer pool
37. 2016-04-11 10:00:57 2492 [Note]InnoDB: The first specified data file ./ibdata1 did not exist: a new databaseto be created!
38. 2016-04-11 10:00:57 2492 [Note]InnoDB: Setting file ./ibdata1 size to 12 MB
39. 2016-04-11 10:00:57 2492 [Note]InnoDB: Database physically writes the file full: wait...
40. 2016-04-11 10:00:57 2492 [Note]InnoDB: Setting log file ./ib_logfile101 size to 48 MB
41. 2016-04-11 10:00:58 2492 [Note]InnoDB: Setting log file ./ib_logfile1 size to 48 MB
42. 2016-04-11 10:00:59 2492 [Note]InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0
43. 2016-04-11 10:00:59 2492[Warning] InnoDB: New log files created, LSN=45781
44. 2016-04-11 10:00:59 2492 [Note]InnoDB: Doublewrite buffer not found: creating new
45. 2016-04-11 10:00:59 2492 [Note]InnoDB: Doublewrite buffer created
46. 2016-04-11 10:00:59 2492 [Note]InnoDB: 128 rollback segment(s) are active.
47. 2016-04-11 10:00:59 2492[Warning] InnoDB: Creating foreign key constraint system tables.
48. 2016-04-11 10:00:59 2492 [Note]InnoDB: Foreign key constraint system tables created
49. 2016-04-11 10:00:59 2492 [Note]InnoDB: Creating tablespace and datafile system tables.
50. 2016-04-11 10:00:59 2492 [Note]InnoDB: Tablespace and datafile system tables created.
51. 2016-04-11 10:00:59 2492 [Note]InnoDB: Waiting for purge to start
52. 2016-04-11 10:00:59 2492 [Note]InnoDB: 5.6.28 started; log sequence number 0
53. A random root password has beenset. You will find it in '/root/.mysql_secret'.
54. 2016-04-11 10:01:00 2492 [Note]Binlog end
55. 2016-04-11 10:01:00 2492 [Note]InnoDB: FTS optimize thread exiting.
56. 2016-04-11 10:01:00 2492 [Note]InnoDB: Starting shutdown...
57. 2016-04-11 10:01:02 2492 [Note]InnoDB: Shutdown completed; log sequence number 1625977
58.
59.
60. 2016-04-11 10:01:02 0 [Warning]TIMESTAMP with implicit DEFAULT value is deprecated. Please use--explicit_defaults_for_timestamp server option (see documentation for moredetails).
61. 2016-04-11 10:01:02 0 [Note]/usr/sbin/mysqld (mysqld 5.6.28-ndb-7.4.10-cluster-gpl) starting as process2514 ...
62. 2016-04-11 10:01:02 2514 [Note]InnoDB: Using atomics to ref count buffer pool pages
63. 2016-04-11 10:01:02 2514 [Note]InnoDB: The InnoDB memory heap is disabled
64. 2016-04-11 10:01:02 2514 [Note]InnoDB: Mutexes and rw_locks use GCC atomic builtins
65. 2016-04-11 10:01:02 2514 [Note]InnoDB: Memory barrier is not used
66. 2016-04-11 10:01:02 2514 [Note]InnoDB: Compressed tables use zlib 1.2.3
67. 2016-04-11 10:01:02 2514 [Note]InnoDB: Using Linux native AIO
68. 2016-04-11 10:01:02 2514 [Note]InnoDB: Using CPU crc32 instructions
69. 2016-04-11 10:01:02 2514 [Note]InnoDB: Initializing buffer pool, size = 128.0M
70. 2016-04-11 10:01:02 2514 [Note]InnoDB: Completed initialization of buffer pool
71. 2016-04-11 10:01:02 2514 [Note]InnoDB: Highest supported file format is Barracuda.
72. 2016-04-11 10:01:02 2514 [Note]InnoDB: 128 rollback segment(s) are active.
73. 2016-04-11 10:01:02 2514 [Note]InnoDB: Waiting for purge to start
74. 2016-04-11 10:01:02 2514 [Note]InnoDB: 5.6.28 started; log sequence number 1625977
75. 2016-04-11 10:01:02 2514 [Note]Binlog end
76. 2016-04-11 10:01:02 2514 [Note]InnoDB: FTS optimize thread exiting.
77. 2016-04-11 10:01:02 2514 [Note]InnoDB: Starting shutdown...
78. 2016-04-11 10:01:04 2514 [Note]InnoDB: Shutdown completed; log sequence number 1625987
79.
80.
81.
82.
83. A RANDOM PASSWORD HAS BEEN SETFOR THE MySQL root USER !
84. You will find that password in'/root/.mysql_secret'.
85.
86. You must change that passwordon your first connect,
87. no other statement but 'SETPASSWORD' will be accepted.
88. See the manual for thesemantics of the 'password expired' flag.
89.
90. Also, the account for theanonymous user has been removed.
91.
92. In addition, you can run:
93.
94. /usr/bin/mysql_secure_installation
95.
96. which will also give you theoption of removing the test database.
97. This is strongly recommendedfor production servers.
98.
99. See the manual for moreinstructions.
100.
101.Please report any problems athttp://bugs.mysql.com/
102.
103.The latest information aboutMySQL is available on the web at
104.
105. http://www.mysql.com
106.
107.Support MySQL by buyingsupport/licenses at http://shop.mysql.com
108.
109.New default config file wascreated as /usr/my.cnf and
110.will be used by default by theserver when you start it.
111.You may edit this file tochange server settings
管理节点启动:
[root@bogon temp]# ndb_mgmd -f/var/lib/mysql-cluster/config.ini --configdir=/var/lib/mysql-cluster/--ndb-nodeid=1 --initial
配置文件内容:
[NDBD DEFAULT]
#Options affecting ndbd processes on alldata nodes:
NoOfReplicas=2 #Number of replicas
DataMemory=100M #How much memory to allocate for data storage
IndexMemory=50M #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]
portnumber=3306
[NDB_MGMD]
nodeid=1 #Management process option
HostName=192.168.2.57 #Hostname or IP address of MGM node
DataDir=/var/lib/mysql-cluster #Directory for MGM node log files
[NDB_MGMD]
nodeid=2 #Management process option
HostName=192.168.2.60 #Hostname or IP address of MGM node
DataDir=/var/lib/mysql-cluster #Directory for MGM node log files
[NDBD]
nodeid=3 # Options for data node (one ndbd section per data node)
HostName=192.168.2.59 #Hostname or IP address
DataDir=/var/mysql/data #Directory for this data nodes data files
[NDBD]
nodeid=4 # Options for data node (one ndbd section per data node)
HostName=192.168.2.61 #Hostname or IP address
DataDir=/var/mysql/data #Directory for this data nodes data files
[NDBD]
nodeid=5 # Options for data node (one ndbd section per data node)
HostName=192.168.2.62 #Hostname or IP address
DataDir=/var/mysql/data #Directory for this data nodes data files
[MYSQLD]
nodeid=6 #SQL node options:
HostName=192.168.2.64 #Hostname or IP address
#(additional mysqld connections can be
#specified for this node for various
#purposes such as running ndb_restore)
[MYSQLD]
nodeid=7 # SQL node options:
HostName=192.168.2.67 #Hostname or IP address
#(additional mysqld connections can be
#specified for this node for various
#purposes such as running ndb_restore)
[MYSQLD]
nodeid=8
HostName=192.168.2.65
[MYSQLD]
nodeid=9
存储节点内容:
存储结点安装执行的命令:
[root@bogon ~]# ifconfig
eth1 Link encap:Ethernet HWaddr00:0C:29:12:82:92
inet addr:192.168.2.59 Bcast:192.168.3.255 Mask:255.255.252.0
inet6 addr: fe80::20c:29ff:fe12:8292/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:2103 errors:0 dropped:0 overruns:0 frame:0
TX packets:24 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:172321 (168.2 KiB) TXbytes:2341 (2.2 KiB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:16 errors:0 dropped:0 overruns:0 frame:0
TX packets:16 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:960 (960.0 b) TXbytes:960 (960.0 b)
[root@bogon ~]# ^C
[root@bogon ~]# cd /temp
[root@bogon temp]# dir
MySQL-Cluster-gpl-7.4.10-1.el6.x86_64.rpm-bundle.tar
[root@bogon temp]# tar -xvfMySQL-Cluster-gpl-7.4.10-1.el6.x86_64.rpm-bundle.tar
MySQL-Cluster-shared-gpl-7.4.10-1.el6.x86_64.rpm
MySQL-Cluster-server-gpl-7.4.10-1.el6.x86_64.rpm
MySQL-Cluster-embedded-gpl-7.4.10-1.el6.x86_64.rpm
MySQL-Cluster-shared-compat-gpl-7.4.10-1.el6.x86_64.rpm
MySQL-Cluster-devel-gpl-7.4.10-1.el6.x86_64.rpm
MySQL-Cluster-test-gpl-7.4.10-1.el6.x86_64.rpm
MySQL-Cluster-client-gpl-7.4.10-1.el6.x86_64.rpm
[root@bogon temp]# userdel mysql
userdel: user 'mysql' does not exist
[root@bogon temp]# groupadd mysql
[root@bogon temp]# useradd mysql -g mysql
[root@bogon temp]# mkdir -p/var/mysql/data/
[root@bogon temp]# chmod -R 777 /var/mysql/data/
[root@bogon temp]# chown mysql:mysql/var/mysql/data
[root@bogon temp]# mkdir -p /var/mysql/log/
[root@bogon temp]# chmod -R 777/var/mysql/log/
[root@bogon temp]# chown mysql:mysql/var/mysql/log/
[root@bogon temp]# rpm -ivhMySQL-Cluster-server-gpl-7.4.10-1.el6.x86_64.rpm
warning:MySQL-Cluster-server-gpl-7.4.10-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature,key ID 5072e1f5: NOKEY
Preparing... ########################################### [100%]
1:MySQL-Cluster-server-gp###########################################[100%]
2016-04-11 10:00:57 0 [Warning] TIMESTAMPwith implicit DEFAULT value is deprecated. Please use--explicit_defaults_for_timestamp server option (see documentation for moredetails).
2016-04-11 10:00:57 0 [Note]/usr/sbin/mysqld (mysqld 5.6.28-ndb-7.4.10-cluster-gpl) starting as process2492 ...
2016-04-11 10:00:57 2492 [Note] InnoDB:Using atomics to ref count buffer pool pages
2016-04-11 10:00:57 2492 [Note] InnoDB: TheInnoDB memory heap is disabled
2016-04-11 10:00:57 2492 [Note] InnoDB:Mutexes and rw_locks use GCC atomic builtins
2016-04-11 10:00:57 2492 [Note] InnoDB:Memory barrier is not used
2016-04-11 10:00:57 2492 [Note] InnoDB:Compressed tables use zlib 1.2.3
2016-04-11 10:00:57 2492 [Note] InnoDB:Using Linux native AIO
2016-04-11 10:00:57 2492 [Note] InnoDB:Using CPU crc32 instructions
2016-04-11 10:00:57 2492 [Note] InnoDB:Initializing buffer pool, size = 128.0M
2016-04-11 10:00:57 2492 [Note] InnoDB:Completed initialization of buffer pool
2016-04-11 10:00:57 2492 [Note] InnoDB: Thefirst specified data file ./ibdata1 did not exist: a new database to becreated!
2016-04-11 10:00:57 2492 [Note] InnoDB:Setting file ./ibdata1 size to 12 MB
2016-04-11 10:00:57 2492 [Note] InnoDB:Database physically writes the file full: wait...
2016-04-11 10:00:57 2492 [Note] InnoDB:Setting log file ./ib_logfile101 size to 48 MB
2016-04-11 10:00:58 2492 [Note] InnoDB:Setting log file ./ib_logfile1 size to 48 MB
2016-04-11 10:00:59 2492 [Note] InnoDB:Renaming log file ./ib_logfile101 to ./ib_logfile0
2016-04-11 10:00:59 2492 [Warning] InnoDB:New log files created, LSN=45781
2016-04-11 10:00:59 2492 [Note] InnoDB:Doublewrite buffer not found: creating new
2016-04-11 10:00:59 2492 [Note] InnoDB:Doublewrite buffer created
2016-04-11 10:00:59 2492 [Note] InnoDB: 128rollback segment(s) are active.
2016-04-11 10:00:59 2492 [Warning] InnoDB:Creating foreign key constraint system tables.
2016-04-11 10:00:59 2492 [Note] InnoDB:Foreign key constraint system tables created
2016-04-11 10:00:59 2492 [Note] InnoDB:Creating tablespace and datafile system tables.
2016-04-11 10:00:59 2492 [Note] InnoDB:Tablespace and datafile system tables created.
2016-04-11 10:00:59 2492 [Note] InnoDB:Waiting for purge to start
2016-04-11 10:00:59 2492 [Note] InnoDB:5.6.28 started; log sequence number 0
A random root password has been set. Youwill find it in '/root/.mysql_secret'.
2016-04-11 10:01:00 2492 [Note] Binlog end
2016-04-11 10:01:00 2492 [Note] InnoDB: FTSoptimize thread exiting.
2016-04-11 10:01:00 2492 [Note] InnoDB:Starting shutdown...
2016-04-11 10:01:02 2492 [Note] InnoDB:Shutdown completed; log sequence number 1625977
2016-04-11 10:01:02 0 [Warning] TIMESTAMPwith implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestampserver option (see documentation for more details).
2016-04-11 10:01:02 0 [Note]/usr/sbin/mysqld (mysqld 5.6.28-ndb-7.4.10-cluster-gpl) starting as process2514 ...
2016-04-11 10:01:02 2514 [Note] InnoDB:Using atomics to ref count buffer pool pages
2016-04-11 10:01:02 2514 [Note] InnoDB: TheInnoDB memory heap is disabled
2016-04-11 10:01:02 2514 [Note] InnoDB:Mutexes and rw_locks use GCC atomic builtins
2016-04-11 10:01:02 2514 [Note] InnoDB:Memory barrier is not used
2016-04-11 10:01:02 2514 [Note] InnoDB:Compressed tables use zlib 1.2.3
2016-04-11 10:01:02 2514 [Note] InnoDB:Using Linux native AIO
2016-04-11 10:01:02 2514 [Note] InnoDB:Using CPU crc32 instructions
2016-04-11 10:01:02 2514 [Note] InnoDB:Initializing buffer pool, size = 128.0M
2016-04-11 10:01:02 2514 [Note] InnoDB:Completed initialization of buffer pool
2016-04-11 10:01:02 2514 [Note] InnoDB:Highest supported file format is Barracuda.
2016-04-11 10:01:02 2514 [Note] InnoDB: 128rollback segment(s) are active.
2016-04-11 10:01:02 2514 [Note] InnoDB:Waiting for purge to start
2016-04-11 10:01:02 2514 [Note] InnoDB:5.6.28 started; log sequence number 1625977
2016-04-11 10:01:02 2514 [Note] Binlog end
2016-04-11 10:01:02 2514 [Note] InnoDB: FTSoptimize thread exiting.
2016-04-11 10:01:02 2514 [Note] InnoDB:Starting shutdown...
2016-04-11 10:01:04 2514 [Note] InnoDB:Shutdown completed; log sequence number 1625987
A RANDOM PASSWORD HAS BEEN SET FOR THEMySQL root USER !
You will find that password in'/root/.mysql_secret'.
You must change that password on your firstconnect,
no other statement but 'SET PASSWORD' willbe accepted.
See the manual for the semantics of the'password expired' flag.
Also, the account for the anonymous userhas been removed.
In addition, you can run:
/usr/bin/mysql_secure_installation
which will also give you the option ofremoving the test database.
This is strongly recommended for productionservers.
See the manual for more instructions.
Please report any problems athttp://bugs.mysql.com/
The latest information about MySQL isavailable on the web at
http://www.mysql.com
Support MySQL by buying support/licenses athttp://shop.mysql.com
New default config file was created as/usr/my.cnf and
will be used by default by the server whenyou start it.
You may edit this file to change serversettings
[root@bogon temp]# find / -name my.cnf
/usr/my.cnf
[root@bogon temp]# cp /usr/my.cnf /etc/
[root@bogon temp]# vi /etc/my.cnf
[root@bogon temp]# cd /usr/bin
[root@bogon bin]# ll |grep mysql
-rwxr-xr-x. 1 root root 11255 Jan 27 02:34 mysqlbug
-rwxr-xr-x. 1 root root 4334 Jan 27 02:34mysql_convert_table_format
-rwxr-xr-x. 1 root root 26356 Jan 27 02:34 mysqld_multi
-rwxr-xr-x. 1 root root 24723 Jan 27 02:34 mysqld_safe
-rwxr-xr-x. 1 root root 7424 Jan 27 02:34 mysqldumpslow
-rwxr-xr-x. 1 root root 1366 Jan 27 02:34 mysql_fix_extensions
-rwxr-xr-x. 1 root root 34938 Jan 27 02:34 mysqlhotcopy
-rwxr-xr-x. 1 root root 34612 Jan 27 02:34 mysql_install_db
-rwxr-xr-x. 1 root root 4949586 Jan 27 02:50 mysql_plugin
-rwxr-xr-x. 1 root root 10106 Jan 27 02:34mysql_secure_installation
-rwxr-xr-x. 1 root root 17584 Jan 27 02:34 mysql_setpermission
-rwxr-xr-x. 1 root root 9579018 Jan 27 02:50 mysqltest
-rwxr-xr-x. 1 root root 4492005 Jan 27 02:42 mysql_tzinfo_to_sql
-rwxr-xr-x. 1 root root 5148693 Jan 27 02:50 mysql_upgrade
-rwxr-xr-x. 1 root root 3976 Jan 27 02:34 mysql_zap
[root@bogon bin]# mysql_install_db--user=mysql --defaults-file=/etc/my.cnf --datadir=/var/mysql/data/
Installing MySQL system tables...2016-04-1110:05:44 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated.Please use --explicit_defaults_for_timestamp server option (see documentationfor more details).
2016-04-11 10:05:44 0 [Note]/usr/sbin/mysqld (mysqld 5.6.28-ndb-7.4.10-cluster-gpl-log) starting as process2554 ...
2016-04-11 10:05:44 2554 [Note] InnoDB:Using atomics to ref count buffer pool pages
2016-04-11 10:05:44 2554 [Note] InnoDB: TheInnoDB memory heap is disabled
2016-04-11 10:05:44 2554 [Note] InnoDB:Mutexes and rw_locks use GCC atomic builtins
2016-04-11 10:05:44 2554 [Note] InnoDB:Memory barrier is not used
2016-04-11 10:05:44 2554 [Note] InnoDB:Compressed tables use zlib 1.2.3
2016-04-11 10:05:44 2554 [Note] InnoDB:Using Linux native AIO
2016-04-11 10:05:44 2554 [Note] InnoDB:Using CPU crc32 instructions
2016-04-11 10:05:44 2554 [Note] InnoDB:Initializing buffer pool, size = 128.0M
2016-04-11 10:05:44 2554 [Note] InnoDB:Completed initialization of buffer pool
2016-04-11 10:05:44 2554 [Note] InnoDB: Thefirst specified data file ./ibdata1 did not exist: a new database to becreated!
2016-04-11 10:05:44 2554 [Note] InnoDB:Setting file ./ibdata1 size to 12 MB
2016-04-11 10:05:44 2554 [Note] InnoDB:Database physically writes the file full: wait...
2016-04-11 10:05:44 2554 [Note] InnoDB:Setting log file ./ib_logfile101 size to 48 MB
2016-04-11 10:05:44 2554 [Note] InnoDB:Setting log file ./ib_logfile1 size to 48 MB
2016-04-11 10:05:45 2554 [Note] InnoDB:Renaming log file ./ib_logfile101 to ./ib_logfile0
2016-04-11 10:05:45 2554 [Warning] InnoDB:New log files created, LSN=45781
2016-04-11 10:05:45 2554 [Note] InnoDB:Doublewrite buffer not found: creating new
2016-04-11 10:05:45 2554 [Note] InnoDB:Doublewrite buffer created
2016-04-11 10:05:45 2554 [Note] InnoDB: 128rollback segment(s) are active.
2016-04-11 10:05:45 2554 [Warning] InnoDB:Creating foreign key constraint system tables.
2016-04-11 10:05:45 2554 [Note] InnoDB:Foreign key constraint system tables created
2016-04-11 10:05:45 2554 [Note] InnoDB:Creating tablespace and datafile system tables.
2016-04-11 10:05:45 2554 [Note] InnoDB:Tablespace and datafile system tables created.
2016-04-11 10:05:45 2554 [Note] InnoDB:Waiting for purge to start
2016-04-11 10:05:45 2554 [Note] InnoDB:5.6.28 started; log sequence number 0
2016-04-11 10:05:46 2554 [Note] Binlog end
2016-04-11 10:05:46 2554 [Note] InnoDB: FTSoptimize thread exiting.
2016-04-11 10:05:46 2554 [Note] InnoDB:Starting shutdown...
2016-04-11 10:05:47 2554 [Note] InnoDB:Shutdown completed; log sequence number 1625977
OK
Filling help tables...2016-04-11 10:05:47 0[Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use--explicit_defaults_for_timestamp server option (see documentation for moredetails).
2016-04-11 10:05:47 0 [Note]/usr/sbin/mysqld (mysqld 5.6.28-ndb-7.4.10-cluster-gpl-log) starting as process2576 ...
2016-04-11 10:05:47 2576 [Note] InnoDB:Using atomics to ref count buffer pool pages
2016-04-11 10:05:47 2576 [Note] InnoDB: TheInnoDB memory heap is disabled
2016-04-11 10:05:47 2576 [Note] InnoDB:Mutexes and rw_locks use GCC atomic builtins
2016-04-11 10:05:47 2576 [Note] InnoDB:Memory barrier is not used
2016-04-11 10:05:47 2576 [Note] InnoDB:Compressed tables use zlib 1.2.3
2016-04-11 10:05:47 2576 [Note] InnoDB:Using Linux native AIO
2016-04-11 10:05:47 2576 [Note] InnoDB:Using CPU crc32 instructions
2016-04-11 10:05:47 2576 [Note] InnoDB:Initializing buffer pool, size = 128.0M
2016-04-11 10:05:47 2576 [Note] InnoDB:Completed initialization of buffer pool
2016-04-11 10:05:47 2576 [Note] InnoDB:Highest supported file format is Barracuda.
2016-04-11 10:05:47 2576 [Note] InnoDB: 128rollback segment(s) are active.
2016-04-11 10:05:47 2576 [Note] InnoDB:Waiting for purge to start
2016-04-11 10:05:47 2576 [Note] InnoDB:5.6.28 started; log sequence number 1625977
2016-04-11 10:05:47 2576 [Note] Binlog end
2016-04-11 10:05:48 2576 [Note] InnoDB: FTSoptimize thread exiting.
2016-04-11 10:05:48 2576 [Note] InnoDB:Starting shutdown...
2016-04-11 10:05:49 2576 [Note] InnoDB:Shutdown completed; log sequence number 1625987
OK
To start mysqld at boot time you have tocopy
support-files/mysql.server to the rightplace for your system
PLEASE REMEMBER TO SET A PASSWORD FOR THEMySQL root USER !
To do so, start the server, then issue thefollowing commands:
/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h bogon password 'new-password'
Alternatively you can run:
/usr/bin/mysql_secure_installation
which will also give you the option ofremoving the test
databases and anonymous user created bydefault. This is
strongly recommended for productionservers.
See the manual for more instructions.
You can start the MySQL daemon with:
cd/usr ; /usr/bin/mysqld_safe &
You can test the MySQL daemon withmysql-test-run.pl
cdmysql-test ; perl mysql-test-run.pl
Please report any problems athttp://bugs.mysql.com/
The latest information about MySQL isavailable on the web at
http://www.mysql.com
Support MySQL by buying support/licenses athttp://shop.mysql.com
WARNING: Found existing config file/usr/my.cnf on the system.
Because this file might be in use, it was notreplaced,
but was used in bootstrap (unless you used--defaults-file)
and when you later start the server.
The new default config file was created as/usr/my-new.cnf,
please compare it with your file and takethe changes you need.
WARNING: Default config file /etc/my.cnfexists on the system
This file will be read by default by theMySQL server
If you do not want to use this, eitherremove it, or use the
--defaults-file argument to mysqld_safewhen starting the server
[root@bogon bin]# ndbd --initial
2016-04-11 10:05:59 [ndbd] INFO -- Angel connected to '192.168.2.60:1186'
2016-04-11 10:06:00 [ndbd] INFO -- Angel allocated nodeid: 3
SQL节点配置文件同存储结点配置文件相同:
SQL 节点配置文件执行命令:
[root@bogon ~]# cd /temp
[root@bogon temp]# dir
MySQL-Cluster-gpl-7.4.10-1.el6.x86_64.rpm-bundle.tar
[root@bogon temp]# tar -xvfMySQL-Cluster-gpl-7.4.10-1.el6.x86_64.rpm-bundle.tar
MySQL-Cluster-shared-gpl-7.4.10-1.el6.x86_64.rpm
MySQL-Cluster-server-gpl-7.4.10-1.el6.x86_64.rpm
MySQL-Cluster-embedded-gpl-7.4.10-1.el6.x86_64.rpm
MySQL-Cluster-shared-compat-gpl-7.4.10-1.el6.x86_64.rpm
MySQL-Cluster-devel-gpl-7.4.10-1.el6.x86_64.rpm
MySQL-Cluster-test-gpl-7.4.10-1.el6.x86_64.rpm
MySQL-Cluster-client-gpl-7.4.10-1.el6.x86_64.rpm
[root@bogon temp]# userdel mysql
userdel: user 'mysql' does not exist
[root@bogon temp]# groupadd mysql
[root@bogon temp]# useradd mysql -g mysql
[root@bogon temp]# mkdir -p/var/mysql/data/
[root@bogon temp]# mkdir -p /var/mysql/log/
[root@bogon temp]# mkdir -p/var/run/mysqld/
[root@bogon temp]# chmod -R 777/var/mysql/data/
[root@bogon temp]# chmod -R 777/var/mysql/log/
[root@bogon temp]# chmod -R 777/var/run/mysqld/
[root@bogon temp]# chown mysql:mysql/var/mysql/data/
[root@bogon temp]# chown mysql:mysql/var/mysql/log/
[root@bogon temp]# chown mysql:mysql/var/run/mysqld/
[root@bogon temp]# vi /etc/my.cnf
My.cnf 内容:
[CLIENT]
socket=/var/mysql/mysql.sock
[MYSQLD]
datadir=/var/mysql/data
user=mysql
#Disabling symbolic-links is recommended toprevent assorted security risks
symbolic-links=0
log-bin = /var/mysql/log/mysql-bin.log
max_connections=1000
#run ndb storge engine
# Set Management node
ndbcluster
ndb-connectstring=192.168.2.57,192.168.2.60
[MYSQL_CLUSTER]
ndb-connectstring=192.168.2.57,192.168.2.60
[NDB_MGM]
connect-string=192.168.2.57,192.168.2.60
[MYSQLD_SAFE]
log-error=/var/mysql/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
:wq
保存my.cnf 文件
安装server 包:
[root@bogon temp]# rpm -ivhMySQL-Cluster-server-gpl-7.4.10-1.el6.x86_64.rpm
warning:MySQL-Cluster-server-gpl-7.4.10-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature,key ID 5072e1f5: NOKEY
Preparing... ###########################################[100%]
1:MySQL-Cluster-server-gp###########################################[100%]
2016-04-12 03:14:37 0 [Warning] TIMESTAMPwith implicit DEFAULT value is deprecated. Please use--explicit_defaults_for_timestamp server option (see documentation for moredetails).
2016-04-12 03:14:37 0 [Note]/usr/sbin/mysqld (mysqld 5.6.28-ndb-7.4.10-cluster-gpl-log) starting as process2467 ...
2016-04-12 03:14:37 2467 [Note] InnoDB:Using atomics to ref count buffer pool pages
2016-04-12 03:14:37 2467 [Note] InnoDB: TheInnoDB memory heap is disabled
2016-04-12 03:14:37 2467 [Note] InnoDB:Mutexes and rw_locks use GCC atomic builtins
2016-04-12 03:14:37 2467 [Note] InnoDB:Memory barrier is not used
2016-04-12 03:14:37 2467 [Note] InnoDB:Compressed tables use zlib 1.2.3
2016-04-12 03:14:37 2467 [Note] InnoDB:Using Linux native AIO
2016-04-12 03:14:38 2467 [Note] InnoDB:Using CPU crc32 instructions
2016-04-12 03:14:38 2467 [Note] InnoDB:Initializing buffer pool, size = 128.0M
2016-04-12 03:14:38 2467 [Note] InnoDB:Completed initialization of buffer pool
2016-04-12 03:14:38 2467 [Note] InnoDB: Thefirst specified data file ./ibdata1 did not exist: a new database to becreated!
2016-04-12 03:14:38 2467 [Note] InnoDB:Setting file ./ibdata1 size to 12 MB
2016-04-12 03:14:38 2467 [Note] InnoDB:Database physically writes the file full: wait...
2016-04-12 03:14:39 2467 [Note] InnoDB:Setting log file ./ib_logfile101 size to 48 MB
2016-04-12 03:14:42 2467 [Note] InnoDB:Setting log file ./ib_logfile1 size to 48 MB
2016-04-12 03:14:44 2467 [Note] InnoDB:Renaming log file ./ib_logfile101 to ./ib_logfile0
2016-04-12 03:14:44 2467 [Warning] InnoDB:New log files created, LSN=45781
2016-04-12 03:14:44 2467 [Note] InnoDB:Doublewrite buffer not found: creating new
2016-04-12 03:14:45 2467 [Note] InnoDB:Doublewrite buffer created
2016-04-12 03:14:45 2467 [Note] InnoDB: 128rollback segment(s) are active.
2016-04-12 03:14:45 2467 [Warning] InnoDB:Creating foreign key constraint system tables.
2016-04-12 03:14:45 2467 [Note] InnoDB:Foreign key constraint system tables created
2016-04-12 03:14:45 2467 [Note] InnoDB:Creating tablespace and datafile system tables.
2016-04-12 03:14:45 2467 [Note] InnoDB:Tablespace and datafile system tables created.
2016-04-12 03:14:45 2467 [Note] InnoDB:Waiting for purge to start
2016-04-12 03:14:45 2467 [Note] InnoDB:5.6.28 started; log sequence number 0
A random root password has been set. Youwill find it in '/root/.mysql_secret'.
2016-04-12 03:14:46 2467 [Note] Binlog end
2016-04-12 03:14:46 2467 [Note] InnoDB: FTSoptimize thread exiting.
2016-04-12 03:14:46 2467 [Note] InnoDB:Starting shutdown...
2016-04-12 03:14:48 2467 [Note] InnoDB:Shutdown completed; log sequence number 1625977
2016-04-12 03:14:49 0 [Warning] TIMESTAMPwith implicit DEFAULT value is deprecated. Please use--explicit_defaults_for_timestamp server option (see documentation for moredetails).
2016-04-12 03:14:49 0 [Note]/usr/sbin/mysqld (mysqld 5.6.28-ndb-7.4.10-cluster-gpl-log) starting as process2489 ...
2016-04-12 03:14:49 2489 [Note] InnoDB:Using atomics to ref count buffer pool pages
2016-04-12 03:14:49 2489 [Note] InnoDB: TheInnoDB memory heap is disabled
2016-04-12 03:14:49 2489 [Note] InnoDB:Mutexes and rw_locks use GCC atomic builtins
2016-04-12 03:14:49 2489 [Note] InnoDB:Memory barrier is not used
2016-04-12 03:14:49 2489 [Note] InnoDB:Compressed tables use zlib 1.2.3
2016-04-12 03:14:49 2489 [Note] InnoDB:Using Linux native AIO
2016-04-12 03:14:49 2489 [Note] InnoDB:Using CPU crc32 instructions
2016-04-12 03:14:49 2489 [Note] InnoDB:Initializing buffer pool, size = 128.0M
2016-04-12 03:14:49 2489 [Note] InnoDB:Completed initialization of buffer pool
2016-04-12 03:14:49 2489 [Note] InnoDB:Highest supported file format is Barracuda.
2016-04-12 03:14:49 2489 [Note] InnoDB: 128rollback segment(s) are active.
2016-04-12 03:14:49 2489 [Note] InnoDB:Waiting for purge to start
2016-04-12 03:14:49 2489 [Note] InnoDB:5.6.28 started; log sequence number 1625977
2016-04-12 03:14:49 2489 [Note] Binlog end
2016-04-12 03:14:49 2489 [Note] InnoDB: FTSoptimize thread exiting.
2016-04-12 03:14:49 2489 [Note] InnoDB:Starting shutdown...
2016-04-12 03:14:51 2489 [Note] InnoDB:Shutdown completed; log sequence number 1625987
A RANDOM PASSWORD HAS BEEN SET FOR THEMySQL root USER !
You will find that password in'/root/.mysql_secret'.
You must change that password on your firstconnect,
no other statement but 'SET PASSWORD' willbe accepted.
See the manual for the semantics of the'password expired' flag.
Also, the account for the anonymous userhas been removed.
In addition, you can run:
/usr/bin/mysql_secure_installation
which will also give you the option ofremoving the test database.
This is strongly recommended for productionservers.
See the manual for more instructions.
Please report any problems athttp://bugs.mysql.com/
The latest information about MySQL isavailable on the web at
http://www.mysql.com
Support MySQL by buying support/licenses athttp://shop.mysql.com
New default config file was created as/usr/my.cnf and
will be used by default by the server whenyou start it.
You may edit this file to change serversettings
WARNING: Default config file /etc/my.cnfexists on the system
This file will be read by default by theMySQL server
If you do not want to use this, eitherremove it, or use the
--defaults-file argument to mysqld_safewhen starting the server
安装client 包
[root@bogon temp]# rpm -ivhMySQL-Cluster-client-gpl-7.4.10-1.el6.x86_64.rpm
warning:MySQL-Cluster-client-gpl-7.4.10-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature,key ID 5072e1f5: NOKEY
Preparing... ###########################################[100%]
1:MySQL-Cluster-client-gp###########################################[100%]
初始化数据库:
[root@bogon bin]# mysql_install_db--defaults-file=/etc/my.cnf --datadir=/var/mysql/data/ --user=mysql
Installing MySQL system tables...2016-04-1203:19:08 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated.Please use --explicit_defaults_for_timestamp server option (see documentationfor more details).
2016-04-12 03:19:08 0 [Note]/usr/sbin/mysqld (mysqld 5.6.28-ndb-7.4.10-cluster-gpl-log) starting as process2542 ...
2016-04-12 03:19:09 2542 [Note] InnoDB:Using atomics to ref count buffer pool pages
2016-04-12 03:19:09 2542 [Note] InnoDB: TheInnoDB memory heap is disabled
2016-04-12 03:19:09 2542 [Note] InnoDB:Mutexes and rw_locks use GCC atomic builtins
2016-04-12 03:19:09 2542 [Note] InnoDB:Memory barrier is not used
2016-04-12 03:19:09 2542 [Note] InnoDB:Compressed tables use zlib 1.2.3
2016-04-12 03:19:09 2542 [Note] InnoDB:Using Linux native AIO
2016-04-12 03:19:09 2542 [Note] InnoDB:Using CPU crc32 instructions
2016-04-12 03:19:09 2542 [Note] InnoDB:Initializing buffer pool, size = 128.0M
2016-04-12 03:19:09 2542 [Note] InnoDB:Completed initialization of buffer pool
2016-04-12 03:19:09 2542 [Note] InnoDB:Highest supported file format is Barracuda.
2016-04-12 03:19:09 2542 [Note] InnoDB: 128rollback segment(s) are active.
2016-04-12 03:19:09 2542 [Note] InnoDB:Waiting for purge to start
2016-04-12 03:19:09 2542 [Note] InnoDB:5.6.28 started; log sequence number 1625987
2016-04-12 03:19:10 2542 [Note] Binlog end
2016-04-12 03:19:10 2542 [Note] InnoDB: FTSoptimize thread exiting.
2016-04-12 03:19:10 2542 [Note] InnoDB:Starting shutdown...
2016-04-12 03:19:11 2542 [Note] InnoDB:Shutdown completed; log sequence number 1625997
OK
Filling help tables...2016-04-12 03:19:11 0[Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use--explicit_defaults_for_timestamp server option (see documentation for moredetails).
2016-04-12 03:19:11 0 [Note] /usr/sbin/mysqld(mysqld 5.6.28-ndb-7.4.10-cluster-gpl-log) starting as process 2565 ...
2016-04-12 03:19:11 2565 [Note] InnoDB:Using atomics to ref count buffer pool pages
2016-04-12 03:19:11 2565 [Note] InnoDB: TheInnoDB memory heap is disabled
2016-04-12 03:19:11 2565 [Note] InnoDB:Mutexes and rw_locks use GCC atomic builtins
2016-04-12 03:19:11 2565 [Note] InnoDB:Memory barrier is not used
2016-04-12 03:19:11 2565 [Note] InnoDB:Compressed tables use zlib 1.2.3
2016-04-12 03:19:11 2565 [Note] InnoDB:Using Linux native AIO
2016-04-12 03:19:11 2565 [Note] InnoDB:Using CPU crc32 instructions
2016-04-12 03:19:11 2565 [Note] InnoDB:Initializing buffer pool, size = 128.0M
2016-04-12 03:19:11 2565 [Note] InnoDB:Completed initialization of buffer pool
2016-04-12 03:19:11 2565 [Note] InnoDB:Highest supported file format is Barracuda.
2016-04-12 03:19:11 2565 [Note] InnoDB: 128rollback segment(s) are active.
2016-04-12 03:19:11 2565 [Note] InnoDB:Waiting for purge to start
2016-04-12 03:19:11 2565 [Note] InnoDB:5.6.28 started; log sequence number 1625997
2016-04-12 03:19:11 2565 [Note] Binlog end
2016-04-12 03:19:11 2565 [Note] InnoDB: FTSoptimize thread exiting.
2016-04-12 03:19:11 2565 [Note] InnoDB:Starting shutdown...
2016-04-12 03:19:13 2565 [Note] InnoDB: Shutdowncompleted; log sequence number 1626007
OK
To start mysqld at boot time you have tocopy
support-files/mysql.server to the rightplace for your system
PLEASE REMEMBER TO SET A PASSWORD FOR THEMySQL root USER !
To do so, start the server, then issue thefollowing commands:
/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h bogon password 'new-password'
Alternatively you can run:
/usr/bin/mysql_secure_installation
which will also give you the option ofremoving the test
databases and anonymous user created bydefault. This is
strongly recommended for productionservers.
See the manual for more instructions.
You can start the MySQL daemon with:
cd/usr ; /usr/bin/mysqld_safe &
You can test the MySQL daemon withmysql-test-run.pl
cdmysql-test ; perl mysql-test-run.pl
Please report any problems athttp://bugs.mysql.com/
The latest information about MySQL isavailable on the web at
http://www.mysql.com
Support MySQL by buying support/licenses athttp://shop.mysql.com
WARNING: Found existing config file/usr/my.cnf on the system.
Because this file might be in use, it wasnot replaced,
but was used in bootstrap (unless you used--defaults-file)
and when you later start the server.
The new default config file was created as/usr/my-new.cnf,
please compare it with your file and takethe changes you need.
WARNING: Default config file /etc/my.cnfexists on the system
This file will be read by default by theMySQL server
If you do not want to use this, eitherremove it, or use the
--defaults-file argument to mysqld_safewhen starting the server
[root@bogon bin]#
启动sql 节点:
[root@bogon bin]# mysqld_safe--defaults-file=/etc/my.cnf --datadir=/var/mysql/data/ --user=mysql--explicit_defaults_for_timestamp &
[1] 2594
[root@bogon bin]# 160412 03:23:46mysqld_safe Logging to '/var/mysql/log/mysqld.log'.
160412 03:23:46 mysqld_safe Starting mysqlddaemon with databases from /var/mysql/data/
管理节点查看节点的状态:
ndb_mgm> show
Cluster Configuration
---------------------
[ndbd(NDB)] 3node(s)
id=3 @192.168.2.59 (mysql-5.6.28 ndb-7.4.10, Nodegroup: 0, *)
id=4 @192.168.2.61 (mysql-5.6.28 ndb-7.4.10, Nodegroup: 0)
id=5 @192.168.2.62 (mysql-5.6.28 ndb-7.4.10, Nodegroup: 0)
[ndb_mgmd(MGM)] 2 node(s)
id=1 @192.168.2.57 (mysql-5.6.28 ndb-7.4.10)
id=2 @192.168.2.60 (mysql-5.6.28 ndb-7.4.10)
[mysqld(API)] 4 node(s)
id=6 @192.168.2.64 (mysql-5.6.28 ndb-7.4.10)
id=7 @192.168.2.67 (mysql-5.6.28 ndb-7.4.10)
id=8 (not connected, accepting connect from192.168.2.65)
id=9 (not connected, accepting connect fromany host)
ndb_mgm>
1. 启动管理节点:ndb_mgmd-f /var/lib/mysql-cluster/config.ini
2. 启动存储节点:ndbd--initial
初次启动时需要加--initial参数,以后只需要执行ndbd即可;
2. 启动SQL节点:nohup mysqld_safe --explicit_defaults_for_timestamp &
SQL及存储节点的配置文件内容:
[CLIENT]
socket=/var/mysql/mysql.sock
[MYSQLD]
datadir=/var/mysql/data
user=mysql
#Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
log-bin = /var/mysql/log/mysql-bin.log
max_connections=1000
#run ndb storge engine
# Set Management node
ndbcluster
ndb-connectstring=192.168.2.57,192.168.2.60
[MYSQL_CLUSTER]
ndb-connectstring=192.168.2.57,192.168.2.60
[NDB_MGM]
connect-string=192.168.2.57,192.168.2.60
[MYSQLD_SAFE]
log-error=/var/mysql/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
管理节点集群的配置文件内容:
[NDBD DEFAULT]
#Options affecting ndbd processes on all data nodes:
NoOfReplicas=2 # Number of replicas
DataMemory=100M # How much memory to allocate for data storage
IndexMemory=50M # 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]
portnumber=3306
[NDB_MGMD]
nodeid=1 # Management process option
HostName=192.168.2.57 # Hostname or IP address of MGM node
DataDir=/var/lib/mysql-cluster # Directory for MGM node log files
[NDB_MGMD]
nodeid=2 # Management process option
HostName=192.168.2.60 # Hostname or IP address of MGM node
DataDir=/var/lib/mysql-cluster # Directory for MGM node log files
[NDBD]
nodeid=3 # Options for data node (one ndbd section per data node)
HostName=192.168.2.59 # Hostname or IP address
DataDir=/var/mysql/data # Directory for this data nodes data files
[NDBD]
nodeid=4 # Options for data node (one ndbd section per data node)
HostName=192.168.2.61 # Hostname or IP address
DataDir=/var/mysql/data # Directory for this data nodes data files
[NDBD]
nodeid=5 # Options for data node (one ndbd section per data node)
HostName=192.168.2.62 # Hostname or IP address
DataDir=/var/mysql/data # Directory for this data nodes data files
[MYSQLD]
nodeid=6 # SQL node options:
HostName=192.168.2.64 # Hostname or IP address
# (additional mysqld connections can be
# specified for this node for various
# purposes such as running ndb_restore)
[MYSQLD]
nodeid=7 # SQL node options:
HostName=192.168.2.67 # Hostname or IP address
# (additional mysqld connections can be
# specified for this node for various
# purposes such as running ndb_restore)
[MYSQLD]
nodeid=8
HostName=192.168.2.65
[MYSQLD]
nodeid=9