zoukankan      html  css  js  c++  java
  • mysql-cluster集群配置

    环境:

    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上文件

    [root@centos7 ~]# 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上文件

    [root@localhost ~]# 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文件

    [root@localhost ~]# 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

  • 相关阅读:
    Windows 8.1 应用开发文章汇总
    演绎事件委托
    Azure China
    Orchard 刨析:导航篇
    为ASP.NET MVC应用程序使用高级功能
    兼容Mono的下一代云环境Web开发框架ASP.NET vNext
    商品导航菜单
    纳斯达克对经济泡沫的定义是:当交易价格远大于内在价值的时候,就称为泡沫(转)
    当一个低级问题,第一次解决时,你会感受到成就;第二次解决时,你感受到责任,第三次解决时,你可能更多的感受到无力(转)
    互联网组织的未来:剖析GitHub员工的任性之源(转)
  • 原文地址:https://www.cnblogs.com/tiantianhappy/p/10251688.html
Copyright © 2011-2022 走看看