PXC(PerconaXtraDBCluster)集群安装
作者在2014Oracle数据库嘉年华中有幸听到了关于去哪网的MySQL数据库基于PXC的高可用架构设计主题。 MySQL和Oracle是完全不同的两种数据库,Oracle重于管理,而MySQL更重要的是架构设计。笔者对MySQL以及新技术也是充满了好奇,索性回来自己搭建一个测试环境
作者在2014Oracle数据库嘉年华中有幸听到了关于去哪网的MySQL数据库基于PXC的高可用架构设计主题。
MySQL和Oracle是完全不同的两种数据库,Oracle重于管理,而MySQL更重要的是架构设计。笔者对MySQL以及新技术也是充满了好奇,索性回来自己搭建一个测试环境。
操作系统:CentOS 6.6
软件版本:5.5.39-36.0-55 PerconaXtraDB Cluster (GPL)
节点信息:
pxc1 | 192.168.0.200 |
pxc2 | 192.168.0.201 |
pxc3 | 192.168.0.202 |
安装过程
安装PXC,这里使用的是Percona以及EPEL的官方repositories :
http://www.percona.com/doc/percona-server/5.5/installation/yum_repo.html?id=repositories:yum
http://fedoraproject.org/wiki/EPEL
yum installhttp://www.percona.com/downloads/percona-release/redhat/0.1-3/percona-release-0.1-3.noarch.rpm yum installhttp://mirrors.ustc.edu.cn/fedora/epel/6/i386/epel-release-6-8.noarch.rpm yum -y install Percona-XtraDB-Cluster-serverPercona-XtraDB-Cluster-client Percona-Server-shared-compat percona-xtrabackup
每台机器开启PXC,之后添加SST账户:
DELETE FROM mysql.user WHERE user=''; GRANT RELOAD, LOCK TABLES, REPLICATION CLIENT ON *.* TO 'sstuser'@'localhost' IDENTIFIED BY 'sstuser';; FLUSH PRIVILEGES;
每个节点关闭PXC。编辑第一个节点的PXC设置。
[mysqld] server_id=1 wsrep_provider=/usr/lib64/libgalera_smm.so wsrep_cluster_address="gcomm://192.168.0.200,192.168.0.201,192.168.0.202" wsrep_sst_auth=sstuser:sstuser wsrep_provider_options="gcache.size=4G" wsrep_cluster_name=Percona wsrep_sst_method=xtrabackup wsrep_node_name=pxc1 wsrep_slave_threads=4 log_slave_updates innodb_locks_unsafe_for_binlog=1 innodb_autoinc_lock_mode=2
开启第一个节点(如果集群关闭,每次拥有正确信息的节点使用此命令开启集群)
[root@pxc1 ~]# service mysql bootstrap-pxc Bootstrapping PXC (Percona XtraDBCluster)Starting MySQL (Percona XtraDB Cluster)..[ OK ]
编辑另外两个节点的my.cnf配置文件需要修改的内容:
server_id=2 wsrep_node_name=pxc2
将其他两个节点加入到集群中
service mysql start
至此,集群安装结束。
遇到的问题
以下是配置过程中的报错信息以及解决方法:
现象:
开启PXC节点的时候遇到
Failed to read output of: 'ip addr show | grep -E '^[ ]*inet' | grep -m1global | awk '{ print $2 }' | sed -e 's/\/.*//'' ........ 141120 22:46:35 [ERROR] WSREP: Permission denied 141120 22:46:35 [ERROR] WSREP: failed to open gcomm backend connection: 13:error while trying to listen 'tcp://0.0.0.0:4567?socket.non_blocking=1', asioerror 'Permission denied': 13 (Permission denied)
原因:
由于开启了SELINUX。
解决方法:
编辑文件/etc/sysconfig/selinux
把SELINUX设为disabled
重启后就会忽略selinux,或者直接执行命令
setenforce 0
立即生效。
现象:
添加节点到集群中的时候遇到
last inactive check morethan PT1.5S ago (PT3.50529S), skipping check
卡在这里
原因:
iptables
解决方法:
关闭iptables
chkconfig iptables off
service iptables stop
简单测试
[root@pxc1 ~]# mysql Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 7 Server version: 5.5.39-36.0-55 Percona XtraDB Cluster (GPL), Release rel36.0, Revision 824, WSREP version 25.11, wsrep_25.11.r4023 Copyright (c) 2009-2014 Percona LLC and/or its affiliates Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> show global status like 'wsrep_cluster_size'; +--------------------+-------+ | Variable_name | Value | +--------------------+-------+ | wsrep_cluster_size | 2 | +--------------------+-------+ 1 row in set (0.00 sec) mysql> show global status like 'wsrep_cluster_size'; +--------------------+-------+ | Variable_name | Value | +--------------------+-------+ | wsrep_cluster_size | 3 | +--------------------+-------+ 1 row in set (0.00 sec) mysql> create database dexdb ; Query OK, 1 row affected (0.01 sec) mysql> use dexdb Database changed mysql> create table dextb (id int ,name char(10)) engine=innodb ; Query OK, 0 rows affected (0.03 sec) mysql> insert into dextb values (1,'22') ; Query OK, 1 row affected (0.01 sec) mysql> insert into dextb values (1,'22') ; Query OK, 1 row affected (0.00 sec) mysql> commit ; Query OK, 0 rows affected (0.00 sec) mysql> select * from dextb ; +------+------+ | id | name | +------+------+ | 1 | 22 | | 1 | 22 | +------+------+ 2 rows in set (0.00 sec) [root@pxc2 ~]# mysql Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 6 Server version: 5.5.39-36.0-55 Percona XtraDB Cluster (GPL), Release rel36.0, Revision 824, WSREP version 25.11, wsrep_25.11.r4023 Copyright (c) 2009-2014 Percona LLC and/or its affiliates Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> show database ; ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'database' at line 1 mysql> show databases ; +--------------------+ | Database | +--------------------+ | information_schema | | dexdb | | mysql | | performance_schema | | test | +--------------------+ 5 rows in set (0.01 sec) mysql> use dexdb Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Database changed mysql> select * from dextb ; +------+------+ | id | name | +------+------+ | 1 | 22 | | 1 | 22 | +------+------+ 2 rows in set (0.00 sec) [root@pxc3 ~]# service mysql start MySQL (Percona XtraDB Cluster) is not running, but lock file (/var/lock/subsys/mysql) exists[FAILED] Starting MySQL (Percona XtraDB Cluster).....[ OK ] [root@pxc3 ~]# mysql Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 6 Server version: 5.5.39-36.0-55 Percona XtraDB Cluster (GPL), Release rel36.0, Revision 824, WSREP version 25.11, wsrep_25.11.r4023 Copyright (c) 2009-2014 Percona LLC and/or its affiliates Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> use dexdb Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Database changed mysql> select * from dextb ; +------+------+ | id | name | +------+------+ | 1 | 22 | | 1 | 22 | +------+------+ 2 rows in set (0.00 sec)

热AI工具

Undresser.AI Undress
人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover
用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool
免费脱衣服图片

Clothoff.io
AI脱衣机

Video Face Swap
使用我们完全免费的人工智能换脸工具轻松在任何视频中换脸!

热门文章

热工具

记事本++7.3.1
好用且免费的代码编辑器

SublimeText3汉化版
中文版,非常好用

禅工作室 13.0.1
功能强大的PHP集成开发环境

Dreamweaver CS6
视觉化网页开发工具

SublimeText3 Mac版
神级代码编辑软件(SublimeText3)

Win11系统无法安装中文语言包的解决方法随着Windows11系统的推出,许多用户开始升级他们的操作系统以体验新的功能和界面。然而,一些用户在升级后发现他们无法安装中文语言包,这给他们的使用体验带来了困扰。在本文中,我们将探讨Win11系统无法安装中文语言包的原因,并提供一些解决方法,帮助用户解决这一问题。原因分析首先,让我们来分析一下Win11系统无法

您可能无法在OracleVirtualBox中将来宾添加安装到虚拟机。当我们点击Devices>;InstallGuestAdditionsCDImage时,它只会抛出一个错误,如下所示:VirtualBox-错误:无法插入虚拟光盘C:将FilesOracleVirtualBoxVBoxGuestAdditions.iso编程到ubuntu机器中在这篇文章中,我们将了解当您无法在VirtualBox中安装来宾添加组件时该怎么办。无法在VirtualBox中安装来宾添加如果您无法在Virtua

如果你已经成功下载了百度网盘的安装文件,但是无法正常安装,可能是软件文件的完整性发生了错误或者是残留文件和注册表项的问题,下面就让本站来为用户们来仔细的介绍一下百度网盘下载成功但是安装不了问题解析吧。 百度网盘下载成功但是安装不了问题解析 1、检查安装文件完整性:确保下载的安装文件完整且没有损坏。你可以重新下载一次,或者尝试使用其他可信的来源下载安装文件。 2、关闭杀毒软件和防火墙:某些杀毒软件或防火墙程序可能会阻止安装程序的正常运行。尝试将杀毒软件和防火墙禁用或退出,然后重新运行安装

在Linux上安装安卓应用一直是许多用户所关心的问题,尤其是对于喜欢使用安卓应用的Linux用户来说,掌握如何在Linux系统上安装安卓应用是非常重要的。虽然在Linux系统上直接运行安卓应用并不像在Android平台上那么简单,但是通过使用模拟器或者第三方工具,我们依然可以在Linux上愉快地享受安卓应用的乐趣。下面将为大家介绍在Linux系统上安装安卓应

如果您使用过Docker,则必须了解守护进程、容器及其功能。守护进程是在容器已在任何系统中使用时在后台运行的服务。Podman是一个免费的管理工具,用于管理和创建容器,而不依赖于任何守护程序,如Docker。因此,它在管理集装箱方面具有优势,而不需要长期的后台服务。此外,Podman不需要使用根级别的权限。本指南详细讨论了如何在Ubuntu24上安装Podman。更新系统我们首先要进行系统更新,打开Ubuntu24的Terminalshell。在安装和升级过程中,我们都需要使用命令行。一种简单的

很多新手小伙伴还不了解creo怎么安装,所以下面小编就带来了creo安装的相关教程,有需要的小伙伴赶紧来看一下吧,希望可以帮助大家。1、打开下载好的安装包,找到License文件夹,如下图所示:2、然后把它复制到C盘的目录里面,如下图所示:3、双击进入,看看有没有许可文件,如下图所示:4、然后把许可文件复制到此文件中,如下图所示:5、在C盘的PROGRAMFILES文件中,新建一个PLC文件夹,如下图所示:6、把许可文件也复制一份进来,如下图所示:7、双击主程序的安装文件。进行安装,勾选安装新软

在高中学习的时候,有些学生做的笔记非常清晰准确,比同一个班级的其他人都做得更多。对于一些人来说,记笔记是一种爱好,而对于其他人来说,当他们很容易忘记任何重要事情的小信息时,则是一种必需品。Microsoft的NTFS应用程序对于那些希望保存除常规讲座以外的重要笔记的学生特别有用。在这篇文章中,我们将描述Ubuntu24上的Ubuntu应用程序的安装。更新Ubuntu系统在安装Ubuntu安装程序之前,在Ubuntu24上我们需要确保新配置的系统已经更新。我们可以使用Ubuntu系统中最著名的“a

在Win7系统下安装Go语言是一项相对简单的操作,只需按照以下步骤进行操作即可成功安装。下面将详细介绍Win7系统下安装Go语言的方法。第一步:下载Go语言安装包首先,打开Go语言官方网站(https://golang.org/),进入下载页面。在下载页面中,选择与Win7系统兼容的安装包版本进行下载。点击下载按钮,等待安装包下载完成。第二步:安装Go语言下
