ubuntu16.04 中安装 mysql culster

9人阅读 评论(0) 收藏 举报
分类:

下载资源

mysql-cluster_7.5.9-1ubuntu16.04_amd64.deb-bundle.tar

环境说明

MGM1: 172.17.0.2 
MGM2: 172.17.0.3

NDBD1:172.17.0.4
NDBD2:172.17.0.5

SQL1:  172.17.0.6
SQL2:  172.17.0.7

创建安装目录

mkdir -p /usr/local/mysql/bin 
mkdir -p /usr/local/mysql/ndbdata  #为避免和data下的数据混合,单独创建的数据文件夹

添加执行文件路径

vi ~/.bashrc
    export PATH=$PATH:$HOME/bin:/usr/local/mysql/bin
source ~/.bashrc
echo $PATH

安装依赖包:

apt update
apt install python-paramiko libclass-methodmaker-perl  lsb-release

添加MySQL APT Repository

wget https://repo.mysql.com//mysql-apt-config_0.8.9-1_all.deb
dpkg -i mysql-apt-config_0.8.9-1_all.deb  #一步步选择,最后选择出mysql-cluster-7.5
apt update 

Installing MySQL NDB Cluster for each server

apt install mysql-cluster-community-server   #SQL nodes
apt install mysql-cluster-community-management-server  #management nodes
apt install mysql-cluster-community-data-node    # data nodes:

Configuring the data nodes and SQL nodes

在每个data node和SQL node上创建配置文件
vi /etc/my.cnf,内容如下:

[mysqld]
# Options for mysqld process:
ndbcluster                      # run NDB storage engine

[mysql_cluster]
# Options for NDB Cluster processes:
ndb-connectstring=172.17.0.2  # location of management server

Configuring the management node.

mkdir /var/lib/mysql-cluster
cd /var/lib/mysql-cluster
vi 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=172.17.0.2          # 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=172.17.0.4          # 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=172.17.0.5          # 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=172.17.0.6          # Hostname or IP address
                                # (additional mysqld connections can be
                                # specified for this node for various
                                # purposes such as running ndb_restore)

[mysqld]
# SQL node options:
HostName=172.17.0.7          # Hostname or IP address
                                # (additional mysqld connections can be
                                # specified for this node for various
                                # purposes such as running ndb_restore)

Initial Startup of NDB Cluster

The management node should be started first, followed by the data nodes, and then finally by any SQL nodes

启动management node

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

其它启动参数

启动data node

ndbd

启动sql node

测试启动结果:

shell> 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    @198.51.100.30  (Version: 5.7.22-ndb-7.5.11, Nodegroup: 0, *)
id=3    @198.51.100.40  (Version: 5.7.22-ndb-7.5.11, Nodegroup: 0)

[ndb_mgmd(MGM)] 1 node(s)
id=1    @198.51.100.10  (Version: 5.7.22-ndb-7.5.11)

[mysqld(API)]   1 node(s)
id=4    @198.51.100.20  (Version: 5.7.22-ndb-7.5.11)

更多测试例子

Note

All configuration files (like my.cnf) are under /etc/mysql
All binaries, libraries, headers, etc., are under /usr/bin and /usr/sbin
The data directory is /var/lib/mysql

The default port for Cluster management nodes is 1186; 
the default port for data nodes is 2202.

参考文档

如何用apt安装MySQL NDB Cluster:
https://dev.mysql.com/doc/mysql-apt-repo-quick-guide/en/#repo-qg-apt-cluster-install

NDB Cluster Configuration Files
https://dev.mysql.com/doc/refman/5.7/en/mysql-cluster-config-file.html

Configuration of NDB Cluster
https://dev.mysql.com/doc/refman/5.7/en/mysql-cluster-configuration.html

Configuration for NDB Cluster Backups
https://dev.mysql.com/doc/refman/5.7/en/mysql-cluster-backup-configuration.html

MySQL Cluster 7.3.7+CentOS7集群配置入门
https://blog.csdn.net/u012974916/article/details/53317945
https://blog.csdn.net/icerleer/article/details/46404573
https://www.linuxidc.com/Linux/2014-09/106680.htm
https://www.linuxidc.com/Linux/2016-04/130100.htm

MySQL Cluster、MySQL Fabric、Galera Cluster对比
https://www.2cto.com/database/201504/387166.html
查看评论

Ubuntu16.04下安装MySQL及简单操作

Ubuntu上安装MySQL非常简单只需要几条命令就可以完成。 1. sudo apt-get install mysql-server 2. apt-get isntall mysql-c...
  • qq_29666899
  • qq_29666899
  • 2018-01-16 21:57:50
  • 299

Ubuntu16.04下面安装mysqldb

pip install mysql-python 若报错: 1. sudo apt-get install libmysqlclient-dev 2. pip install mysql...
  • li8zi8fa
  • li8zi8fa
  • 2018-01-09 17:39:56
  • 97

Ubuntu16.04下安装MySQL5.x的简单方法

ubuntu16.04怎么安装mysql 方法/步骤 更新源列表 打开"终端窗口",输入"sudo apt-get update"-->回车-->"输入root用户的密码"-->回车,就可以了。...
  • ys2127435
  • ys2127435
  • 2017-02-05 17:00:47
  • 669

Ubuntu16.04中MySQL安装配置

1、安装mysql sudo apt-get install mysql-server apt isntall mysql-client apt install libmysqlcli...
  • yancey_blog
  • yancey_blog
  • 2016-10-10 18:07:16
  • 18204

Ubuntu 16.04上安装mysql详细教程

一、安装mysql 1. 安装需要使用root账号 sudo su sudo apt-get install mysql-server apt isntall mysql-client ap...
  • Blackrosetian
  • Blackrosetian
  • 2017-06-06 09:36:44
  • 2051

Ubuntu 16.04 安装使用MySQL

MySQL是流行的数据库系统,下面记录了在Ubuntu 16.04上安装MySQL步骤。如果你使用的是Ubuntu 16.04以前的版本,可以看这里:Ubuntu 14.04/15.10升级到Ubun...
  • vXueYing
  • vXueYing
  • 2016-08-26 17:09:19
  • 8538

在ubuntu16.04上安装mysql

转载自http://www.cnblogs.com/iscodercn/p/5488633.html   一个朋友在使用ubuntu-server 16.04安装mysql,设置远程访问的时候...
  • u011531010
  • u011531010
  • 2016-08-25 15:04:01
  • 19888

ubuntu 16.04 安装MySQL Workbench

sudo dpkg -i mysql-workbench-community-6.3.9-1ubuntu16.04-amd64.deb sudo apt-get -f install sud...
  • chenhaifeng2016
  • chenhaifeng2016
  • 2017-10-08 10:38:43
  • 523

Ubuntu16.04使用docker安装MySQL

在安装MySQL时,自己按照别人的教程不管是安装mysql5.5还是mysql5.7总是在登录时遇到以下错误: $ mysql -u root -p ERROR 2002 (HY000): Ca...
  • u014454538
  • u014454538
  • 2017-11-15 19:37:03
  • 365
    个人资料
    持之以恒
    等级:
    访问量: 4万+
    积分: 719
    排名: 7万+
    最新评论