首页 > 数据库技术 > 详细

mysql-cluster集群配置

时间:2019-01-10 18:45:57      阅读:89      评论:0      收藏:0      [点我收藏+]

标签:cat   mkdir   install   for   maria   name   mct   maker   man   

环境:

centos7:192.168.1.16,192.168.1.170

mysql-cluster-community-7.6.8-1.el7.x86_64.rpm-bundle.tar

安装:

卸载系统已有的数据库yum -y remove MariaDB*(centos7默认安装的是mariadb)

tar xvf mysql-cluster-community-7.6.8-1.el7.x86_64.rpm-bundle.tar

yum -y install perl perl-Class-MethodMaker perl-DBI libaio numactl 

rpm -ivh mysql-cluster-community-common-7.6.8-1.el7.x86_64.rpm

rpm -ivh mysql-cluster-community-libs-7.6.8-1.el7.x86_64.rpm

rpm -ivh mysql-cluster-community-client-7.6.8-1.el7.x86_64.rpm

rpm -ivh mysql-cluster-community-server-7.6.8-1.el7.x86_64.rpm

rpm -ivh mysql-cluster-community-management-server-7.6.8-1.el7.x86_64.rpm

rpm -ivh mysql-cluster-community-devel-7.6.8-1.el7.x86_64.rpm

rpm -ivh mysql-cluster-community-data-node-7.6.8-1.el7.x86_64.rpm

 

mkdir /var/lib/mysql/data

mkdir /var/lib/mysql-cluster

mkdir /var/run/mysqld

chmod -R 1777 /var/lib/mysql

chmod -R 1777 /var/run/mysqld

chmod -R 1777 /var/lib/mysql-cluster

cd /var/lib/mysql-cluster,在该目录下创建config.ini文件

16上文件

[[email protected] ~]# cat /var/lib/mysql-cluster/config.ini
[computer]
Id=mgr-server-02
HostName=192.168.1.170
[mgm default]
datadir=/var/lib/mysql-cluster
[mgm]
HostName=192.168.1.16
NodeId=60
[mgm]
HostName=192.168.1.170
NodeId=61
[ndbd default]
NoOfReplicas = 2
DataMemory = 50M
IndexMemory = 50M
MaxNoOfTables = 1024
MaxNoOfAttributes = 5000000
MaxNoOfOrderedIndexes = 10000
[ndbd]
HostName=192.168.1.170
DataDir=/var/lib/mysql
NodeId=1
[ndbd]
HostName=192.168.1.16
DataDir=/var/lib/mysql
NodeId=2
[mysqld]
HostName=192.168.1.170
NodeId=81
[mysqld]
HostName=192.168.1.16
NodeId=82

170上文件

[[email protected] ~]# cat /var/lib/mysql-cluster/config.ini
[computer]
Id=mgr-server-02
HostName=192.168.1.170
[mgm default]
datadir=/var/lib/mysql-cluster
[mgm]
HostName=192.168.1.16
NodeId=60
[mgm]
HostName=192.168.1.170
NodeId=61
[ndbd default]
NoOfReplicas = 2
DataMemory = 50M
IndexMemory = 50M
MaxNoOfTables = 1024
MaxNoOfAttributes = 5000000
MaxNoOfOrderedIndexes = 10000
[ndbd]
HostName=192.168.1.170
DataDir=/var/lib/mysql
NodeId=1
[ndbd]
HostName=192.168.1.16
DataDir=/var/lib/mysql
NodeId=2
[mysqld]
HostName=192.168.1.170
NodeId=81
[mysqld]
HostName=192.168.1.16
NodeId=82

编辑/etc/my.cnf文件

[[email protected] ~]# cat /etc/my.cnf|grep -v "#"
[client]
socket=/var/lib/mysql/mysql.sock
[mysqld]
max_connections=100
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
ndbcluster
ndb-connectstring=192.168.1.16,192.168.1.170
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/lib/mysql/mysqld.pid
[mysql_cluster]
ndb-connectstring=192.168.1.16,192.168.1.170

关闭防火墙,关闭selinux,初始化密码在/var/log/mysqld.log文件中,首次登陆必须改密码,开启远程登录权限(也可设置只允许节点ip访问)

ndb_mgmd -f /var/lib/mysql-cluster/config.ini

ndbd --initial

systemctl start mysqld.service

mysql-cluster集群配置

标签:cat   mkdir   install   for   maria   name   mct   maker   man   

原文:https://www.cnblogs.com/tiantianhappy/p/10251688.html

(0)
(0)
   
举报
评论 一句话评论(0
0条  
登录后才能评论!
© 2014 designnerd.net 版权所有 鲁ICP备09046678号-4
打开技术之扣,分享程序人生!
             

鲁公网安备 37021202000002号