管理 (MGM)节点 : 这类节点的作用是管理 MySQL 集群内的其他节点,如提供配置数据、启动并停止节点、运行备份等。由于这类节点负责管理其他节点的配置,应在启动其 他 节点之前首先启动这类节点。
数据节点: 这类节点用于保存集群的数据。数据节点的数目与副本的数目相关,是片段的倍数。例如,对于两个副本,每个副本有两个片段,那么就有 4 个数据节点。
SQL 节点: 这是用来访问集群数据的节点。对于 MySQL 集群,客户端节点是使用 NDB 集群存储引擎的传统 MySQL 服务器。
#所有节点:
#mysql的集群安装可以有三种方式,一是直接下载二进制使用,二是使用rpm安装,三是源码编译。
#这里使用rpm安装,每种安装方式略有不同。
#rpm包安装注意安装后的命令目录
管理节点:
192.168.9.142
存储节点:
192.168.9.143
192.168.9.144
sql节点:
192.168.9.145
192.168.9.146
#下载:
MySQL-Cluster-gpl-7.3.6-2.el6.x86_64.rpm-bundle.tar
#清除原理机器上的mysql:
rpm -e --nodeps mysql-server-5.1.66-2.el6_3.x86_64
rpm -e --nodeps mysql-devel-5.1.66-2.el6_3.x86_64
rpm -e --nodeps mysql-libs-5.1.66-2.el6_3.x86_64
rpm -e --nodeps mysql-5.1.66-2.el6_3.x86_64
rpm -qa mysql*
#解压包:
cd /tmp
tar -xvf MySQL-Cluster-gpl-7.3.6-2.el6.x86_64.rpm-bundle.tar
#增加用户:
userdel mysql
groupadd mysql
useradd mysql -g mysql
#libaio包安装
rpm -ivh libaio-0.3.107-10.el6.x86_64.rpm
管理节点:
cd /tmp
[root@nagiosmysql1 tmp]# rpm -ivh MySQL-Cluster-server-gpl-7.3.6-2.el6.x86_64.rpm
Preparing... ########################################### [100%]
1:MySQL-Cluster-server-gp########################################### [100%]
#创建管理节点日志目录
mkdir /var/lib/mysql-cluster
chmod -R 1777 /var/lib/mysql-cluster
vi /var/lib/mysql-cluster/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]
portnumber=3306
[NDB_MGMD]
#设置管理节点服务器
nodeid=1 # Management process option
HostName=192.168.9.142 # Hostname or IP address of MGM node
DataDir=/var/lib/mysql-cluster # Directory for MGM node log files
[NDBD]
id=2 # Options for data node "A" (one [ndbd] section per data node)
HostName=192.168.9.143 # Hostname or IP address
DataDir=/var/mysql/data # Directory for this data node's data files
[NDBD]
id=3 # Options for data node "B" (one [ndbd] section per data node)
HostName=192.168.9.144 # Hostname or IP address
DataDir=/var/mysql/data # Directory for this data node's data files
[MYSQLD]
id=4 # SQL node options:
HostName=192.168.9.145 # Hostname or IP address
# (additional mysqld connections can be
# specified for this node for various
# purposes such as running ndb_restore)
[MYSQLD]
id=5 # SQL node options:
HostName=192.168.9.146 # Hostname or IP address
# (additional mysqld connections can be
# specified for this node for various
# purposes such as running ndb_restore)
#必须有空的mysqld节点,不然数据节点断开后启动有报错
[MYSQLD]
id=6
[mysqld]
id=7
#启动管理节点
[root@nagiosmysql1 tmp]# ndb_mgmd -f /var/lib/mysql-cluster/config.ini
MySQL Cluster Management Server mysql-5.6.19 ndb-7.3.6
[root@nagiosmysql1 tmp]# ndb_mgm
-- NDB Cluster -- Management Client --
ndb_mgm> show
Connected to Management Server at: localhost:1186
Cluster Configuration
---------------------
[ndbd(NDB)] 2 node(s)
id=2 @192.168.9.143 (mysql-5.6.19 ndb-7.3.6, Nodegroup: 0, *)
id=3 @192.168.9.144 (mysql-5.6.19 ndb-7.3.6, Nodegroup: 0)
[ndb_mgmd(MGM)] 1 node(s)
id=1 @192.168.9.142 (mysql-5.6.19 ndb-7.3.6)
[mysqld(API)] 4 node(s)
id=4 (not connected, accepting connect from 192.168.9.145)
id=5 (not connected, accepting connect from 192.168.9.146)
id=6 (not connected, accepting connect from any host)
id=7 (not connected, accepting connect from any host)
#存储节点:
#安装MySQL-Cluster-server-gpl-7.3.6-2.el6.x86_64.rpm包
cd /tmp
rpm -ivh MySQL-Cluster-server-gpl-7.3.6-2.el6.x86_64.rpm
rpm -qa| grep MySQL-Cluster-server
#创建存储目录
mkdir -p /var/mysql/data
chmod -R 1777 /var/mysql/data
#创建数据字典
[root@nagiosmysql2 tmp]# cd /usr/bin
[root@nagiosmysql2 bin]# ll | grep mysql
-rwxr-xr-x 1 root root 11608 7月 2 17:43 mysqlbug
-rwxr-xr-x 1 root root 4334 7月 2 17:43 mysql_convert_table_format
-rwxr-xr-x 1 root root 26356 7月 2 17:43 mysqld_multi
-rwxr-xr-x 1 root root 24691 7月 2 17:43 mysqld_safe
-rwxr-xr-x 1 root root 7424 7月 2 17:43 mysqldumpslow
-rwxr-xr-x 1 root root 1366 7月 2 17:43 mysql_fix_extensions
-rwxr-xr-x 1 root root 34852 7月 2 17:43 mysqlhotcopy
-rwxr-xr-x 1 root root 33889 7月 2 17:43 mysql_install_db
-rwxr-xr-x 1 root root 4971663 7月 2 17:44 mysql_plugin
-rwxr-xr-x 1 root root 10106 7月 2 17:43 mysql_secure_installation
-rwxr-xr-x 1 root root 17572 7月 2 17:43 mysql_setpermission
-rwxr-xr-x 1 root root 9546860 7月 2 17:45 mysqltest
-rwxr-xr-x 1 root root 4513946 7月 2 17:43 mysql_tzinfo_to_sql
-rwxr-xr-x 1 root root 5147706 7月 2 17:44 mysql_upgrade
-rwxr-xr-x 1 root root 3976 7月 2 17:43 mysql_zap
[root@nagiosmysql2 bin]# mysql_install_db --user=mysql --datadir=/var/mysql/data
WARNING: The host 'nagiosmysql2' could not be looked up with /usr/bin/resolveip.
This probably means that your libc libraries are not 100 % compatible
with this binary MySQL version. The MySQL daemon, mysqld, should work
normally with the exception that host name resolving will not work.
This means that you should use IP addresses instead of hostnames
when specifying MySQL privileges !
Installing MySQL system tables...2014-10-16 10:49:50 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2014-10-16 10:49:50 1065 [Note] InnoDB: Using atomics to ref count buffer pool pages
2014-10-16 10:49:50 1065 [Note] InnoDB: The InnoDB memory heap is disabled
2014-10-16 10:49:50 1065 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2014-10-16 10:49:50 1065 [Note] InnoDB: Compressed tables use zlib 1.2.3
2014-10-16 10:49:50 1065 [Note] InnoDB: Using Linux native AIO
2014-10-16 10:49:50 1065 [Note] InnoDB: Using CPU crc32 instructions
2014-10-16 10:49:50 1065 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2014-10-16 10:49:50 1065 [Note] InnoDB: Completed initialization of buffer pool
2014-10-16 10:49:50 1065 [Note] InnoDB: The first specified data file ./ibdata1 did not exist: a new database to be created!
2014-10-16 10:49:50 1065 [Note] InnoDB: Setting file ./ibdata1 size to 12 MB
2014-10-16 10:49:50 1065 [Note] InnoDB: Database physically writes the file full: wait...
2014-10-16 10:49:51 1065 [Note] InnoDB: Setting log file ./ib_logfile101 size to 48 MB
2014-10-16 10:49:56 1065 [Note] InnoDB: Setting log file ./ib_logfile1 size to 48 MB
2014-10-16 10:50:02 1065 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0
2014-10-16 10:50:02 1065 [Warning] InnoDB: New log files created, LSN=45781
2014-10-16 10:50:02 1065 [Note] InnoDB: Doublewrite buffer not found: creating new
2014-10-16 10:50:02 1065 [Note] InnoDB: Doublewrite buffer created
2014-10-16 10:50:02 1065 [Note] InnoDB: 128 rollback segment(s) are active.
2014-10-16 10:50:03 1065 [Warning] InnoDB: Creating foreign key constraint system tables.
2014-10-16 10:50:03 1065 [Note] InnoDB: Foreign key constraint system tables created
2014-10-16 10:50:03 1065 [Note] InnoDB: Creating tablespace and datafile system tables.
2014-10-16 10:50:03 1065 [Note] InnoDB: Tablespace and datafile system tables created.
2014-10-16 10:50:03 1065 [Note] InnoDB: Waiting for purge to start
2014-10-16 10:50:03 1065 [Note] InnoDB: 5.6.19 started; log sequence number 0
2014-10-16 10:50:17 1065 [Note] Binlog end
2014-10-16 10:50:17 1065 [Note] InnoDB: FTS optimize thread exiting.
2014-10-16 10:50:17 1065 [Note] InnoDB: Starting shutdown...
2014-10-16 10:50:18 1065 [Note] InnoDB: Shutdown completed; log sequence number 1625977
OK
Filling help tables...2014-10-16 10:50:18 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2014-10-16 10:50:18 1120 [Note] InnoDB: Using atomics to ref count buffer pool pages
2014-10-16 10:50:18 1120 [Note] InnoDB: The InnoDB memory heap is disabled
2014-10-16 10:50:18 1120 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2014-10-16 10:50:18 1120 [Note] InnoDB: Compressed tables use zlib 1.2.3
2014-10-16 10:50:18 1120 [Note] InnoDB: Using Linux native AIO
2014-10-16 10:50:18 1120 [Note] InnoDB: Using CPU crc32 instructions
2014-10-16 10:50:18 1120 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2014-10-16 10:50:18 1120 [Note] InnoDB: Completed initialization of buffer pool
2014-10-16 10:50:18 1120 [Note] InnoDB: Highest supported file format is Barracuda.
2014-10-16 10:50:18 1120 [Note] InnoDB: 128 rollback segment(s) are active.
2014-10-16 10:50:18 1120 [Note] InnoDB: Waiting for purge to start
2014-10-16 10:50:18 1120 [Note] InnoDB: 5.6.19 started; log sequence number 1625977
2014-10-16 10:50:19 1120 [Note] Binlog end
2014-10-16 10:50:19 1120 [Note] InnoDB: FTS optimize thread exiting.
2014-10-16 10:50:19 1120 [Note] InnoDB: Starting shutdown...
2014-10-16 10:50:20 1120 [Note] InnoDB: Shutdown completed; log sequence number 1625987
OK
To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h nagiosmysql2 password 'new-password'
Alternatively you can run:
/usr/bin/mysql_secure_installation
which will also give you the option of removing the test
databases and anonymous user created by default. This is
strongly recommended for production servers.
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 with mysql-test-run.pl
cd mysql-test ; perl mysql-test-run.pl
Please report any problems at http://bugs.mysql.com/
The latest information about MySQL is available on the web at
http://www.mysql.com
Support MySQL by buying support/licenses at http://shop.mysql.com
WARNING: Found existing config file /usr/my.cnf on the system.
Because this file might be in use, it was not 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 take the changes you need.
WARNING: Default config file /etc/my.cnf exists on the system
This file will be read by default by the MySQL server
If you do not want to use this, either remove it, or use the
--defaults-file argument to mysqld_safe when starting the server
#创建my.cnf配置文件
vi /etc/my.cnf
[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
#运行NDB存储引擎
#指定管理节点
ndbcluster
ndb-connectstring=192.168.9.142
[MYSQL_CLUSTER]
ndb-connectstring=192.168.9.142
[NDB_MGM]
connect-string=192.168.9.142
[MYSQLD_SAFE]
log-error=/var/mysql/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
启动ndbd服务
ndbd服务第一次启动时需要加上--initial选项,以后不需要
ndbd --initial
sql节点:
#安装server包和client包
cd /tmp
rpm -ivh MySQL-Cluster-server-gpl-7.3.6-2.el6.x86_64.rpm
rpm -ivh MySQL-Cluster-client-gpl-7.3.6-2.el6.x86_64.rpm
#安装数据库
cd /usr/bin
mysql_install_db --user=mysql --datadir=/var/mysql/data
启动SQL节点
mysqld_safe --user=mysql &
在管理节点上show信息:偶尔出现45连接,偶尔出现46连接,并且45,46上打开数据库时间非常长。
ndb_mgm> show
Connected to Management Server at: localhost:1186
Cluster Configuration
---------------------
[ndbd(NDB)] 2 node(s)
id=2 @192.168.9.143 (mysql-5.6.19 ndb-7.3.6, Nodegroup: 0, *)
id=3 @192.168.9.144 (mysql-5.6.19 ndb-7.3.6, Nodegroup: 0)
[ndb_mgmd(MGM)] 1 node(s)
id=1 @192.168.9.142 (mysql-5.6.19 ndb-7.3.6)
[mysqld(API)] 4 node(s)
id=4 @192.168.9.145 (mysql-5.6.19 ndb-7.3.6)
id=5 (not connected, accepting connect from 192.168.9.146)
id=6 (not connected, accepting connect from any host)
id=7 (not connected, accepting connect from any host)
ndb_mgm> show
Cluster Configuration
---------------------
[ndbd(NDB)] 2 node(s)
id=2 @192.168.9.143 (mysql-5.6.19 ndb-7.3.6, Nodegroup: 0, *)
id=3 @192.168.9.144 (mysql-5.6.19 ndb-7.3.6, Nodegroup: 0)
[ndb_mgmd(MGM)] 1 node(s)
id=1 @192.168.9.142 (mysql-5.6.19 ndb-7.3.6)
[mysqld(API)] 4 node(s)
id=4 (not connected, accepting connect from 192.168.9.145)
id=5 @192.168.9.146 (mysql-5.6.19 ndb-7.3.6)
id=6 (not connected, accepting connect from any host)
id=7 (not connected, accepting connect from any host)
彻底无语的结果。
数据节点: 这类节点用于保存集群的数据。数据节点的数目与副本的数目相关,是片段的倍数。例如,对于两个副本,每个副本有两个片段,那么就有 4 个数据节点。
SQL 节点: 这是用来访问集群数据的节点。对于 MySQL 集群,客户端节点是使用 NDB 集群存储引擎的传统 MySQL 服务器。
#所有节点:
#mysql的集群安装可以有三种方式,一是直接下载二进制使用,二是使用rpm安装,三是源码编译。
#这里使用rpm安装,每种安装方式略有不同。
#rpm包安装注意安装后的命令目录
管理节点:
192.168.9.142
存储节点:
192.168.9.143
192.168.9.144
sql节点:
192.168.9.145
192.168.9.146
#下载:
MySQL-Cluster-gpl-7.3.6-2.el6.x86_64.rpm-bundle.tar
#清除原理机器上的mysql:
rpm -e --nodeps mysql-server-5.1.66-2.el6_3.x86_64
rpm -e --nodeps mysql-devel-5.1.66-2.el6_3.x86_64
rpm -e --nodeps mysql-libs-5.1.66-2.el6_3.x86_64
rpm -e --nodeps mysql-5.1.66-2.el6_3.x86_64
rpm -qa mysql*
#解压包:
cd /tmp
tar -xvf MySQL-Cluster-gpl-7.3.6-2.el6.x86_64.rpm-bundle.tar
#增加用户:
userdel mysql
groupadd mysql
useradd mysql -g mysql
#libaio包安装
rpm -ivh libaio-0.3.107-10.el6.x86_64.rpm
管理节点:
cd /tmp
[root@nagiosmysql1 tmp]# rpm -ivh MySQL-Cluster-server-gpl-7.3.6-2.el6.x86_64.rpm
Preparing... ########################################### [100%]
1:MySQL-Cluster-server-gp########################################### [100%]
#创建管理节点日志目录
mkdir /var/lib/mysql-cluster
chmod -R 1777 /var/lib/mysql-cluster
vi /var/lib/mysql-cluster/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]
portnumber=3306
[NDB_MGMD]
#设置管理节点服务器
nodeid=1 # Management process option
HostName=192.168.9.142 # Hostname or IP address of MGM node
DataDir=/var/lib/mysql-cluster # Directory for MGM node log files
[NDBD]
id=2 # Options for data node "A" (one [ndbd] section per data node)
HostName=192.168.9.143 # Hostname or IP address
DataDir=/var/mysql/data # Directory for this data node's data files
[NDBD]
id=3 # Options for data node "B" (one [ndbd] section per data node)
HostName=192.168.9.144 # Hostname or IP address
DataDir=/var/mysql/data # Directory for this data node's data files
[MYSQLD]
id=4 # SQL node options:
HostName=192.168.9.145 # Hostname or IP address
# (additional mysqld connections can be
# specified for this node for various
# purposes such as running ndb_restore)
[MYSQLD]
id=5 # SQL node options:
HostName=192.168.9.146 # Hostname or IP address
# (additional mysqld connections can be
# specified for this node for various
# purposes such as running ndb_restore)
#必须有空的mysqld节点,不然数据节点断开后启动有报错
[MYSQLD]
id=6
[mysqld]
id=7
#启动管理节点
[root@nagiosmysql1 tmp]# ndb_mgmd -f /var/lib/mysql-cluster/config.ini
MySQL Cluster Management Server mysql-5.6.19 ndb-7.3.6
[root@nagiosmysql1 tmp]# ndb_mgm
-- NDB Cluster -- Management Client --
ndb_mgm> show
Connected to Management Server at: localhost:1186
Cluster Configuration
---------------------
[ndbd(NDB)] 2 node(s)
id=2 @192.168.9.143 (mysql-5.6.19 ndb-7.3.6, Nodegroup: 0, *)
id=3 @192.168.9.144 (mysql-5.6.19 ndb-7.3.6, Nodegroup: 0)
[ndb_mgmd(MGM)] 1 node(s)
id=1 @192.168.9.142 (mysql-5.6.19 ndb-7.3.6)
[mysqld(API)] 4 node(s)
id=4 (not connected, accepting connect from 192.168.9.145)
id=5 (not connected, accepting connect from 192.168.9.146)
id=6 (not connected, accepting connect from any host)
id=7 (not connected, accepting connect from any host)
#存储节点:
#安装MySQL-Cluster-server-gpl-7.3.6-2.el6.x86_64.rpm包
cd /tmp
rpm -ivh MySQL-Cluster-server-gpl-7.3.6-2.el6.x86_64.rpm
rpm -qa| grep MySQL-Cluster-server
#创建存储目录
mkdir -p /var/mysql/data
chmod -R 1777 /var/mysql/data
#创建数据字典
[root@nagiosmysql2 tmp]# cd /usr/bin
[root@nagiosmysql2 bin]# ll | grep mysql
-rwxr-xr-x 1 root root 11608 7月 2 17:43 mysqlbug
-rwxr-xr-x 1 root root 4334 7月 2 17:43 mysql_convert_table_format
-rwxr-xr-x 1 root root 26356 7月 2 17:43 mysqld_multi
-rwxr-xr-x 1 root root 24691 7月 2 17:43 mysqld_safe
-rwxr-xr-x 1 root root 7424 7月 2 17:43 mysqldumpslow
-rwxr-xr-x 1 root root 1366 7月 2 17:43 mysql_fix_extensions
-rwxr-xr-x 1 root root 34852 7月 2 17:43 mysqlhotcopy
-rwxr-xr-x 1 root root 33889 7月 2 17:43 mysql_install_db
-rwxr-xr-x 1 root root 4971663 7月 2 17:44 mysql_plugin
-rwxr-xr-x 1 root root 10106 7月 2 17:43 mysql_secure_installation
-rwxr-xr-x 1 root root 17572 7月 2 17:43 mysql_setpermission
-rwxr-xr-x 1 root root 9546860 7月 2 17:45 mysqltest
-rwxr-xr-x 1 root root 4513946 7月 2 17:43 mysql_tzinfo_to_sql
-rwxr-xr-x 1 root root 5147706 7月 2 17:44 mysql_upgrade
-rwxr-xr-x 1 root root 3976 7月 2 17:43 mysql_zap
[root@nagiosmysql2 bin]# mysql_install_db --user=mysql --datadir=/var/mysql/data
WARNING: The host 'nagiosmysql2' could not be looked up with /usr/bin/resolveip.
This probably means that your libc libraries are not 100 % compatible
with this binary MySQL version. The MySQL daemon, mysqld, should work
normally with the exception that host name resolving will not work.
This means that you should use IP addresses instead of hostnames
when specifying MySQL privileges !
Installing MySQL system tables...2014-10-16 10:49:50 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2014-10-16 10:49:50 1065 [Note] InnoDB: Using atomics to ref count buffer pool pages
2014-10-16 10:49:50 1065 [Note] InnoDB: The InnoDB memory heap is disabled
2014-10-16 10:49:50 1065 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2014-10-16 10:49:50 1065 [Note] InnoDB: Compressed tables use zlib 1.2.3
2014-10-16 10:49:50 1065 [Note] InnoDB: Using Linux native AIO
2014-10-16 10:49:50 1065 [Note] InnoDB: Using CPU crc32 instructions
2014-10-16 10:49:50 1065 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2014-10-16 10:49:50 1065 [Note] InnoDB: Completed initialization of buffer pool
2014-10-16 10:49:50 1065 [Note] InnoDB: The first specified data file ./ibdata1 did not exist: a new database to be created!
2014-10-16 10:49:50 1065 [Note] InnoDB: Setting file ./ibdata1 size to 12 MB
2014-10-16 10:49:50 1065 [Note] InnoDB: Database physically writes the file full: wait...
2014-10-16 10:49:51 1065 [Note] InnoDB: Setting log file ./ib_logfile101 size to 48 MB
2014-10-16 10:49:56 1065 [Note] InnoDB: Setting log file ./ib_logfile1 size to 48 MB
2014-10-16 10:50:02 1065 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0
2014-10-16 10:50:02 1065 [Warning] InnoDB: New log files created, LSN=45781
2014-10-16 10:50:02 1065 [Note] InnoDB: Doublewrite buffer not found: creating new
2014-10-16 10:50:02 1065 [Note] InnoDB: Doublewrite buffer created
2014-10-16 10:50:02 1065 [Note] InnoDB: 128 rollback segment(s) are active.
2014-10-16 10:50:03 1065 [Warning] InnoDB: Creating foreign key constraint system tables.
2014-10-16 10:50:03 1065 [Note] InnoDB: Foreign key constraint system tables created
2014-10-16 10:50:03 1065 [Note] InnoDB: Creating tablespace and datafile system tables.
2014-10-16 10:50:03 1065 [Note] InnoDB: Tablespace and datafile system tables created.
2014-10-16 10:50:03 1065 [Note] InnoDB: Waiting for purge to start
2014-10-16 10:50:03 1065 [Note] InnoDB: 5.6.19 started; log sequence number 0
2014-10-16 10:50:17 1065 [Note] Binlog end
2014-10-16 10:50:17 1065 [Note] InnoDB: FTS optimize thread exiting.
2014-10-16 10:50:17 1065 [Note] InnoDB: Starting shutdown...
2014-10-16 10:50:18 1065 [Note] InnoDB: Shutdown completed; log sequence number 1625977
OK
Filling help tables...2014-10-16 10:50:18 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2014-10-16 10:50:18 1120 [Note] InnoDB: Using atomics to ref count buffer pool pages
2014-10-16 10:50:18 1120 [Note] InnoDB: The InnoDB memory heap is disabled
2014-10-16 10:50:18 1120 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2014-10-16 10:50:18 1120 [Note] InnoDB: Compressed tables use zlib 1.2.3
2014-10-16 10:50:18 1120 [Note] InnoDB: Using Linux native AIO
2014-10-16 10:50:18 1120 [Note] InnoDB: Using CPU crc32 instructions
2014-10-16 10:50:18 1120 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2014-10-16 10:50:18 1120 [Note] InnoDB: Completed initialization of buffer pool
2014-10-16 10:50:18 1120 [Note] InnoDB: Highest supported file format is Barracuda.
2014-10-16 10:50:18 1120 [Note] InnoDB: 128 rollback segment(s) are active.
2014-10-16 10:50:18 1120 [Note] InnoDB: Waiting for purge to start
2014-10-16 10:50:18 1120 [Note] InnoDB: 5.6.19 started; log sequence number 1625977
2014-10-16 10:50:19 1120 [Note] Binlog end
2014-10-16 10:50:19 1120 [Note] InnoDB: FTS optimize thread exiting.
2014-10-16 10:50:19 1120 [Note] InnoDB: Starting shutdown...
2014-10-16 10:50:20 1120 [Note] InnoDB: Shutdown completed; log sequence number 1625987
OK
To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h nagiosmysql2 password 'new-password'
Alternatively you can run:
/usr/bin/mysql_secure_installation
which will also give you the option of removing the test
databases and anonymous user created by default. This is
strongly recommended for production servers.
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 with mysql-test-run.pl
cd mysql-test ; perl mysql-test-run.pl
Please report any problems at http://bugs.mysql.com/
The latest information about MySQL is available on the web at
http://www.mysql.com
Support MySQL by buying support/licenses at http://shop.mysql.com
WARNING: Found existing config file /usr/my.cnf on the system.
Because this file might be in use, it was not 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 take the changes you need.
WARNING: Default config file /etc/my.cnf exists on the system
This file will be read by default by the MySQL server
If you do not want to use this, either remove it, or use the
--defaults-file argument to mysqld_safe when starting the server
#创建my.cnf配置文件
vi /etc/my.cnf
[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
#运行NDB存储引擎
#指定管理节点
ndbcluster
ndb-connectstring=192.168.9.142
[MYSQL_CLUSTER]
ndb-connectstring=192.168.9.142
[NDB_MGM]
connect-string=192.168.9.142
[MYSQLD_SAFE]
log-error=/var/mysql/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
启动ndbd服务
ndbd服务第一次启动时需要加上--initial选项,以后不需要
ndbd --initial
sql节点:
#安装server包和client包
cd /tmp
rpm -ivh MySQL-Cluster-server-gpl-7.3.6-2.el6.x86_64.rpm
rpm -ivh MySQL-Cluster-client-gpl-7.3.6-2.el6.x86_64.rpm
mkdir -p /var/run/mysqld/
chmod -R 777 /var/run/mysqld/
#安装数据库
cd /usr/bin
mysql_install_db --user=mysql --datadir=/var/mysql/data
启动SQL节点
mysqld_safe --user=mysql &
注意顺序。
1. 启动管理节点:ndb_mgmd -f /var/lib/mysql-cluster/config.ini
2. 启动存储节点:ndbd --initial
初次启动时需要加--initial参数,以后只需要执行ndbd即可;
3. 启动SQL节点:nohup mysqld_safe --explicit_defaults_for_timestamp &
最后结果:失败。
在管理节点上show信息:偶尔出现45连接,偶尔出现46连接,并且45,46上打开数据库时间非常长。
ndb_mgm> show
Connected to Management Server at: localhost:1186
Cluster Configuration
---------------------
[ndbd(NDB)] 2 node(s)
id=2 @192.168.9.143 (mysql-5.6.19 ndb-7.3.6, Nodegroup: 0, *)
id=3 @192.168.9.144 (mysql-5.6.19 ndb-7.3.6, Nodegroup: 0)
[ndb_mgmd(MGM)] 1 node(s)
id=1 @192.168.9.142 (mysql-5.6.19 ndb-7.3.6)
[mysqld(API)] 4 node(s)
id=4 @192.168.9.145 (mysql-5.6.19 ndb-7.3.6)
id=5 (not connected, accepting connect from 192.168.9.146)
id=6 (not connected, accepting connect from any host)
id=7 (not connected, accepting connect from any host)
ndb_mgm> show
Cluster Configuration
---------------------
[ndbd(NDB)] 2 node(s)
id=2 @192.168.9.143 (mysql-5.6.19 ndb-7.3.6, Nodegroup: 0, *)
id=3 @192.168.9.144 (mysql-5.6.19 ndb-7.3.6, Nodegroup: 0)
[ndb_mgmd(MGM)] 1 node(s)
id=1 @192.168.9.142 (mysql-5.6.19 ndb-7.3.6)
[mysqld(API)] 4 node(s)
id=4 (not connected, accepting connect from 192.168.9.145)
id=5 @192.168.9.146 (mysql-5.6.19 ndb-7.3.6)
id=6 (not connected, accepting connect from any host)
id=7 (not connected, accepting connect from any host)
彻底无语的结果。
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/29500582/viewspace-1300700/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/29500582/viewspace-1300700/