由于前面写过ndb 7.4.11的安装:
官方对NDB 7.4 的安装文档:
https://dev.mysql.com/doc/refman/5.6/en/mysql-cluster-install-linux-rpm.html
所以本文只是粗略的总结一下不同以及异常处理,大体的步骤其实是一样的。
————————————————
一、上传并解压安装介质:
在官方,其实已经找不到7.4.12的安装介质了,我将自己提前下好的介质上传了,方便下载:
链接:http://pan.baidu.com/s/1bpMQcNH 密码:v0cp
服务器上的操作:上传与解压
[root@ndb1-1 ~]# ls -ltr /software/mysql_cluster/ total 351420 -rw-r--r-- 1 root root 359854080 Feb 24 21:19 MySQL-Cluster-gpl-7.4.12-1.el6.x86_64.rpm-bundle.tar [root@ndb1-1 ~]# cd /software/mysql_cluster/ [root@ndb1-1 mysql_cluster]# tar -xf M* [root@ndb1-1 mysql_cluster]# ls MySQL-Cluster-client-gpl-7.4.12-1.el6.x86_64.rpm MySQL-Cluster-gpl-7.4.12-1.el6.x86_64.rpm-bundle.tar MySQL-Cluster-shared-gpl-7.4.12-1.el6.x86_64.rpm MySQL-Cluster-devel-gpl-7.4.12-1.el6.x86_64.rpm MySQL-Cluster-server-gpl-7.4.12-1.el6.x86_64.rpm MySQL-Cluster-test-gpl-7.4.12-1.el6.x86_64.rpm MySQL-Cluster-embedded-gpl-7.4.12-1.el6.x86_64.rpm MySQL-Cluster-shared-compat-gpl-7.4.12-1.el6.x86_64.rpm [root@ndb1-1 mysql_cluster]#
制作YUM本地源:
[root@ndb1-1 mysql_cluster]# createrepo /software/mysql_cluster/ Spawning worker 0 with 7 pkgs Workers Finished Saving Primary metadata Saving file lists metadata Saving other metadata Generating sqlite DBs Sqlite DBs complete [root@ndb1-1 mysql_cluster]# [root@ndb1-1 mysql_cluster]# cat /etc/yum.repos.d/local_yum_mysql_cluster.repo [local_rpm_mysql_cluster] name=local_mysql_cluster baseurl=file:///software/mysql_cluster/ gpgcheck=0 [root@ndb1-1 mysql_cluster]#
查看一下当前的YUM源列表:
[root@ndb1-1 mysql_cluster]# yum repolist Loaded plugins: fastestmirror, langpacks ISO | 3.6 kB 00:00:00 base | 3.6 kB 00:00:00 extras | 3.4 kB 00:00:00 local_rpm_mysql_cluster | 2.9 kB 00:00:00 updates | 3.4 kB 00:00:00 local_rpm_mysql_cluster/primary_db | 10 kB 00:00:00 Loading mirror speeds from cached hostfile * base: mirrors.163.com * extras: mirrors.163.com * updates: mirrors.163.com repo id repo name status ISO ISO 8,652 base/7/x86_64 CentOS-7 - Base 9,363 extras/7/x86_64 CentOS-7 - Extras 264 local_rpm_mysql_cluster local_mysql_cluster 7 updates/7/x86_64 CentOS-7 - Updates 856 repolist: 19,142 [root@ndb1-1 mysql_cluster]#
二、MySQL Cluster:安装
查看是否有冲突包:
1. rpm -qa | grep mysql
2. rpm -qa | grep mariadb
[root@ndb1-1 mysql_cluster]# yum list | grep mariadb mariadb-libs.x86_64 1:5.5.41-2.el7_0 @anaconda mariadb.x86_64 1:5.5.52-1.el7 base mariadb-bench.x86_64 1:5.5.52-1.el7 base mariadb-devel.i686 1:5.5.52-1.el7 base mariadb-devel.x86_64 1:5.5.52-1.el7 base mariadb-embedded.i686 1:5.5.52-1.el7 base mariadb-embedded.x86_64 1:5.5.52-1.el7 base mariadb-embedded-devel.i686 1:5.5.52-1.el7 base mariadb-embedded-devel.x86_64 1:5.5.52-1.el7 base mariadb-libs.i686 1:5.5.52-1.el7 base mariadb-libs.x86_64 1:5.5.52-1.el7 base mariadb-server.x86_64 1:5.5.52-1.el7 base mariadb-test.x86_64 1:5.5.52-1.el7 base [root@ndb1-1 mysql_cluster]# [root@ndb1-1 mysql_cluster]# rpm -qa | grep mariadb mariadb-libs-5.5.41-2.el7_0.x86_64 [root@ndb1-1 mysql_cluster]# [root@ndb1-1 mysql_cluster]#
冲突包,需要清理掉【删除】。
否则会出现一些问题,像这样:
[root@ndb1-1 mysql_cluster]# yum install -y MySQL-Cluster-server-gpl Loaded plugins: fastestmirror, langpacks Loading mirror speeds from cached hostfile * base: mirrors.163.com * extras: mirrors.163.com * updates: mirrors.163.com Resolving Dependencies --> Running transaction check ---> Package MySQL-Cluster-server-gpl.x86_64 0:7.4.12-1.el6 will be installed --> Finished Dependency Resolution Dependencies Resolved =============================================================================================================================================================================== Package Arch Version Repository Size =============================================================================================================================================================================== Installing: MySQL-Cluster-server-gpl x86_64 7.4.12-1.el6 local_rpm_mysql_cluster 149 M Transaction Summary =============================================================================================================================================================================== Install 1 Package Total download size: 149 M Installed size: 639 M Downloading packages: Running transaction check Running transaction test Transaction check error: file /usr/share/mysql/charsets/README from install of MySQL-Cluster-server-gpl-7.4.12-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.41-2.el7_0.x86_64 file /usr/share/mysql/czech/errmsg.sys from install of MySQL-Cluster-server-gpl-7.4.12-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.41-2.el7_0.x86_64 file /usr/share/mysql/danish/errmsg.sys from install of MySQL-Cluster-server-gpl-7.4.12-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.41-2.el7_0.x86_64 file /usr/share/mysql/dutch/errmsg.sys from install of MySQL-Cluster-server-gpl-7.4.12-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.41-2.el7_0.x86_64 file /usr/share/mysql/english/errmsg.sys from install of MySQL-Cluster-server-gpl-7.4.12-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.41-2.el7_0.x86_64 file /usr/share/mysql/estonian/errmsg.sys from install of MySQL-Cluster-server-gpl-7.4.12-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.41-2.el7_0.x86_64 file /usr/share/mysql/french/errmsg.sys from install of MySQL-Cluster-server-gpl-7.4.12-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.41-2.el7_0.x86_64 file /usr/share/mysql/german/errmsg.sys from install of MySQL-Cluster-server-gpl-7.4.12-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.41-2.el7_0.x86_64 file /usr/share/mysql/greek/errmsg.sys from install of MySQL-Cluster-server-gpl-7.4.12-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.41-2.el7_0.x86_64 file /usr/share/mysql/hungarian/errmsg.sys from install of MySQL-Cluster-server-gpl-7.4.12-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.41-2.el7_0.x86_64 file /usr/share/mysql/italian/errmsg.sys from install of MySQL-Cluster-server-gpl-7.4.12-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.41-2.el7_0.x86_64 file /usr/share/mysql/japanese/errmsg.sys from install of MySQL-Cluster-server-gpl-7.4.12-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.41-2.el7_0.x86_64 file /usr/share/mysql/korean/errmsg.sys from install of MySQL-Cluster-server-gpl-7.4.12-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.41-2.el7_0.x86_64 file /usr/share/mysql/norwegian-ny/errmsg.sys from install of MySQL-Cluster-server-gpl-7.4.12-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.41-2.el7_0.x86_64 file /usr/share/mysql/norwegian/errmsg.sys from install of MySQL-Cluster-server-gpl-7.4.12-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.41-2.el7_0.x86_64 file /usr/share/mysql/polish/errmsg.sys from install of MySQL-Cluster-server-gpl-7.4.12-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.41-2.el7_0.x86_64 file /usr/share/mysql/portuguese/errmsg.sys from install of MySQL-Cluster-server-gpl-7.4.12-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.41-2.el7_0.x86_64 file /usr/share/mysql/romanian/errmsg.sys from install of MySQL-Cluster-server-gpl-7.4.12-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.41-2.el7_0.x86_64 file /usr/share/mysql/russian/errmsg.sys from install of MySQL-Cluster-server-gpl-7.4.12-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.41-2.el7_0.x86_64 file /usr/share/mysql/serbian/errmsg.sys from install of MySQL-Cluster-server-gpl-7.4.12-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.41-2.el7_0.x86_64 file /usr/share/mysql/slovak/errmsg.sys from install of MySQL-Cluster-server-gpl-7.4.12-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.41-2.el7_0.x86_64 file /usr/share/mysql/spanish/errmsg.sys from install of MySQL-Cluster-server-gpl-7.4.12-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.41-2.el7_0.x86_64 file /usr/share/mysql/swedish/errmsg.sys from install of MySQL-Cluster-server-gpl-7.4.12-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.41-2.el7_0.x86_64 file /usr/share/mysql/ukrainian/errmsg.sys from install of MySQL-Cluster-server-gpl-7.4.12-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.41-2.el7_0.x86_64 file /usr/share/mysql/charsets/Index.xml from install of MySQL-Cluster-server-gpl-7.4.12-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.41-2.el7_0.x86_64 file /usr/share/mysql/charsets/armscii8.xml from install of MySQL-Cluster-server-gpl-7.4.12-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.41-2.el7_0.x86_64 file /usr/share/mysql/charsets/ascii.xml from install of MySQL-Cluster-server-gpl-7.4.12-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.41-2.el7_0.x86_64 file /usr/share/mysql/charsets/cp1250.xml from install of MySQL-Cluster-server-gpl-7.4.12-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.41-2.el7_0.x86_64 file /usr/share/mysql/charsets/cp1251.xml from install of MySQL-Cluster-server-gpl-7.4.12-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.41-2.el7_0.x86_64 file /usr/share/mysql/charsets/cp1256.xml from install of MySQL-Cluster-server-gpl-7.4.12-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.41-2.el7_0.x86_64 file /usr/share/mysql/charsets/cp1257.xml from install of MySQL-Cluster-server-gpl-7.4.12-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.41-2.el7_0.x86_64 file /usr/share/mysql/charsets/cp850.xml from install of MySQL-Cluster-server-gpl-7.4.12-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.41-2.el7_0.x86_64 file /usr/share/mysql/charsets/cp852.xml from install of MySQL-Cluster-server-gpl-7.4.12-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.41-2.el7_0.x86_64 file /usr/share/mysql/charsets/cp866.xml from install of MySQL-Cluster-server-gpl-7.4.12-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.41-2.el7_0.x86_64 file /usr/share/mysql/charsets/dec8.xml from install of MySQL-Cluster-server-gpl-7.4.12-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.41-2.el7_0.x86_64 file /usr/share/mysql/charsets/geostd8.xml from install of MySQL-Cluster-server-gpl-7.4.12-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.41-2.el7_0.x86_64 file /usr/share/mysql/charsets/greek.xml from install of MySQL-Cluster-server-gpl-7.4.12-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.41-2.el7_0.x86_64 file /usr/share/mysql/charsets/hebrew.xml from install of MySQL-Cluster-server-gpl-7.4.12-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.41-2.el7_0.x86_64 file /usr/share/mysql/charsets/hp8.xml from install of MySQL-Cluster-server-gpl-7.4.12-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.41-2.el7_0.x86_64 file /usr/share/mysql/charsets/keybcs2.xml from install of MySQL-Cluster-server-gpl-7.4.12-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.41-2.el7_0.x86_64 file /usr/share/mysql/charsets/koi8r.xml from install of MySQL-Cluster-server-gpl-7.4.12-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.41-2.el7_0.x86_64 file /usr/share/mysql/charsets/koi8u.xml from install of MySQL-Cluster-server-gpl-7.4.12-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.41-2.el7_0.x86_64 file /usr/share/mysql/charsets/latin1.xml from install of MySQL-Cluster-server-gpl-7.4.12-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.41-2.el7_0.x86_64 file /usr/share/mysql/charsets/latin2.xml from install of MySQL-Cluster-server-gpl-7.4.12-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.41-2.el7_0.x86_64 file /usr/share/mysql/charsets/latin5.xml from install of MySQL-Cluster-server-gpl-7.4.12-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.41-2.el7_0.x86_64 file /usr/share/mysql/charsets/latin7.xml from install of MySQL-Cluster-server-gpl-7.4.12-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.41-2.el7_0.x86_64 file /usr/share/mysql/charsets/macce.xml from install of MySQL-Cluster-server-gpl-7.4.12-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.41-2.el7_0.x86_64 file /usr/share/mysql/charsets/macroman.xml from install of MySQL-Cluster-server-gpl-7.4.12-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.41-2.el7_0.x86_64 file /usr/share/mysql/charsets/swe7.xml from install of MySQL-Cluster-server-gpl-7.4.12-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.41-2.el7_0.x86_64 Error Summary ------------- [root@ndb1-1 mysql_cluster]#
清理方式:
[root@ndb1-1 mysql_cluster]# yum remove mariadb-libs Loaded plugins: fastestmirror, langpacks Resolving Dependencies --> Running transaction check ---> Package mariadb-libs.x86_64 1:5.5.41-2.el7_0 will be erased --> Processing Dependency: libmysqlclient.so.18()(64bit) for package: 2:postfix-2.10.1-6.el7.x86_64 --> Processing Dependency: libmysqlclient.so.18(libmysqlclient_18)(64bit) for package: 2:postfix-2.10.1-6.el7.x86_64 --> Running transaction check ---> Package postfix.x86_64 2:2.10.1-6.el7 will be erased --> Finished Dependency Resolution Dependencies Resolved =============================================================================================================================================================================== Package Arch Version Repository Size =============================================================================================================================================================================== Removing: mariadb-libs x86_64 1:5.5.41-2.el7_0 @anaconda 4.4 M Removing for dependencies: postfix x86_64 2:2.10.1-6.el7 @anaconda 12 M Transaction Summary =============================================================================================================================================================================== Remove 1 Package (+1 Dependent package) Installed size: 17 M Is this ok [y/N]: y Downloading packages: Running transaction check Running transaction test Transaction test succeeded Running transaction Erasing : 2:postfix-2.10.1-6.el7.x86_64 1/2 Erasing : 1:mariadb-libs-5.5.41-2.el7_0.x86_64 2/2 Verifying : 1:mariadb-libs-5.5.41-2.el7_0.x86_64 1/2 Verifying : 2:postfix-2.10.1-6.el7.x86_64 2/2 Removed: mariadb-libs.x86_64 1:5.5.41-2.el7_0 Dependency Removed: postfix.x86_64 2:2.10.1-6.el7 Complete! [root@ndb1-1 mysql_cluster]#
或者:
rpm -e –nodeps xxx
也是可行的,如果有依赖包,那么可以选择【nodeps】也可以选择像上面那样,用YUM卸载。
对于数据节点(Data Node)
MySQL-cluster-server-gpl
yum install -y MySQL-Cluster-server-gpl
[root@ndb1-1 mysql_cluster]# yum install -y MySQL-Cluster-server-gpl Loaded plugins: fastestmirror, langpacks Loading mirror speeds from cached hostfile * base: mirrors.163.com * extras: mirrors.163.com * updates: mirrors.163.com Resolving Dependencies --> Running transaction check ---> Package MySQL-Cluster-server-gpl.x86_64 0:7.4.12-1.el6 will be installed --> Finished Dependency Resolution Dependencies Resolved =============================================================================================================================================================================== Package Arch Version Repository Size =============================================================================================================================================================================== Installing: MySQL-Cluster-server-gpl x86_64 7.4.12-1.el6 local_rpm_mysql_cluster 149 M Transaction Summary =============================================================================================================================================================================== Install 1 Package Total download size: 149 M Installed size: 639 M Downloading packages: Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : MySQL-Cluster-server-gpl-7.4.12-1.el6.x86_64 1/1 warning: user mysql does not exist - using root warning: group mysql does not exist - using root FATAL ERROR: please install the following Perl modules before executing /usr/bin/mysql_install_db: Data::Dumper Verifying : MySQL-Cluster-server-gpl-7.4.12-1.el6.x86_64 1/1 Installed: MySQL-Cluster-server-gpl.x86_64 0:7.4.12-1.el6 Complete! [root@ndb1-1 mysql_cluster]# [root@ndb1-1 mysql_cluster]# whereis ndbd ndbd: /usr/sbin/ndbd /usr/share/man/man8/ndbd.8.gz [root@ndb1-1 mysql_cluster]# [root@ndb1-1 mysql_cluster]# whereis ndbmtd ndbmtd: /usr/sbin/ndbmtd /usr/share/man/man8/ndbmtd.8.gz [root@ndb1-1 mysql_cluster]#
对于SQL节点(SQL Node)
MySQL-cluster-server-gpl
MySQL-Cluster-client-gpl
yum install -y MySQL-Cluster-server-gpl MySQL-Cluster-client-gpl
[root@ndb1-1 mysql_cluster]# yum install -y MySQL-Cluster-server-gpl MySQL-Cluster-client-gpl Loaded plugins: fastestmirror, langpacks Loading mirror speeds from cached hostfile * base: mirrors.163.com * extras: mirrors.163.com * updates: mirrors.163.com Package MySQL-Cluster-server-gpl-7.4.12-1.el6.x86_64 already installed and latest version Resolving Dependencies --> Running transaction check ---> Package MySQL-Cluster-client-gpl.x86_64 0:7.4.12-1.el6 will be installed --> Finished Dependency Resolution Dependencies Resolved =============================================================================================================================================================================== Package Arch Version Repository Size =============================================================================================================================================================================== Installing: MySQL-Cluster-client-gpl x86_64 7.4.12-1.el6 local_rpm_mysql_cluster 18 M Transaction Summary =============================================================================================================================================================================== Install 1 Package Total download size: 18 M Installed size: 83 M Downloading packages: Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : MySQL-Cluster-client-gpl-7.4.12-1.el6.x86_64 1/1 Verifying : MySQL-Cluster-client-gpl-7.4.12-1.el6.x86_64 1/1 Installed: MySQL-Cluster-client-gpl.x86_64 0:7.4.12-1.el6 Complete! [root@ndb1-1 mysql_cluster]# [root@ndb1-1 mysql_cluster]# whereis mysqld mysqld: /usr/sbin/mysqld /usr/share/man/man8/mysqld.8.gz [root@ndb1-1 mysql_cluster]# [root@ndb1-1 mysql_cluster]# whereis mysqld_safe mysqld_safe: /usr/bin/mysqld_safe /usr/share/man/man1/mysqld_safe.1.gz [root@ndb1-1 mysql_cluster]#
对于管理节点(Management Node)
MySQL-cluster-server-gpl
安装后检查:
[root@ndb1-1 mysql_cluster]# whereis ndb_mgmd ndb_mgmd: /usr/sbin/ndb_mgmd /usr/share/man/man8/ndb_mgmd.8.gz [root@ndb1-1 mysql_cluster]#
这样,MySQL Cluster的安装就结束了。
三、MySQL Cluster【NDB】:配置
在我当前要配置的环境里有只有两个服务器,它们在NDB中的角色分配如下:
Management:ndb_mgmd
ndb1-1
Data Node:ndbd
ndb1-1
ndb1-2
SQL Node:mysqld
ndb1-1
ndb1-2
所有节点:
创建需要的目录结构:
[root@ndb1-1 mysql_cluster]# mkdir -p /db/mysql_data/{db_data,log_data,plugin_data,binlog_data,run_data,ndbd_data,mgmd_data,conf_data} [root@ndb1-1 mysql_cluster]# [root@ndb1-1 mysql_cluster]# chown -R mysql.mysql /db/mysql_data/ [root@ndb1-1 mysql_cluster]#
文件:/etc/my.cnf【数据节点、SQL节点】
[root@ndb1-1 mysql_cluster]# cat /etc/my.cnf [mysqld] ndbcluster datadir=/db/mysql_data/db_data plugin-dir=/db/mysql_data/plugin_data log-bin=/db/mysql_data/binlog_data/bingo_mysql pid-file=/db/mysql_data/run_data/mysql.pid log-error=/db/mysql_data/log_data/mysql-error.log user=mysql [mysql_cluster] ndb-connectstring=10.158.1.116 [root@ndb1-1 mysql_cluster]#
文件:/db/mysql_data/conf_data/mysql-cluster-7.4.12-config.ini
[root@ndb1-1 mysql_cluster]# cat /db/mysql_data/conf_data/mysql-cluster-7.4.12-config.ini [ndbd default] NoOfReplicas=2 DataMemory=2048M IndexMemory=80M [tcp default] portnumber=2202 [ndb_mgmd] hostname=10.158.1.116 datadir=/db/mysql_data/mgmd_data [ndbd] hostname=10.158.1.116 datadir=/db/mysql_data/ndbd_data [ndbd] hostname=10.158.1.132 datadir=/db/mysql_data/ndbd_data [mysqld] hostname=10.158.1.116 [mysqld] hostname=10.158.1.132 [root@ndb1-1 mysql_cluster]#
四、MySQL Cluster【ndb】:启动
管理:
[root@ndb1-1 mysql_cluster]# ndb_mgmd -f /db/mysql_data/conf_data/mysql-cluster-7.4.12-config.ini --initial MySQL Cluster Management Server mysql-5.6.31 ndb-7.4.12 2017-02-28 11:29:42 [MgmtSrvr] WARNING -- at line 53: Cluster configuration warning: arbitrator with id 1 and db node with id 3 on same host 10.158.1.116 Running arbitrator on the same host as a database node may cause complete cluster shutdown in case of host failure. [root@ndb1-1 mysql_cluster]# [root@ndb1-1 mysql_cluster]# ps -ef | grep ndb_mgmd root 3666 1 0 11:29 ? 00:00:03 ndb_mgmd -f /db/mysql_data/conf_data/mysql-cluster-7.4.12-config.ini --initial root 7662 2094 0 11:36 pts/0 00:00:00 grep --color=auto ndb_mgmd [root@ndb1-1 mysql_cluster]# [root@ndb1-1 mysql_cluster]# netstat -tupln | grep ndb_mgmd tcp 0 0 0.0.0.0:1186 0.0.0.0:* LISTEN 3666/ndb_mgmd [root@ndb1-1 mysql_cluster]#
数据节点:
[root@ndb1-1 mysql_cluster]# ndbd 2017-02-28 11:51:56 [ndbd] INFO -- Angel connected to '10.158.1.116:1186' 2017-02-28 11:51:56 [ndbd] INFO -- Angel allocated nodeid: 2 [root@ndb1-1 mysql_cluster]#
SQL节点:
初始化数据库
[root@ndb1-1 mysql_data]# pwd /db/mysql_data [root@ndb1-1 mysql_data]# ls -ltr db_data/ total 0 [root@ndb1-1 mysql_data]# ls -ltr plugin_data/ total 0 [root@ndb1-1 mysql_data]# ls -ltr binlog_data/ total 0 [root@ndb1-1 mysql_data]# [root@ndb1-1 mysql_data]# mysql_install_db --defaults-file=/etc/my.cnf --user=mysql Installing MySQL system tables...2017-02-28 13:31:00 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). 2017-02-28 13:31:00 0 [Note] /usr/sbin/mysqld (mysqld 5.6.31-ndb-7.4.12-cluster-gpl-log) starting as process 14565 ... OK Filling help tables...2017-02-28 13:31:09 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). 2017-02-28 13:31:09 0 [Note] /usr/sbin/mysqld (mysqld 5.6.31-ndb-7.4.12-cluster-gpl-log) starting as process 14587 ... 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 ndb1-1 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 New default config file was created as /usr/my.cnf and will be used by default by the server when you start it. You may edit this file to change server settings 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 [root@ndb1-1 mysql_data]# [root@ndb1-1 mysql_data]# ls -ltr db_data/ total 110604 drwx------ 2 mysql mysql 6 Feb 28 13:30 test -rw-rw---- 1 mysql mysql 50331648 Feb 28 13:31 ib_logfile1 drwx------ 2 mysql mysql 4096 Feb 28 13:31 performance_schema drwx------ 2 mysql mysql 4096 Feb 28 13:31 mysql drwx------ 2 mysql mysql 4096 Feb 28 13:31 ndbinfo -rw-rw---- 1 mysql mysql 50331648 Feb 28 13:31 ib_logfile0 -rw-rw---- 1 mysql mysql 12582912 Feb 28 13:31 ibdata1 [root@ndb1-1 mysql_data]# [root@ndb1-1 mysql_data]# ls -ltr plugin_data/ total 0 [root@ndb1-1 mysql_data]# ls -ltr binlog_data/ total 1460 -rw-rw---- 1 mysql mysql 121222 Feb 28 13:31 bingo_mysql.000001 -rw-rw---- 1 mysql mysql 92 Feb 28 13:31 bingo_mysql.index -rw-rw---- 1 mysql mysql 1364877 Feb 28 13:31 bingo_mysql.000002 [root@ndb1-1 mysql_data]#
上面的初始化过程的后台日志【mysql –> log-error】:
2017-02-28 13:31:00 14565 [Note] InnoDB: Using atomics to ref count buffer pool pages 2017-02-28 13:31:00 14565 [Note] InnoDB: The InnoDB memory heap is disabled 2017-02-28 13:31:00 14565 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins 2017-02-28 13:31:00 14565 [Note] InnoDB: Memory barrier is not used 2017-02-28 13:31:00 14565 [Note] InnoDB: Compressed tables use zlib 1.2.3 2017-02-28 13:31:00 14565 [Note] InnoDB: Using Linux native AIO 2017-02-28 13:31:00 14565 [Note] InnoDB: Using CPU crc32 instructions 2017-02-28 13:31:00 14565 [Note] InnoDB: Initializing buffer pool, size = 128.0M 2017-02-28 13:31:00 14565 [Note] InnoDB: Completed initialization of buffer pool 2017-02-28 13:31:00 14565 [Note] InnoDB: The first specified data file ./ibdata1 did not exist: a new database to be created! 2017-02-28 13:31:00 14565 [Note] InnoDB: Setting file ./ibdata1 size to 12 MB 2017-02-28 13:31:00 14565 [Note] InnoDB: Database physically writes the file full: wait... 2017-02-28 13:31:00 14565 [Note] InnoDB: Setting log file ./ib_logfile101 size to 48 MB 2017-02-28 13:31:02 14565 [Note] InnoDB: Setting log file ./ib_logfile1 size to 48 MB 2017-02-28 13:31:04 14565 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0 2017-02-28 13:31:04 14565 [Warning] InnoDB: New log files created, LSN=45781 2017-02-28 13:31:04 14565 [Note] InnoDB: Doublewrite buffer not found: creating new 2017-02-28 13:31:04 14565 [Note] InnoDB: Doublewrite buffer created 2017-02-28 13:31:04 14565 [Note] InnoDB: 128 rollback segment(s) are active. 2017-02-28 13:31:04 14565 [Warning] InnoDB: Creating foreign key constraint system tables. 2017-02-28 13:31:04 14565 [Note] InnoDB: Foreign key constraint system tables created 2017-02-28 13:31:04 14565 [Note] InnoDB: Creating tablespace and datafile system tables. 2017-02-28 13:31:04 14565 [Note] InnoDB: Tablespace and datafile system tables created. 2017-02-28 13:31:04 14565 [Note] InnoDB: Waiting for purge to start 2017-02-28 13:31:04 14565 [Note] InnoDB: 5.6.31 started; log sequence number 0 2017-02-28 13:31:07 14565 [Note] Binlog end 2017-02-28 13:31:07 14565 [Note] InnoDB: FTS optimize thread exiting. 2017-02-28 13:31:07 14565 [Note] InnoDB: Starting shutdown... 2017-02-28 13:31:09 14565 [Note] InnoDB: Shutdown completed; log sequence number 1625977 2017-02-28 13:31:09 14587 [Note] InnoDB: Using atomics to ref count buffer pool pages 2017-02-28 13:31:09 14587 [Note] InnoDB: The InnoDB memory heap is disabled 2017-02-28 13:31:09 14587 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins 2017-02-28 13:31:09 14587 [Note] InnoDB: Memory barrier is not used 2017-02-28 13:31:09 14587 [Note] InnoDB: Compressed tables use zlib 1.2.3 2017-02-28 13:31:09 14587 [Note] InnoDB: Using Linux native AIO 2017-02-28 13:31:09 14587 [Note] InnoDB: Using CPU crc32 instructions 2017-02-28 13:31:09 14587 [Note] InnoDB: Initializing buffer pool, size = 128.0M 2017-02-28 13:31:09 14587 [Note] InnoDB: Completed initialization of buffer pool 2017-02-28 13:31:09 14587 [Note] InnoDB: Highest supported file format is Barracuda. 2017-02-28 13:31:09 14587 [Note] InnoDB: 128 rollback segment(s) are active. 2017-02-28 13:31:09 14587 [Note] InnoDB: Waiting for purge to start 2017-02-28 13:31:09 14587 [Note] InnoDB: 5.6.31 started; log sequence number 1625977 2017-02-28 13:31:09 14587 [Note] Binlog end 2017-02-28 13:31:09 14587 [Note] InnoDB: FTS optimize thread exiting. 2017-02-28 13:31:09 14587 [Note] InnoDB: Starting shutdown... 2017-02-28 13:31:11 14587 [Note] InnoDB: Shutdown completed; log sequence number 1625987
启动:mysqld
[root@ndb1-1 mysql_data]# ps -ef | grep mysqld root 13535 13264 0 13:03 pts/3 00:00:00 grep --color=auto mysqld [root@ndb1-1 mysql_data]# [root@ndb1-1 mysql_data]# mysqld --ndbcluster --ndb-connectstring=10.158.1.116:1186 --explicit_defaults_for_timestamp --skip-grant-tables & [1] 13536 [root@ndb1-1 mysql_data]# 2017-02-28 13:03:38 0 [Note] mysqld (mysqld 5.6.31-ndb-7.4.12-cluster-gpl-log) starting as process 13536 ... [root@ndb1-1 mysql_data]# ps -ef | grep mysqld mysql 13536 13264 7 13:03 pts/3 00:00:00 mysqld --ndbcluster --ndb-connectstring=10.158.1.116:1186 --explicit_defaults_for_timestamp --skip-grant-tables root 13568 13264 0 13:03 pts/3 00:00:00 grep --color=auto mysqld [root@ndb1-1 mysql_data]# [root@ndb1-1 mysql_data]#
查看集群的状态:
[root@ndb1-1 mysql_data]# ndb_mgm -- NDB Cluster -- Management Client -- ndb_mgm> show Connected to Management Server at: 10.158.1.116:1186 Cluster Configuration --------------------- [ndbd(NDB)] 2 node(s) id=2 @10.158.1.116 (mysql-5.6.31 ndb-7.4.12, Nodegroup: 0, *) id=3 @10.158.1.132 (mysql-5.6.31 ndb-7.4.12, Nodegroup: 0) [ndb_mgmd(MGM)] 1 node(s) id=1 @10.158.1.116 (mysql-5.6.31 ndb-7.4.12) [mysqld(API)] 2 node(s) id=4 @10.158.1.116 (mysql-5.6.31 ndb-7.4.12) id=5 @10.158.1.132 (mysql-5.6.31 ndb-7.4.12) ndb_mgm> exit [root@ndb1-1 mysql_data]#
——————————————
Done。