1、关闭防火墙
[root@node04 ~]#systemctl disable firewalld
[root@node04 ~]#systemctl stop firewalld
[root@node05 ~]#systemctl disable firewalld
[root@node05 ~]#systemctl stop firewalld
[root@node06 ~]#systemctl disable firewalld
[root@node06 ~]#systemctl stop firewalld 2、关闭selinux
[root@node04 ~]# vi /etc/selinux/config
SELINUX=disabled
[root@node05 ~]# vi /etc/selinux/config
SELINUX=disabled
[root@node06 ~]# vi /etc/selinux/config
SELINUX=disabled 3、重启服务器
[root@node04 ~]# reboot
[root@node05 ~]# reboot
[root@node06 ~]# reboot 4、卸载mariadb
[root@node04 ~]# rpm -qa | grep mariadb | xargs yum remove -y {}
[root@node05 ~]# rpm -qa | grep mariadb | xargs yum remove -y {}
[root@node06 ~]# rpm -qa | grep mariadb | xargs yum remove -y {} 5、所有节点上传PXC集群依赖包,并安装PXC集群
安装PXC集群
[root@node04 ~]# yum localinstall -y *.rpm
[root@node05 ~]# yum localinstall -y *.rpm
[root@node06 ~]# yum localinstall -y *.rpm 6、修改参数文件
删除三个节点的MySQL参数文件/etc/my.cnf,添加如下内容
[client]
socket=/tmp/mysql.sock [mysqld]
server-id=4
datadir=/data/mysql/data
socket=/tmp/mysql.sock
log-error=/data/mysql/log/mysqld.log
pid-file=/data/mysql/data/mysqld.pid
log-bin=/data/mysql/log/mysql-bin
log_slave_updates
expire_logs_days=7
character_set_server=utf8
bind-address=0.0.0.0
skip-name-resolve 6、取消MySQL数据库自动启动
[root@node04 ~]# chkconfig mysqld off
[root@node05 ~]# chkconfig mysqld off
[root@node06 ~]# chkconfig mysqld off 7、启动各个节点数据库
[root@node04 ~]# systemctl start mysql
[root@node05 ~]# systemctl start mysql
[root@node06 ~]# systemctl start mysql 8、初始化MySQL数据库
所有查看临时密码:
cat /var/log/mysqld.log | grep "A temporary password" 所有节点按如下方法修改MySQL密码
[root@node04 ~]# mysql_secure_installation Securing the MySQL server deployment. Enter password for user root: The existing password for the user account root has expired. Please set a new password. New password: Re-enter new password: VALIDATE PASSWORD PLUGIN can be used to test passwords
and improve security. It checks the strength of password
and allows the users to set only those passwords which are
secure enough. Would you like to setup VALIDATE PASSWORD plugin? Press y|Y for Yes, any other key for No: n
Using existing password for root.
Change the password for root ? ((Press y|Y for Yes, any other key for No) : n ... skipping.
By default, a MySQL installation has an anonymous user,
allowing anyone to log into MySQL without having to have
a user account created for them. This is intended only for
testing, and to make the installation go a bit smoother.
You should remove them before moving into a production
environment. Remove anonymous users? (Press y|Y for Yes, any other key for No) : y
Success. Normally, root should only be allowed to connect from
'localhost'. This ensures that someone cannot guess at
the root password from the network. Disallow root login remotely? (Press y|Y for Yes, any other key for No) : y
Success. By default, MySQL comes with a database named 'test' that
anyone can access. This is also intended only for testing,
and should be removed before moving into a production
environment. Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y
- Dropping test database...
Success. - Removing privileges on test database...
Success. Reloading the privilege tables will ensure that all changes
made so far will take effect immediately. Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y
Success. All done! 9、所有节点添加管理用户admin,并设置权限
mysql> create user 'admin'@'%' identified by 'mysql@A123';
Query OK, 0 rows affected (0.01 sec) mysql> grant all privileges on *.* to 'admin'@'%';
Query OK, 0 rows affected (0.00 sec) mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec) 10、所有节点关闭数据库,修改MySQL参数文件
节点一:
[client]
socket=/tmp/mysql.sock [mysqld]
server-id=4
datadir=/data/mysql/data
socket=/tmp/mysql.sock
log-error=/data/mysql/log/mysqld.log
pid-file=/data/mysql/data/mysqld.pid
log-bin=/data/mysql/log/mysql-bin
log_slave_updates
expire_logs_days=7
character_set_server=utf8
bind-address=0.0.0.0
skip-name-resolve # Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0 wsrep_provider=/usr/lib64/galera3/libgalera_smm.so
wsrep_cluster_name=pxc-cluster2
wsrep_cluster_address=gcomm://192.168.12.14,192.168.12.15,192.168.12.16
wsrep_node_name=pxc-node04
wsrep_node_address=192.168.12.14
wsrep_sst_method=xtrabackup-v2
wsrep_sst_auth= admin:mysql@A123
pxc_strict_mode=ENFORCING
binlog_format=ROW
default_storage_engine=InnoDB
innodb_autoinc_lock_mode=2 节点二:
[client]
socket=/tmp/mysql.sock [mysqld]
server-id=4
datadir=/data/mysql/data
socket=/tmp/mysql.sock
log-error=/data/mysql/log/mysqld.log
pid-file=/data/mysql/data/mysqld.pid
log-bin=/data/mysql/log/mysql-bin
log_slave_updates
expire_logs_days=7
character_set_server=utf8
bind-address=0.0.0.0
skip-name-resolve # Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0 wsrep_provider=/usr/lib64/galera3/libgalera_smm.so
wsrep_cluster_name=pxc-cluster2
wsrep_cluster_address=gcomm://192.168.12.14,192.168.12.15,192.168.12.16
wsrep_node_name=pxc-node05
wsrep_node_address=192.168.12.15
wsrep_sst_method=xtrabackup-v2
wsrep_sst_auth= admin:mysql@A123
pxc_strict_mode=ENFORCING
binlog_format=ROW
default_storage_engine=InnoDB
innodb_autoinc_lock_mode=2 节点三:
[client]
socket=/tmp/mysql.sock [mysqld]
server-id=4
datadir=/data/mysql/data
socket=/tmp/mysql.sock
log-error=/data/mysql/log/mysqld.log
pid-file=/data/mysql/data/mysqld.pid
log-bin=/data/mysql/log/mysql-bin
log_slave_updates
expire_logs_days=7
character_set_server=utf8
bind-address=0.0.0.0
skip-name-resolve # Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0 wsrep_provider=/usr/lib64/galera3/libgalera_smm.so
wsrep_cluster_name=pxc-cluster2
wsrep_cluster_address=gcomm://192.168.12.14,192.168.12.15,192.168.12.16
wsrep_node_name=pxc-node06
wsrep_node_address=192.168.12.16
wsrep_sst_method=xtrabackup-v2
wsrep_sst_auth= admin:mysql@A123
pxc_strict_mode=ENFORCING
binlog_format=ROW
default_storage_engine=InnoDB
innodb_autoinc_lock_mode=2 11、启动主节点
[root@node04 ~]# systemctl start mysql@bootstrap.service 12、其他节点加入集群
[root@node05 ~]# systemctl start mysql
[root@node06 ~]# systemctl start mysql 13、查看集群状态信息
mysql> show status like 'wsrep_cluster%';
+--------------------------+--------------------------------------+
| Variable_name | Value |
+--------------------------+--------------------------------------+
| wsrep_cluster_weight | 3 |
| wsrep_cluster_conf_id | 3 |
| wsrep_cluster_size | 3 |
| wsrep_cluster_state_uuid | 2d2b5f7c-d4e5-11ea-b628-123f3f8ed2aa |
| wsrep_cluster_status | Primary |
+--------------------------+--------------------------------------+
5 rows in set (0.01 sec) 自此,MySQL PXC集群搭建完成!
  
  

  

MySQL PXC集群安装配置的更多相关文章

  1. MySQL NDB集群安装配置(mysql cluster 9.4.13 installation)

    一.安装前规划 1.安装软件版本:mysql-cluster-gpl-7.4.13-linux-glibc2.5-x86_64.tar.gz 2.安装规划: 主机名 Ip地址 角色 db01 192. ...

  2. mysql集群安装配置

    看网上很多人说mysql集群不是很稳定,因此这2天做了下mysql的集群,打算配置没有什么问题了,过2天做下相关的性能测试,我的配置环境如下:   操作系统:      Centos5.2    软件 ...

  3. hive集群安装配置

    hive 是JAVA写的的一个数据仓库,依赖hadoop.没有安装hadoop的,请参考http://blog.csdn.net/lovemelovemycode/article/details/91 ...

  4. RabbitMQ集群安装配置+HAproxy+Keepalived高可用

    RabbitMQ集群安装配置+HAproxy+Keepalived高可用 转自:https://www.linuxidc.com/Linux/2016-10/136492.htm rabbitmq 集 ...

  5. redis cluster 集群 安装 配置 详解

    redis cluster 集群 安装 配置 详解 张映 发表于 2015-05-01 分类目录: nosql 标签:cluster, redis, 安装, 配置, 集群 Redis 集群是一个提供在 ...

  6. CentOS下Hadoop-2.2.0集群安装配置

    对于一个刚开始学习Spark的人来说,当然首先需要把环境搭建好,再跑几个例子,目前比较流行的部署是Spark On Yarn,作为新手,我觉得有必要走一遍Hadoop的集群安装配置,而不仅仅停留在本地 ...

  7. hbase单机环境的搭建和完全分布式Hbase集群安装配置

    HBase 是一个开源的非关系(NoSQL)的可伸缩性分布式数据库.它是面向列的,并适合于存储超大型松散数据.HBase适合于实时,随机对Big数据进行读写操作的业务环境. @hbase单机环境的搭建 ...

  8. 集群安装配置Hadoop具体图解

    集群安装配置Hadoop 集群节点:node4.node5.node6.node7.node8. 详细架构: node4 Namenode,secondnamenode,jobtracker node ...

  9. spark集群安装配置

    spark集群安装配置 一. Spark简介 Spark是一个通用的并行计算框架,由UCBerkeley的AMP实验室开发.Spark基于map reduce 算法模式实现的分布式计算,拥有Hadoo ...

随机推荐

  1. Spring第三天,详解Bean的生命周期,学会后让面试官无话可说!

    点击下方链接回顾往期 不要再说不会Spring了!Spring第一天,学会进大厂! Spring第二天,你必须知道容器注册组件的几种方式!学废它吊打面试官! 今天讲解Spring中Bean的生命周期. ...

  2. PHP反序列化漏洞-CVE-2016-7124(绕过__wakeup)复现

    前言 最近电脑也不知怎么了时不时断网而且我竟然找不出原因!!!很诡异....  其他设备电脑都OK唯独我的电脑 时好时坏 我仿佛摸清了我电脑断网的时间段所以作息时间都改变了  今天12点多断网刷了会手 ...

  3. mybatis-plus使用p6spy 插件进行sql性能分析

    1.依赖 <dependency> <groupId>p6spy</groupId> <artifactId>p6spy</artifactId& ...

  4. 标准库之time,random,sys,os

    # import time # print(time.time()) # 时间戳 # print(time.mktime(time.localtime())) # 结构化时间转换为时间戳 # prin ...

  5. FL studio系列教程(五):FL Studio20自带的效果器Fruity Delay3功能

    作为音乐编曲常用软件之一的FL Studio20,在国内外都有着很多真爱粉,当然,在国内我们一般都叫它水果音乐制作软件,或者直接叫"水果".它有丰富的内置插件于音源,想要用好这些插 ...

  6. [转载]Windows环境下 Hadoop Error: JAVA_HOME is incorrectly set. 问题

    最近尝试在windows开发MR程序并且提交Job,在解压缩好hadoop,配置好环境变量后, 打开cmd 输入hadoop version 的时候出现以下错误: Error: JAVA_HOME i ...

  7. 完全图的最短Hamilton路径——状压dp

    题意:给出一张含有n(n<20)个点的完全图,求从0号节点到第n-1号节点的最短Hamilton路径.Hamilton路径是指不重不漏地经过每一个点的路径. 算法进阶上的一道状压例题,复杂度为O ...

  8. Java基础教程——UDP编程

    UDP:User Datagram Protocol,用户数据报协议 服务端: import java.net.*; import java.io.*; public class UdpServer ...

  9. Java基础教程——命令行运行Java代码

    视屏讲解:https://www.bilibili.com/video/av48196406/?p=4 命令行运行Java代码 (1)使用记事本新建文本文件[Test.java]. 注意,默认状态下W ...

  10. Spring bean注册

    DefaultListableBeanFactory中: DefaultListableBeanFactory实现了BeanDefinitionRegistry,这个接口的实现完成BeanDefini ...