安装mysql ndb cluster二进制版本在linux上

 Installing an NDB Cluster Binary Release on Linux (官方安装手册)
手册地址:
https://dev.mysql.com/doc/refman/5.7/en/mysql-cluster-install-linux-binary.html

我们安装 mysql集群,版本为 mysql-cluster-gpl-7.6.21-linux-glibc2.12-x86_64.tar.gz

完成安装之后, 还不能马上就启动. 我们来看看如何配置这些节点 (see Section 21.3.3, “Initial Configuration of NDB Cluster”).


 

SQL节点.  在集群中选定一台作为sql节点, 完成以下的步骤作为一个系统用户:

           检查你的 /etc/passwd 和 /etc/group 文件
   
          看看是否有mysql user 和mysql 组. 一些操作系统会创建这样的组和用户在安装操作系统的时候. 

  1. 如果不存在,就创建一个新的 mysql 用户组, 然后增加  mysql user到这个组里面:

    $> groupadd mysql
    $> useradd -g mysql -s /bin/false mysql

      增加用户和增加组,因为不同操作系统的语法是不一样的,类似  useradd 和 groupadd 或者是 adduser 和 addgroup.

  2. 改变位置到下载文件的目录, 解压压缩包, 然后创建 symbolic link   命名为 mysql 作为mysql目录

    提示

           The actual file and directory names vary according to the NDB Cluster version number.

    $> cd /var/tmp
    $> tar -C /usr/local -xzvf mysql-cluster-gpl-7.6.21-linux-glibc2.12-x86_64.tar.gz
    $> ln -s /usr/local/mysql-cluster-gpl-7.6.21-linux-glibc2.12-x86_64 /usr/local/mysql
  3. 进入到 mysql 目录 ,安装系统数据库 使用  mysqld --initialize 命令:

    $> cd mysql
    $> mysqld --initialize
  4.  对于mysql root账户会产生一个随机密码. 

     如果你不想得到一个随机的密码,你可以使用  --initialize-insecure 代替 --initialize 参数
    . 不论哪种情况, 你应该检查  Section 2.10.1, “Initializing the Data Directory”, 另外你完成这步之前,你也看一下 
      Section 4.4.4, “mysql_secure_installation — Improve MySQL Installation Security”.

  5.    设置权限对于MySQL server 和  data 目录:

    $> chown -R root .
    $> chown -R mysql data
    $> chgrp -R mysql .
  6. 复制 MySQL启动 script 到合适的目录, 设置一下他的执行权限,把脚本加入到系统启动设置里面去:

    $> cp support-files/mysql.server /etc/rc.d/init.d/
    $> chmod +x /etc/rc.d/init.d/mysql.server
    $> chkconfig --add mysql.server

    不同的操作系统和版本,可能有不同的目录设置 ,一些linux 发布版是在 /etc/init.d 。 例如:centos

    这里我们使用小红帽 Red Hat的 chkconfig 针对脚本创建链接, use whatever means is appropriate for this purpose on your platform, such as update-rc.d on Debian.

            Remember that the preceding steps must be repeated on each machine where an SQL node is to reside.


 

数据节点.  安装数据节点不需要 mysqld 二进制包.  仅仅需要的是 NDB Cluster 管理 server (ndb_mgmd) ;你最想安装的还有management client (ndb_mgm) . ndb_mgmd and ndb_mgm 这两个可以在 .tar.gz 压缩包里面找到. 还有就是, 我们设想你把它放在了 /var/tmp这个目录下了.

作为系统 root用户 (或者sudosu root), 完成以下的步骤来安装数据节点:

  1. 进入到 /var/tmp 目录,   提取 the ndbd 和 ndbmtd  从压缩里面,复制到例如 /usr/local/bin下:

    $> cd /var/tmp
    $> tar -zxvf mysql-cluster-gpl-7.6.21-linux-glibc2.12-x86_64.tar.gz
    $> cd mysql-cluster-gpl-7.6.21-linux-glibc2.12-x86_64
    $> cp bin/ndbd /usr/local/bin/ndbd
    $> cp bin/ndbmtd /usr/local/bin/ndbmtd

     

  2. 进入到/usr/local/bin下, 设置文件的执行权限

    $> cd /usr/local/bin
    $> chmod +x ndb*

         以上的步骤应该被重复执行在每个数据节点上 

        虽然 only one of the data node executables is required to run an NDB Cluster data node, we have shown you how to install both ndbd and ndbmtd in the preceding instructions. We recommend that you do this when installing or upgrading NDB Cluster, 即使 you plan to use only one of them, since this should save time and trouble in the event that you later decide to change from one to the other.

 注意:

数据目录在每一台数据节点上位置是 /usr/local/mysql/data. This piece of information is essential when configuring the management node. (See Section 21.3.3, “Initial Configuration of NDB Cluster”.)


 

管理节点.  安装管理节点不需要 mysqld 二进制的包. 仅仅需要的是 NDB Cluster 管理 server (ndb_mgmd) ;你最想安装的还有management client (ndb_mgm) . ndb_mgmd and ndb_mgm 这两个可以在 .tar.gz 压缩包里面找到. 还有就是, 我们设想你把它放在了 /var/tmp这个目录下了.

作为系统 root用户, 完成以下步骤来安装了 ndb_mgmd and ndb_mgm 在你的管理主机下:

  1. 进入到 /var/tmp 目录, 提取 ndb_mgm 和 ndb_mgmd从压缩包里面到合适的目录下例如: /usr/local/bin:

    $> cd /var/tmp
    $> tar -zxvf mysql-cluster-gpl-7.6.21-linux-glibc2.12-x86_64.tar.gz
    $> cd mysql-cluster-gpl-7.6.21-linux-glibc2.12-x86_64
    $> cp bin/ndb_mgm* /usr/local/bin

    你可以安全的删除目录,通过解压到下载到临时目录下
    从 /var/tmp 目录复制 ndb_mgm and ndb_mgmd 到可执行的目录下

  2. 进入到/usr/local/bin下, 设置文件的执行权限

    $> cd /usr/local/bin
    $> chmod +x ndb_mgm*

         3、相关其他命令
         $> ndb_mgmd -f /var/lib/mysql-cluster/config.ini --config-cache=FALSE

         $>ndb_mgmd -f /var/lib/mysql-cluster/config.ini --reload

posted @ 2022-01-28 17:41  jinzi  阅读(79)  评论(0编辑  收藏  举报