标签:db2 数据 com 启动 mysql安装 cat creat shared 查看
操作系统是CentOS 7 - 64bit。[root@MySQL1 ~]# mkdir MySQL
[root@MySQL1 ~]# tar -xvf MySQL-Cluster-gpl-7.4.10-1.el7.x86_64.rpm-bundle.tar -C MySQL/
安装必要的软件
[root@MySQL1 ~]#yum -y install net-tools
[root@MySQL1 ~]#yum -y install perl-Data-Dumper
安装
查看是否已经安装MySQL 或mariadb
[root@MySQLcluster1 MySQL]# rpm -qa |grep mariadb*
[root@MySQL1 ~]# rpm -e --nodeps mariadb-libs-5.5.44-2.el7.centos.x86_64
rpm -Uvh MySQL-Cluster-client-gpl-7.4.10-1.el7.x86_64.rpm
rpm -Uvh MySQL-Cluster-server-gpl-7.4.10-1.el7.x86_64.rpm
rpm -Uvh MySQL-Cluster-shared-gpl-7.4.10-1.el7.x86_64.rpm
设置
建立配置文件夹
[root@MySQL1 MySQL]# mkdir -p /var/lib/MySQL-cluster
建立配置文件
按照以下步骤进行设置并保存
[root@MySQL1 MySQL]# cd /var/lib/MySQL-cluster
[root@MySQL1 MySQL-cluster]# vi config.ini
[ndb_mgmd default]
DataDir=/var/lib/MySQL-cluster
[ndb_mgmd]
#Management Node db1
HostName=192.168.1.51
[ndbd default]
NoOfReplicas=2 # Number of replicas
DataMemory=256M # Memory allocate for data storage
IndexMemory=128M # Memory allocate for index storage
#Directory for Data Node
DataDir=/var/lib/MySQL-cluster
[MySQLd]
#SQL Node db2
HostName=192.168.1.52
[MySQLd]
#SQL Node db3
HostName=192.168.1.53
[ndbd]
#Data Node db4
HostName=192.168.1.54
[ndbd]
#Data Node db5
HostName=192.168.1.55
启动管理节点并查看状态
启动管理节点
接下来,使用以下命令启动管理节点:
[root@MySQL1 MySQL-cluster]# ndb_mgmd --config-file=/var/lib/MySQL-cluster/config.ini
查看状态
[root@MySQL1 MySQL-cluster]# ndb_mgm
ndb_mgm> show
DATA NODE节点安装设置
安装步骤与管理节点一样
DATANODE1安装设置
安装
[root@MySQL4 ~]# wget http://dev.MySQL.com/get/Downloads/MySQL-Cluster-7.4/MySQL-Cluster-gpl-7.4.10-1.el7.x86_64.rpm-bundle.tar
[root@MySQL4 ~l]# tar -xvf MySQL-Cluster-gpl-7.4.10-1.el7.x86_64.rpm-bundle.tar
[root@MySQL4 MySQL]# yum -y install perl-Data-Dumper
[root@MySQL4 MySQL]# yum -y install net-tools
[root@MySQL4 MySQL]# yum -y remove mariadb-libs
[root@MySQL4 MySQL]# rpm -Uvh MySQL-Cluster-client-gpl-7.4.10-1.el7.x86_64.rpm
[root@MySQL4 MySQL]# rpm -Uvh MySQL-Cluster-server-gpl-7.4.10-1.el7.x86_64.rpm
[root@MySQL4 MySQL]# rpm -Uvh MySQL-Cluster-shared-gpl-7.4.10-1.el7.x86_64.rpm
2.2.6.3.2.1.2设置配置文件
[root@MySQL4 MySQL]#vi /etc/my.cnf
[MySQLd]
ndbcluster
ndb-connectstring=192.168.1.51 # IP address of Management Node
[MySQL_cluster]
ndb-connectstring=192.168.1.51 # IP address of Management Node
新建数据库文件夹
[root@MySQL4 MySQL]# mkdir -p /var/lib/MySQL-cluster
启动
[root@MySQL4 MySQL]# ndbd
DATANODE2安装设置
与数据节点1一样
安装
[root@MySQL4 ~]# wget http://dev.MySQL.com/get/Downloads/MySQL-Cluster-7.4/MySQL-Cluster-gpl-7.4.10-1.el7.x86_64.rpm-bundle.tar
[root@MySQL4 ~l]# tar -xvf MySQL-Cluster-gpl-7.4.10-1.el7.x86_64.rpm-bundle.tar
[root@MySQL4 MySQL]# yum -y install perl-Data-Dumper
[root@MySQL4 MySQL]# yum -y install net-tools
[root@MySQL4 MySQL]# yum -y remove mariadb-libs
[root@MySQL4 MySQL]# rpm -Uvh MySQL-Cluster-client-gpl-7.4.10-1.el7.x86_64.rpm
[root@MySQL4 MySQL]# rpm -Uvh MySQL-Cluster-server-gpl-7.4.10-1.el7.x86_64.rpm
[root@MySQL4 MySQL]# rpm -Uvh MySQL-Cluster-shared-gpl-7.4.10-1.el7.x86_64.rpm
设置配置文件
[root@MySQL5 MySQL]#vi /etc/my.cnf
[MySQLd]
ndbcluster
ndb-connectstring=192.168.1.51 # IP address of Management Node
[MySQL_cluster]
ndb-connectstring=192.168.1.51 # IP address of Management Node
新建数据库文件夹
[root@MySQL5 MySQL]# mkdir -p /var/lib/MySQL-cluster
启动
[root@MySQL5 MySQL]# ndbd
SQL NODE安装
安装步骤与管理节点一样
SQL NODE1安装设置
安装
[root@MySQL2 ~]# wget http://dev.MySQL.com/get/Downloads/MySQL-Cluster-7.4/MySQL-Cluster-gpl-7.4.10-1.el7.x86_64.rpm-bundle.tar
[root@MySQL2 ~l]# tar -xvf MySQL-Cluster-gpl-7.4.10-1.el7.x86_64.rpm-bundle.tar
[root@MySQL2 MySQL]# yum -y install perl-Data-Dumper
[root@MySQL2 MySQL]# yum -y install net-tools
[root@MySQL2 MySQL]# yum -y remove mariadb-libs
[root@MySQL2 MySQL]# rpm -Uvh MySQL-Cluster-client-gpl-7.4.10-1.el7.x86_64.rpm
[root@MySQL2 MySQL]# rpm -Uvh MySQL-Cluster-server-gpl-7.4.10-1.el7.x86_64.rpm
[root@MySQL2 MySQL]# rpm -Uvh MySQL-Cluster-shared-gpl-7.4.10-1.el7.x86_64.rpm
2.2.6.3.3.1.2设置
[root@MySQL2 MySQL]# vi /etc/my.cnf
[MySQLd]
ndbcluster
ndb-connectstring=192.168.1.51 # IP address for server management node
default_storage_engine=ndbcluster # Define default Storage Engine used by MySQL
[MySQL_cluster]
ndb-connectstring=192.168.1.51 # IP address for server management node
创建数据库文件夹
[root@MySQL2 MySQL]# mkdir -p /var/lib/MySQL-cluster
启动
[root@MySQL2 MySQL]# service MySQL start
SQL NODE2安装
与SQL节点1一样
安装
[root@MySQL2 ~]# wget http://dev.MySQL.com/get/Downloads/MySQL-Cluster-7.4/MySQL-Cluster-gpl-7.4.10-1.el7.x86_64.rpm-bundle.tar
[root@MySQL2 ~l]# tar -xvf MySQL-Cluster-gpl-7.4.10-1.el7.x86_64.rpm-bundle.tar
[root@MySQL2 MySQL]# yum -y install perl-Data-Dumper
[root@MySQL2 MySQL]# yum -y install net-tools
[root@MySQL2 MySQL]# yum -y remove mariadb-libs
[root@MySQL2 MySQL]# rpm -Uvh MySQL-Cluster-client-gpl-7.4.10-1.el7.x86_64.rpm
[root@MySQL2 MySQL]# rpm -Uvh MySQL-Cluster-server-gpl-7.4.10-1.el7.x86_64.rpm
[root@MySQL2 MySQL]# rpm -Uvh MySQL-Cluster-shared-gpl-7.4.10-1.el7.x86_64.rpm
2.2.6.3.3.2.2设置配置
[root@MySQL3 MySQL]# vi /etc/my.cnf
[MySQLd]
ndbcluster
ndb-connectstring=192.168.1.51 # IP address for server management node
default_storage_engine=ndbcluster # Define default Storage Engine used by MySQL
[MySQL_cluster]
ndb-connectstring=192.168.1.51 # IP address for server management node
创建数据库文件夹
[root@MySQL3 MySQL]# mkdir -p /var/lib/MySQL-cluster
启动
[root@MySQL3 MySQL]# service MySQL start
管理节点监视群集
查看群集状态
[root@MySQL1 ~]# ndb_mgm
ndb_mgm> show
这样的话群集就完成了
不登陆数据测试状态
[root@MySQL1 ~]# ndb_mgm -e "all status"
[root@MySQL1 ~]# ndb_mgm -e "all report memory"
修改密码并测试
修改密码
查找密码
登陆到sql node1上查看密码,之前安装的时候已经提醒密码在.MySQL_secret里
[root@MySQL2 ~]# cat .MySQL_secret
初始化MySQL更改MySQL密码
[root@MySQL2 ~]# MySQL_secure_installation
修该登陆密码
删除所有用户
拒绝root远程登陆 选择no
是否删除test数据库 no
重新导入权限配置
添加账号并赋予远程登陆读写数据库权限
[root@MySQL2 ~]# MySQL -uroot -pP@ssw0rd
新建一个外部账号用于远程登陆
MySQL> CREATE USER ‘stonehu‘@‘%‘ IDENTIFIED BY ‘P@ssw0rd‘;
查看用户权限表
MySQL> select user, host, password from MySQL.user;
并从远程节点授予新的stonehu用户读写权限
MySQL> GRANT ALL PRIVILEGES ON . TO ‘stonehu‘@‘%‘ IDENTIFIED BY PASSWORD ‘*8232A1298A49F710DBEE0B330C42EEC825D4190A‘ WITH GRANT OPTION;
MySQL安装-MySQL INODB Cluster(8)
标签:db2 数据 com 启动 mysql安装 cat creat shared 查看
原文地址:https://blog.51cto.com/huxiaoqiu/2539804