相关链接:
在 CentOS 1804 中 使用 yum 安装 MySQL 5.7 最新版
在 CentOS 1804 中 安装 MySQL 5.7.20 (或任意MySQL版本)
在 CentOS 1804 中 修改 MySQL 密码策略
在 CentOS 中 开启 MySQL 的 3306 端口
在不打开 MySQL 3306 端口的情况下,使用 Navicat 进项远程连接(使用22端口)
在 Ubuntu 中安装 MySQL5.7.20(任意版本)
在 Ubuntu 中安装 MySQL5.7.** 最新版
CentOS 6/7 安装 MySQL 8 最新版
CentOS 6/7 安装 MySQL 8.0.11 (或任意版)
MySQL 5.7 最新版 使用 yum 安装 MySQL NDB Cluster 7.5 最新版 集群
MySQL 集群 MySQL NDB Cluster 7.5.** 与 MySQL 5.7.** 对应版本说明
MySQL 集群 MySQL NDB Cluster 7.6.** 与 MySQL 5.7.** 对应版本说明
MySQL 5.7.20 (或指定版本) 与 MySQL NDB Cluster 7.6.4 (或指定版本) 集群
Windows 安装 MySQL 5.7.20 教程(及常见问题解决)
MySQL 5.7.20 (或任意版本) 的 Windows 版 安装程序 (msi) 下载
mkdir -p /data/mysql
cd /data/mysql/
wget http://repo.mysql.com/yum/mysql-cluster-7.6-community/el/7/x86_64/mysql-cluster-community-management-server-7.6.4-1.el7.x86_64.rpm
yum -y install mysql-cluster-community-management-server*
rpm -qa | grep maria
卸载maria: yum -y remove mariadb-libs
手动安装依赖perl-Class-MethodMaker(此依赖CentOS中不存在,无法自动找到,使用的是epel el7 x86_64): mkdir -p /data/mysql
cd /data/mysql/
wget https://mirrors.aliyun.com/epel/7/x86_64/Packages/p/perl-Class-MethodMaker-2.20-1.el7.x86_64.rpm
yum -y install perl-Class-MethodMaker-2.20-1.el7.x86_64.rpm
安装SQL节点的组件:wget http://repo.mysql.com/yum/mysql-cluster-7.6-community/el/7/x86_64/mysql-cluster-community-common-7.6.4-1.el7.x86_64.rpm
wget http://repo.mysql.com/yum/mysql-cluster-7.6-community/el/7/x86_64/mysql-cluster-community-libs-7.6.4-1.el7.x86_64.rpm
wget http://repo.mysql.com/yum/mysql-cluster-7.6-community/el/7/x86_64/mysql-cluster-community-client-7.6.4-1.el7.x86_64.rpm
wget http://repo.mysql.com/yum/mysql-cluster-7.6-community/el/7/x86_64/mysql-cluster-community-server-7.6.4-1.el7.x86_64.rpm
wget http://repo.mysql.com/yum/mysql-cluster-7.6-community/el/7/x86_64/mysql-cluster-community-libs-compat-7.6.4-1.el7.x86_64.rpm
yum -y install mysql-cluster-community-common*
yum -y install mysql-cluster-community-libs*
yum -y install mysql-cluster-community-client*
yum -y install mysql-cluster-community-server*
yum -y install mysql-cluster-community-libs-compat*
开启数据库: systemctl start mysqld.service
已默认打开开机自启。[root@CentOS-1804-MySQL-2 mysql]# grep 'temporary password' /var/log/mysqld.log
2018-10-20T17:20:55.552284Z 1 [Note] A temporary password is generated for root@localhost: JuZUfg+RX8uf
初次登录修改密码:[root@CentOS-1804-MySQL-2 mysql]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.20-ndb-7.6.4-cluster-gpl
Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass4!';
Query OK, 0 rows affected (0.00 sec)
mysql>
设置远程连接密码: GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'Abc,123.456+';
打开3306端口: firewall-cmd --zone=public --add-port=3306/tcp --permanent
systemctl restart firewalld.service
firewall-cmd --list-ports
mkdir -p /data/mysql
cd /data/mysql/
wget http://repo.mysql.com/yum/mysql-cluster-7.6-community/el/7/x86_64/mysql-cluster-community-data-node-7.6.4-1.el7.x86_64.rpm
yum -y install mysql-cluster-community-data-node*
vim /etc/my.cnf
添加以下内容: [mysqld]
# Options for mysqld process:
ndbcluster # run NDB storage engine
[mysql_cluster]
# Options for NDB Cluster processes:
ndb-connectstring=192.168.113.151 # location of management server
mkdir /var/lib/mysql-cluster
cd /var/lib/mysql-cluster
vim 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 NDB Cluster setup.
ServerPort=2202 # This the default value; however, you can use any
# port that is free for all the hosts in the cluster
# Note1: It is recommended that you do not specify the port
# number at all and simply allow the default value to be used
# instead
# Note2: The port was formerly specified using the PortNumber
# TCP parameter; this parameter is no longer available in NDB
# Cluster 7.5.
[ndb_mgmd]
# Management process options:
HostName=192.168.113.151 # Hostname or IP address of MGM node
DataDir=/var/lib/mysql-cluster # Directory for MGM node log files
[ndbd]
# Options for data node "A":
# (one [ndbd] section per data node)
HostName=192.168.113.153 # Hostname or IP address
NodeId=2 # Node ID for this data node
DataDir=/usr/local/mysql/data # Directory for this data node's data files
[ndbd]
# Options for data node "B":
HostName=192.168.113.154 # Hostname or IP address
NodeId=3 # Node ID for this data node
DataDir=/usr/local/mysql/data # Directory for this data node's data files
[mysqld]
# SQL node options:
HostName=192.168.113.152 # Hostname or IP address
# (additional mysqld connections can be
# specified for this node for various
# purposes such as running ndb_restore)
WARNING -- at line 6: [DB] IndexMemory is deprecated, use Number bytes on each ndbd(DB) node allocated for storing indexes instead
firewall-cmd --zone=public --add-port=1186/tcp --permanent
systemctl restart firewalld.service
firewall-cmd --list-ports
首次启动: [root@CentOS-1804-MySQL-1 mysql-cluster]# ndb_mgmd -f /var/lib/mysql-cluster/config.ini
MySQL Cluster Management Server mysql-5.7.20 ndb-7.6.4
2018-10-21 02:14:26 [MgmtSrvr] INFO -- The default config directory '/usr/mysql-cluster' does not exist. Trying to create it...
2018-10-21 02:14:26 [MgmtSrvr] INFO -- Sucessfully created config directory
之后启动: ndb_mgmd
mkdir -p /usr/local/mysql/data
在数据节点A执行操作: [root@CentOS-1804-MySQL-3 ~]# ndbd
2018-10-21 02:18:31 [ndbd] INFO -- Angel connected to '192.168.113.151:1186'
2018-10-21 02:18:31 [ndbd] INFO -- Angel allocated nodeid: 2
[root@CentOS-1804-MySQL-4 ~]# ndbd
2018-10-21 02:19:15 [ndbd] INFO -- Angel connected to '192.168.113.151:1186'
2018-10-21 02:19:15 [ndbd] INFO -- Angel allocated nodeid: 3
[root@CentOS-1804-MySQL-2 ~]# ndb_mgm
-- NDB Cluster -- Management Client --
ndb_mgm> SHOW
Connected to Management Server at: 192.168.113.151:1186
Cluster Configuration
---------------------
[ndbd(NDB)] 2 node(s)
id=2 @192.168.113.153 (mysql-5.7.20 ndb-7.6.4, starting, Nodegroup: 0)
id=3 @192.168.113.154 (mysql-5.7.20 ndb-7.6.4, starting, Nodegroup: 0)
[ndb_mgmd(MGM)] 1 node(s)
id=1 @192.168.113.151 (mysql-5.7.20 ndb-7.6.4)
[mysqld(API)] 1 node(s)
id=4 (not connected, accepting connect from 192.168.113.152)
ndb_mgm>
上面显示内容已说明配置成功。
相关链接:
在 CentOS 1804 中 使用 yum 安装 MySQL 5.7 最新版
在 CentOS 1804 中 安装 MySQL 5.7.20 (或任意MySQL版本)
在 CentOS 1804 中 修改 MySQL 密码策略
在 CentOS 中 开启 MySQL 的 3306 端口
在不打开 MySQL 3306 端口的情况下,使用 Navicat 进项远程连接(使用22端口)
在 Ubuntu 中安装 MySQL5.7.20(任意版本)
在 Ubuntu 中安装 MySQL5.7.** 最新版
CentOS 6/7 安装 MySQL 8 最新版
CentOS 6/7 安装 MySQL 8.0.11 (或任意版)
MySQL 5.7 最新版 使用 yum 安装 MySQL NDB Cluster 7.5 最新版 集群
MySQL 集群 MySQL NDB Cluster 7.5.** 与 MySQL 5.7.** 对应版本说明
MySQL 集群 MySQL NDB Cluster 7.6.** 与 MySQL 5.7.** 对应版本说明
MySQL 5.7.20 (或指定版本) 与 MySQL NDB Cluster 7.6.4 (或指定版本) 集群
Windows 安装 MySQL 5.7.20 教程(及常见问题解决)
MySQL 5.7.20 (或任意版本) 的 Windows 版 安装程序 (msi) 下载