返回顶部
首页 > 资讯 > 精选 >centos6.9怎么搭建pxc集群
  • 463
分享到

centos6.9怎么搭建pxc集群

2023-06-05 05:06:05 463人浏览 安东尼
摘要

这篇文章主要讲解了“Centos6.9怎么搭建pxc集群”,文中的讲解内容简单清晰,易于学习与理解,下面请大家跟着小编的思路慢慢深入,一起来研究和学习“centos6.9怎么搭建pxc集群”吧!一:环境介绍:1.32.49 1.3

这篇文章主要讲解了“Centos6.9怎么搭建pxc集群”,文中的讲解内容简单清晰,易于学习与理解,下面请大家跟着小编的思路慢慢深入,一起来研究和学习“centos6.9怎么搭建pxc集群”吧!

一:环境介绍:

1.32.49 

1.32.50

1.32.36

其中操作系统全部为 :centos 6.9 ,并且49和50是数据库集群的数据节点,36为鉴证节点或者叫选举节点,安装的percona 5.6版本,其中鉴证节点的garb安装的是garbd-3版本

二:正式安装:

1.首先安装相关的yum 源:

1-3版本的yum源:

yum installHttp://www.percona.com/downloads/percona-release/redhat/0.1-3/percona-release-0.1-3.noarch.rpm

1-4版本的yum源:(一般选择新版本)

yum install http://www.percona.com/downloads/percona-release/redhat/0.1-4/percona-release-0.1-4.noarch.rpm

装一些centos源里面没有的软件的源

yum install http://mirrors.ustc.edu.cn/fedora/epel/6/i386/epel-release-6-8.noarch.rpm

查看关于percona的yum源存在否:

[root@ory-newcaiwu-mysql-02 ~]# rpm  -qa  | grep  percona

percona-xtrabackup-24-2.4.9-1.el6.x86_64

percona-release-0.1-4.noarch

percona-toolkit-3.0.6-1.el6.x86_64

2 关闭防火墙和 Selinux

service iptables stop

chkconfig iptables off

vi /etc/selinux/config

SELINUX=disabled

2.查看已经安装的Percona的版本,如果不是自己需要的,那么卸载掉,防止冲突!

[root@ory-newcaiwu-Mysql-01 ~]# yum list  Percona*

或者

[root@ory-newcaiwu-mysql-02 ~]# rpm  -qa  | grep  Percona*

卸载系统本身有的Percona

[root@ory-newcaiwu-mysql-01 ~]# yum remove   Percona*

安装pxc具体需要安装下面几个包,真正安装的时候只需要Percona-XtraDB-Cluster-server-56即可,其余的都作为依赖包自动安装上了!

yum -y install Percona-XtraDB-Cluster-server Percona-XtraDB-Cluster-client Percona-Server-shared-compat percona-xtrabackup

查看Percona的各个版本的包的名字,以便于具体选择特定的版本:

[root@ory-newcaiwu-mysql-02 ~]# rpm  -qa  | grep  Percona*

3使用yum安装,只需要安装 Percona-XtraDB-Cluster-server即可,别的都是他的依赖包,一并都给自动安装了,如下我们选择的是5.6版本的mysql:

[root@ory-newcaiwu-mysql-02 ~]# yum install   -y  Percona-XtraDB-Cluster-server-56

然后配置参数/etc/my.cnf,两个数据节点配置参数基本相同,需要改个别参数;

[mysqld]
# GENERAL
datadir                                                                 = /data/mysqldata
tmpdir                                                                  = /tmp
Socket                                                                  = /data/mysqldata/mysql.sock
pid_file                                                                = /data/mysqldata/mysql.pid
user                                                                    = mysql
port                                                                    = 3306
character-set-server                                                    = utf8
bind-address                                                            = 0.0.0.0
server-id                                                               = 1013250
skip-name-resolve
lower_case_table_names                                                  = 1
# INNODB
# This changes how |InnoDB| autoincrement locks are managed and is a requirement for Galera
innodb_autoinc_lock_mode                                                = 2
innodb_buffer_pool_size                                                 = 90G
innodb_buffer_pool_instances                                            = 8
innodb_thread_concurrency                                               = 40
innodb_log_buffer_size                                                  = 32M
innodb_log_file_size                                                    = 1024M
innodb_online_alter_log_max_size                                        = 512M
innodb_open_files                                                       = 65535
innodb_purge_threads                                                    = 8
innodb_data_home_dir                                                    = /data/mysqldata
innodb_data_file_path                                                   = ibdata1:256M:autoextend
innodb_read_io_threads                                                  = 8
innodb_write_io_threads                                                 = 8
innodb_file_per_table                                                   = 1
innodb_flush_method                                                     = O_DIRECT
innodb_flush_log_at_trx_commit                                          = 2
innodb_max_dirty_pages_pct                                              = 90
innodb_file_fORMat                                                      = Barracuda
innodb_file_format_max                                                  = Barracuda
innodb_io_capacity                                                      = 512
innodb_io_capacity_max                                                  = 4096

#event_scheduler                                                        = OFF

# MyISAM
key_buffer_size                                                         = 32M

# LOGS
#general_log                                                            = 1
#general_log_file                                                       = /data/logs/mysql/mysql_general.log
log_warnings                                                            = 2
log_error                                                               = /data/logs/mysql/mysql_error.log
slow_query_log                                                          = ON
slow_query_log_file                                                     = /data/logs/mysql/mysql_slow.log
log_queries_not_using_indexes                                           = 0
long_query_time                                                         = 1
expire_logs_days                                                        = 15
log-bin                                                                 = mysql-bin.log
innodb_print_all_deadlocks                                              = 1
relay-log                                                               = relay-log
relay-log-index                                                         = relay-log
log_bin_trust_function_creators                                         = 1
# BINLOG
# In order for Galera to work correctly binlog format should be ROW
binlog_format                                                           = ROW
binlog_cache_size                                                       = 32M
max_binlog_size                                                         = 512M
log_bin_trust_function_creators                                         = 1

# OTHER
default_storage_engine                                                  = InnoDB
tmp_table_size                                                          = 32M
max_heap_table_size                                                     = 128M
query_cache_type                                                        = 0
query_cache_size                                                        = 0M
max_connections                                                         = 1024
thread_cache_size                                                       = 600
open_files_limit                                                        = 65535
innodb_buffer_pool_load_at_startup                                      = ON
innodb_buffer_pool_dump_at_shutdown                                     = ON
auto_increment_offset                                                   = 1
optimizer-switch                                                        = "mrr=on,mrr_cost_based=off,batched_key_access=on"
join_buffer_size                                                        = 16M
expand_fast_index_creation                                              = 1
sort_buffer_size                                                        = 16M
max_allowed_packet                                                      = 16M
sql_mode                                                                = STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION
# WSREP
wsrep_auto_increment_control                                            = OFF
# Path to Galera library
wsrep_provider                                                          = /usr/lib64/libgalera_smm.so
# Cluster connection URL
wsrep_cluster_address                                                   = GComm://10.1.32.49:4567,10.1.32.50:4567
# node #1 address
wsrep_node_address                                                      = 10.1.32.50 # local IP
# SST method
wsrep_sst_method                                                        = xtrabackup-v2
# Cluster name
wsrep_cluster_name                                                      = XFXJ_CAIWU_CLUSTER
# Authentication for SST method
wsrep_sst_auth                                                          = "sstuser:LLivTGmIWpVohjMD"
wsrep_max_ws_rows                                                       = 500000
wsrep_max_ws_size                                                       = 2147483647
wsrep_slave_threads                                                     = 40
wsrep_provider_options                                                  = "gcache.size=32G; gcache.page_size=512M; gcs.fc_limit = 4096;gcs.fc_master_slave = yes"

#Replication
log_slave_updates                                                       = 1
slave_parallel_worker                                                   = 4
gtid-mode                                                               = on
enforce_gtid_consistency                                                = true
binlog_checksum                                                         = CRC32
slave_allow_batching                                                    = 1
master_verify_checksum                                                  = 1
slave_sql_verify_checksum                                               = 1
master_info_repository                                                  = TABLE
relay_log_info_repository                                               = TABLE

[client]
socket                                                                  = /data/mysqldata/mysql.sock
port                                                                    = 3306
#default_character_set                                                  = utf8
[mysql]
default-character-set                                                   = utf8
prompt                                                                  ="\\u@\\h : \\d \\R:\\m:\\s>"
no-auto-rehash

5初始化数据库主节点:其他的不用刻意的初始化,因为等你启动第二个节点的时候他会sst同步给第二个节点

mysql_install_db --defaults-file=/etc/my.cnf --user=mysql

删除匿名账号

mysql -e "delete from mysql.user where user=' ';delete from mysql.user where user='';flush privileges;"

给管理员账号设密码

mysqladmin -u root passWord $password

每台机器mysql添加SST账户

其实只需要在主节点添加即可,因为等你启动第二个节点的时候他会sst同步给第二个节点,那么用户也会同步过去。注意用户名和密码需要在参数wsrep_sst_auth中对应!

CREATE USER 'sstuser'@'localhost' IDENTIFIED BY 'liuwenhe';

GRANT RELOAD, LOCK TABLES, REPLICATION CLIENT,PROCESS ON *.* TO 'sstuser'@'localhost';

启动主节点(以bootstrap-pxc方式启动):

[root@ory-newcaiwu-mysql-01 ~]# /etc/init.d/mysql   #显示mysql启动全部方式!

Usage: mysql {start|stop|restart|restart-bootstrap|reload|force-reload|status|bootstrap-pxc}  [ MySQL (Percona XtraDB Cluster) options ]

以bootstrap-pxc方式启动:

[root@ory-newcaiwu-mysql-01 ~]# /etc/init.d/mysql   bootstrap-pxc

0.启动节点32.50,会自动触发集群主节点32.49给它全量同步数据(也就是sst)

[root@ory-newcaiwu-mysql-02 mysqldata]# /etc/init.d/mysql  start

Starting MySQL (Percona XtraDB Cluster)...State transfer in progress, setting sleep higher

....                                                       [  OK  ]

三:32.36上 鉴证节点相关操作:

1.安装garb服务:

[root@ory-fanxiqian-oracle-01 ~]# yum  install Percona-XtraDB-Cluster-garbd-3

2.配置gab参数:

[root@ory-fanxiqian-Oracle-01 ~]# cat /etc/sysconfig/garb

# A comma-separated list of node addresses (address[:port]) in the cluster

GALERA_NODES="10.1.32.36:4567 10.1.32.49:4567 10.1.32.50:4567"

# Galera cluster name, should be the same as on the rest of the nodes.

GALERA_GROUP="XFXJ_CAIWU_CLUSTER"

# Optional Galera internal options string (e.g. SSL settings)

# see http://galeracluster.com/documentation-WEBpages/galeraparameters.html

# GALERA_OPTIONS=""

# Log file for garbd. Optional, by default logs to syslog

# Deprecated for CentOS7, use journalctl to query the log for garbd

LOG_FILE="/tmp/garbd.log"

3.启动gab服务:

root@localhost : (none) 17:57:32>show  status  like   'wsrep_cluster_size';

+--------------------+-------+

| Variable_name      | Value |

+--------------------+-------+

| wsrep_cluster_size | 2    |

+--------------------+-------+

1 row in set (0.00 sec)

[root@ory-fanxiqian-Oracle-01 ~]# /etc/init.d/garb start

其中时候你会发现集群节点数量增加了1,由2变成了3;

root@localhost : (none) 17:57:32>show  status  like   'wsrep_cluster_size';

+--------------------+-------+

| Variable_name      | Value |

+--------------------+-------+

| wsrep_cluster_size | 3     |

+--------------------+-------+

1 row in set (0.00 sec)

感谢各位的阅读,以上就是“centos6.9怎么搭建pxc集群”的内容了,经过本文的学习后,相信大家对centos6.9怎么搭建pxc集群这一问题有了更深刻的体会,具体使用情况还需要大家实践验证。这里是编程网,小编将为大家推送更多相关知识点的文章,欢迎关注!

--结束END--

本文标题: centos6.9怎么搭建pxc集群

本文链接: https://lsjlt.com/news/241563.html(转载时请注明来源链接)

有问题或投稿请发送至: 邮箱/279061341@qq.com    QQ/279061341

猜你喜欢
  • centos6.9怎么搭建pxc集群
    这篇文章主要讲解了“centos6.9怎么搭建pxc集群”,文中的讲解内容简单清晰,易于学习与理解,下面请大家跟着小编的思路慢慢深入,一起来研究和学习“centos6.9怎么搭建pxc集群”吧!一:环境介绍:1.32.49 1.3...
    99+
    2023-06-05
  • centos6.9 搭建rabbitmq 3.6.8集群
    RabbiMQ是用Erang开发的,集群非常方便,因为Erlang天生就是一门分布式语言,但其本身并不支持负载均衡。 RabbiMQ模式RabbitMQ模式大概分为以下三种:(1)单一模式。(2)普通模式(默认的集群模式)。(3)...
    99+
    2023-01-31
    集群 rabbitmq
  • 怎么在MySQL中搭建PXC集群
    本篇文章给大家分享的是有关怎么在MySQL中搭建PXC集群,小编觉得挺实用的,因此分享给大家学习,希望大家阅读完这篇文章后可以有所收获,话不多说,跟着小编一起来看看吧。一、PXC 介绍1.1 PXC 简介PXC 是一套 MySQL 高可用集...
    99+
    2023-06-15
  • PXC三节点集群系统搭建
    1.概念:    Percona Xtradb Cluster,简称PXC。是基于Galera插件的MySQL集群。     ...
    99+
    2024-04-02
  • MySQL之PXC集群搭建的方法步骤
    目录一、PXC 介绍1.1 PXC 简介1.2 PXC特性和优点1.3 PXC的局限和劣势1.4 PXC与Replication的区别二、实践2.1 搭建 PXC 集群2.2 集群同步验证2.3 新增数据库节点操作2...
    99+
    2022-05-12
    MySQL PXC集群搭建 MySQL PXC集群
  • Kubernetes集群怎么搭建
    本篇内容介绍了“Kubernetes集群怎么搭建”的有关知识,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让小编带领大家学习一下如何处理这些情况吧!希望大家仔细阅读,能够学有所成!Kubernetes 是一个可移植的、可扩展的...
    99+
    2023-06-27
  • mysql中如何快速搭建PXC集群以及Mycat分片
    mysql中如何快速搭建PXC集群以及Mycat分片,相信很多没有经验的人对此束手无策,为此本文总结了问题出现的原因和解决方法,通过这篇文章希望你能解决这个问题。 搭建PXC集群参考percona...
    99+
    2024-04-02
  • 集群搭建
      1.  集群搭建之主从复制 MySQL主从复制是一个异步的复制过程,主库发送更新事件到从库,从库读取更新记录,并执行更新记录,使得从库的内容与主库保持一致。 1.1   主服务器的配置 1.1.1   第一步:修改my.con...
    99+
    2017-09-01
    集群搭建
  • Ubuntu怎么搭建Kubernetes集群
    这篇文章主要介绍“Ubuntu怎么搭建Kubernetes集群”的相关知识,小编通过实际案例向大家展示操作过程,操作方法简单快捷,实用性强,希望这篇“Ubuntu怎么搭建Kubernetes集群”文章能帮助大家解决问题。关于 Kuberne...
    99+
    2023-07-04
  • docker怎么搭建redis集群
    要搭建Redis集群,可以使用Docker来简化部署过程。下面是一些搭建Redis集群的步骤: 首先,确保已经安装了Docker...
    99+
    2023-10-26
    docker redis
  • docker mysql集群怎么搭建
    要搭建Docker MySQL集群,可以按照以下步骤进行操作: 安装Docker:在每个节点上安装Docker引擎。 创建D...
    99+
    2023-10-27
    docker mysql
  • redis集群搭建
    Redis 5.0之后版本的高可用集群搭建 Redis系统介绍: Redis的基础介绍与安装使用步骤:https://www.jianshu.com/p/2a23257af57b Redis的基础数据结构与使用:https...
    99+
    2019-03-23
    redis集群搭建
  • mongodb集群搭建
    mongodb集群搭建 小码农叔叔 2019-06-17 22:51:33 4086 收藏 7 分类专栏: mongodb 版权 集群方式有三种:Replica Set、Sharding、Master-Slaver三种方式 常用的主要是副...
    99+
    2014-09-28
    mongodb集群搭建
  • MHA集群搭建
    开篇 本文主要介绍如何搭建MHA集群,希望给你带来帮助 基本环境介绍 Linux:CentOS 7.4 MySQL:5.7.21+传统复制(开启GTID不搭建binlog server) VIP:192.1...
    99+
    2024-04-02
  • Hadoop集群搭建
    文章目录 一、运行环境配置(所有节点)1、基础配置2、配置Host 二、依赖软件安装(101节点)1、安装JDK2、安装Hadoop(root)3、Hadoop目录结构 三、本地运行模式(官方WordCount)1、简介...
    99+
    2023-08-30
    hadoop linux java
  • kafka集群搭建
     一个典型的Kafka 集群中包含若干Producer(可以是web 前端产生的Page View,或者是服务器日志,系统 CPU、Memory 等),若干broker(Kafka 支持水平扩展,一般broker 数量越多,集群吞...
    99+
    2023-01-31
    集群 kafka
  • 搭建Domino群集
    搭建Domino群集浙江省电力办公自动化系统(以下简称:OA系统)是全省推广,统一软件、统一平台、统一规划与实施的一套大型应用系统。它的硬件平台采用IBM的小型机AS/400,软件采用Lotus Domino/Notes,并实施了在一台小型...
    99+
    2023-06-03
  • 搭建Nacos集群
    nacos的默认端口是8848,但是他还占用了另外两个接口:9848、9849。因此,在单机配置集群时,不可使用三个连续的端口,否则会导致 gRPC端口冲突。 端口与主端口(8848)偏移量作用98481000客户端gRPC请求服务端口,用...
    99+
    2023-08-18
    java mysql 开发语言 nacos
  • nacos集群搭建
    在官方文档上面就有结束搭建nacos是介绍 官方文档提供了一个Nacos集群的架构图,当我们访问Nacos时,首先会经过SLB,也就是负载均衡,通常是一个nginx,通过nginx来进行分发到具体的Nacos服务器上面。我们需要给不同的服...
    99+
    2023-08-19
    centos linux 服务器
  • mongodb中怎么搭建shard_replica集群
    本篇文章为大家展示了mongodb中怎么搭建shard_replica集群,内容简明扼要并且容易理解,绝对能使你眼前一亮,通过这篇文章的详细介绍希望你能有所收获。参考官方文档,大致步骤第一步:创建Confi...
    99+
    2024-04-02
软考高级职称资格查询
编程网,编程工程师的家园,是目前国内优秀的开源技术社区之一,形成了由开源软件库、代码分享、资讯、协作翻译、讨论区和博客等几大频道内容,为IT开发者提供了一个发现、使用、并交流开源技术的平台。
  • 官方手机版

  • 微信公众号

  • 商务合作