美文网首页
Mysql Percona XtraDB Cluster

Mysql Percona XtraDB Cluster

作者: 战神汤姆 | 来源:发表于2022-06-20 09:33 被阅读0次

    Installing from Repositories

    1.Fetch the repository packages from Percona web:

    <code>
    wget https://repo.percona.com/apt/percona-release_0.1-4.$(lsb_release -sc)_all.deb
    </code>

    1.Install the downloaded package with dpkg. To do that, run the following command as root or with sudo:
    <code>
    sudo dpkg -i percona-release_0.1-4.$(lsb_release -sc)_all.deb
    </code>

    Once you install this package, the Percona repositories should be added. You can check the repository configuration in the /etc/apt/sources.list.d/percona-release.list
    file.
    1.Update the local cache:
    <code>
    sudo apt-get update
    </code>

    1.Install the server package:

    Note
    Make sure to remove existing Percona XtraDB Cluster 5.5 and Percona Server 5.5/5.6 packages before proceeding.
    <code>
    sudo apt-get install percona-xtradb-cluster-56
    </code>
    Note
    Alternatively, you can install the percona-xtradb-cluster-full-56
    meta package, which contains the following additional packages:
    percona-xtradb-cluster-5.6-dbg

    percona-xtradb-cluster-galera-3.x-dbg

    percona-xtradb-cluster-galera3-dbg

    percona-xtradb-cluster-garbd-3

    percona-xtradb-cluster-garbd-3.x

    percona-xtradb-cluster-garbd-3.x-dbg

    percona-xtradb-cluster-server-debug-5.6

    percona-xtradb-cluster-test-5.6

    [mysqld]
    datadir=/var/lib/mysql
    user=mysql

    Path to Galera library

    wsrep_provider=/usr/lib64/libgalera_smm.so

    Cluster connection URL contains the IPs of node#1,node#2 and node#3

    wsrep_cluster_address=gcomm://192.168.70.71,192.168.70.72,192.168.70.73

    In order for Galera to work correctly binlog formatshould be ROW

    binlog_format=ROW

    MyISAM storage engine has only experimental support

    default_storage_engine=InnoDB

    This changes how InnoDB autoincrement locks are managedand is a requirement for Galera

    innodb_autoinc_lock_mode=2

    Node #1 address

    wsrep_node_address=192.168.70.71 # 本机IP地址

    SST method

    wsrep_sst_method=xtrabackup-v2

    Cluster name

    wsrep_cluster_name=my_centos_cluster

    Authentication for SST method

    wsrep_sst_auth="sstuser:s3cret"

    注:其他节点配置文件同上,注意wsrep_node_address=192.168.70.71 # 本机IP地址。

    在第一个节点上执行:
    mysql@percona1> CREATE USER 'sstuser@'localhost'IDENTIFIED BY 's3cret';
    mysql@percona1> GRANT RELOAD, LOCK TABLES, REPLICATIONCLIENT ON
    . TO 'sstuser'@'localhost';
    mysql@percona1> FLUSH PRIVILEGES;

    九、启动
    第一个节点:/etc/init.d/mysql bootstrap-pxc
    其他节点: /etc/init.d/mysqlstart

    相关文章

      网友评论

          本文标题:Mysql Percona XtraDB Cluster

          本文链接:https://www.haomeiwen.com/subject/wgcnzttx.html