• PXC安装


    PXC安装
    第一节点
    传入percona-release-0.1-6.noarch.rpm 文件
    [root@localhost ~]# yum install -y percona-release-0.1-6.noarch.rpm
    [root@localhost ~]# yum install Percona-XtraDB-Cluster-57
    传入my.cnf 文件
    克隆两个虚拟机
    [root@localhost ~]# mv my.cnf /etc/my.cnf
    [root@localhost ~]# vi /etc/my.cnf
    [mysqld]
    datadir = /mysqldb/db_pxc
    pid_file= /mysqldb/db_pxc/mysql.pid
    character-set-server=utf8
    log-bin=/mysqldb/db_pxc/log_bin
    server-id = 9816000
    innodb_buffer_pool_size = 300M
    innodb_data_file_path = ibdata1:10M:autoextend
    innodb_data_home_dir = /mysqldb/db_pxc
    innodb_file_per_table=1
    skip-name-resolve
    port = 3306
    socket = /mysqldb/db_pxc/mysql.sock
    user=mysql
    log_error=/mysqldb/db_pxc/mysql_error.log
    #pxc
    user=mysql
    binlog_format=ROW
    log-slave-updates
    wsrep_provider=/usr/lib64/galera3/libgalera_smm.so
    wsrep_cluster_name=pxc (修改成pxc)
    wsrep_cluster_address='gcomm://192.168.253.155,192.168.253.156,192.168.253.157'
    wsrep_node_name=pxc1
    wsrep_node_address=192.168.253.155 (红色代表需要修改)
    wsrep_sst_method=xtrabackup-v2
    wsrep_sst_auth=sstuser:passw0rd
    pxc_strict_mode=ENFORCING
    binlog_format=ROW
    default_storage_engine=InnoDB
    innodb_autoinc_lock_mode=2
    修改 里面的ip
    mkdir -p /mysqldb/db_pxc/
    [root@localhost db_pxc]# systemctl start mysql@bootstarp.service
    [root@localhost db_pxc]# less mysql_error.log|grep temp (查看临时密码)
    [root@localhost db_pxc]# mysql -uroot -p(临时密码)-S /mysqdb/db_pxc/mysql.sock
    mysql> alter user root@'localhost' identified by 'mysql';
    Query OK, 0 rows affected (0.00 sec)
    mysql> CREATE USER 'sstuser'@'localhost' IDENTIFIED BY 'passw0rd';
    Query OK, 0 rows affected (0.01 sec)
    mysql> GRANT RELOAD, LOCK TABLES, PROCESS, REPLICATION CLIENT ON *.* TO
    -> 'sstuser'@'localhost';
    Query OK, 0 rows affected, 1 warning (0.00 sec)
    mysql> FLUSH PRIVILEGES;
    Query OK, 0 rows affected (0.00 sec)
    第二节点
    [root@localhost ~]# vi /etc/my.cnf
    [mysqld]
    datadir = /mysqldb/db_pxc
    pid_file= /mysqldb/db_pxc/mysql.pid
    character-set-server=utf8
    log-bin=/mysqldb/db_pxc/log_bin
    server-id = 9816002
    innodb_buffer_pool_size = 300M
    innodb_data_file_path = ibdata1:10M:autoextend
    innodb_data_home_dir = /mysqldb/db_pxc
    innodb_file_per_table=1
    skip-name-resolve
    port = 3306
    socket = /mysqldb/db_pxc/mysql.sock
    user=mysql
    log_error=/mysqldb/db_pxc/mysql_error.log
    #pxc
    user=mysql
    binlog_format=ROW
    log-slave-updates
    wsrep_provider=/usr/lib64/galera3/libgalera_smm.so
    wsrep_cluster_name=pxc
    wsrep_cluster_address='gcomm://192.168.253.155,192.168.253.156,192.168.253.157'
    wsrep_node_name=pxc2
    wsrep_node_address=192.168.253.156
    wsrep_sst_method=xtrabackup-v2
    wsrep_sst_auth=sstuser:passw0rd
    pxc_strict_mode=ENFORCING
    binlog_format=ROW
    default_storage_engine=InnoDB
    innodb_autoinc_lock_mode=2
    [root@localhost /]# mkdir -p /mysqldb/db_pxc/
    [root@localhost /]# systemctl start mysql
    [root@localhost db_pxc]# mysql -uroot -pmysql -S /mysqldb/db_pxc/mysql.sock
    第三节点
    [root@localhost ~]# vi /etc/my.cnf
    [mysqld]
    datadir = /mysqldb/db_pxc
    pid_file= /mysqldb/db_pxc/mysql.pid
    character-set-server=utf8
    log-bin=/mysqldb/db_pxc/log_bin
    server-id = 9816003
    innodb_buffer_pool_size = 300M
    innodb_data_file_path = ibdata1:10M:autoextend
    innodb_data_home_dir = /mysqldb/db_pxc
    innodb_file_per_table=1
    skip-name-resolve
    port = 3306
    socket = /mysqldb/db_pxc/mysql.sock
    user=mysql
    log_error=/mysqldb/db_pxc/mysql_error.log
    #pxc
    user=mysql
    binlog_format=ROW
    log-slave-updates
    wsrep_provider=/usr/lib64/galera3/libgalera_smm.so
    wsrep_cluster_name=pxc
    wsrep_cluster_address='gcomm://192.168.253.157,192.168.253.156,192.168.253.155'
    wsrep_node_name=pxc3
    wsrep_node_address=192.168.253.157
    wsrep_sst_method=rsync
    wsrep_sst_auth=sstuser:passw0rd
    pxc_strict_mode=ENFORCING
    binlog_format=ROW
    default_storage_engine=InnoDB
    innodb_autoinc_lock_mode=2
    [root@localhost /]# mkdir -p /mysqldb/db_pxc/
    [root@localhost /]# systemctl start mysql
    [root@localhost db_pxc]# mysql -uroot -pmysql -S /mysqldb/db_pxc/mysql.sock
    mysql> show status like 'wsrep%'; (查看是否有三个节点)
    wsrep_cluster_size 3 (代表三个节点)
  • 相关阅读:
    TortoiseGit 的下载与安装
    CountDownLatch在多线程程序中的应用
    IDEA中maven的依赖jar包报红
    监控中的TP50
    BeanUtils.copyProperties方法,当属性Date为null解决
    SimpleDateFormat的安全问题解决方法
    java修饰符用法
    java实现快速排序
    京东2016实习生编程题—生日礼物
    美图笔试算法题(两个人拿石头判断输赢)
  • 原文地址:https://www.cnblogs.com/Knight7971/p/9622975.html
Copyright © 2020-2023  润新知