• PXC安装


    安装软件依赖包
    yum install -y  perl-IO-Socket-SSL perl-DBD-MySQL perl-Time-HiRes socat nc    openssl-devel libaio-devel libaio
     
    安装xtrabackup
    下载地址:
    http://www.percona.com/downloads/XtraBackup/
     
    rpm -ivh percona-xtrabackup-2.3.3-1.el5.x86_64.rpm
     
    安装PXC
    下载地址:
    https://www.percona.com/downloads/

    安装必要条件:
    1,rpm -qa|grep mysql 和  rpm -qa | grep mariadb,如果有安装对应软件则需要卸载再安装
    2,关闭selinux和防火墙



    rpm -ivh Percona-XtraDB-Cluster-shared-57-5.7.18-29.20.1.el7.x86_64.rpm
    rpm -ivh Percona-XtraDB-Cluster-server-57-5.7.18-29.20.1.el7.x86_64.rpm --nodeps
    rpm -ivh Percona-XtraDB-Cluster-client-57-5.7.18-29.20.1.el7.x86_64.rpm
    rpm -ivh  Percona-XtraDB-Cluster-57-5.7.18-29.20.1.el7.x86_64.rpm
     
    groupadd mysql
    useradd -g mysql -d /usr/local/mysql -s /sbin/nologin -M -n mysql
    cd /usr/local/mysql/
    chown -R mysql:mysql *
    mkdir -p /data/{mysql,tmp}
    chown -R mysql:mysql  /data/{mysql,tmp}

    mysqld --defaults-file=/etc/my.cnf --basedir=/usr/local/mysql --datadir=/data/mysql --user=mysql --initialize-insecure
       
     
    添加配置文件:
    wsrep_provider=/usr/local/mysql/lib/libgalera_smm.so                             #库文件
    wsrep_cluster_address=gcomm://192.168.56.26,192.168.56.27,192.168.56.28          #节点中所有ip
    wsrep_node_address=192.168.56.27                                                 #节点的ip
    wsrep_slave_threads=2                                                            #开启的复制线程数,cpu核数*2
    binlog_format=ROW                                                                #binlog格式必须为row
    default_storage_engine=InnoDB                                                    #暂时不支持其他存储引擎,只支持innodb,当然可以支持myisam,需要另外参数打开
    innodb_autoinc_lock_mode=2                                                       #自增锁的优化
    wsrep_cluster_name=pxc-yayun                                                     #集群名字
    wsrep_sst_auth=sst:mypwd                                                         #sst模式需要的用户名和密码
    wsrep_sst_method=xtrabackup-v2                                                   #采用什么方式复制数据。还支持mysqldump,rsync


    第一个节点第一次启动:
    mysqld --defaults-file=/etc/my.cnf --wsrep-new-cluster &

    其他节点启动:
    mysqld --defaults-file=/etc/my.cnf &

    查看节点的状态
    mysql>  show status like 'wsrep%';   



  • 相关阅读:
    cshtml常用标签
    模板方法模式(Template Method)
    day10-python-协程异步IORabbitMQ队列 edis缓存
    Gitlab+Jenkins自动化部署
    day9-python-进程、线程和协程
    day8-python-socket编程
    day7-python-面向对象进程进阶
    day6-python-面向对象
    day5-python-常用模块
    zabbix监控rabbitmq
  • 原文地址:https://www.cnblogs.com/l10n/p/9400944.html
Copyright © 2020-2023  润新知