1、安裝
安裝地址:https://www.percona.com/downloads/
yum -y remove Percona-Server*
yum -y install percona-xtrabackup-24*
yum -y install Percona-XtraDB-Cluster-57*
報錯:Error: Package: percona-xtrabackup-24-2.4.11-1.el7.x86_64 (percona-cluster)
Requires: libev.so.4()(64bit)
解決:安裝 libev-4.15-3.el7.x86_64.rpm
報錯:Error: Package: Percona-XtraDB-Cluster-server-57-5.7.21-29.26.1.el7.x86_64 (percona-cluster)
Requires: qpress
解決:安裝 qpress-1.1-8.1.x86_64.rpm
2、啟動:service mysql start
失敗報錯:
2018-05-13T17:56:39.752463Z 0 [ERROR] WSREP: wsrep_load(): dlopen(): /usr/lib64/galera3/libgalera_smm.so: symbol SSL_COMP_free_compression_methods, version libssl.so.10 not defined in file libssl.so.10 with link time reference
2018-05-13T17:56:39.752477Z 0 [ERROR] WSREP: wsrep_load() failed to load the provider('/usr/lib64/galera3/libgalera_smm.so'): Invalid argument (22). Need to abort.
2018-05-13T17:56:39.752480Z 0 [ERROR] Aborting
解決方法: 升級openssl
安裝
openssl-1.0.2k-8.el7.x86_64.rpm
openssl-libs-1.0.2k-8.el7.x86_64.rpm
openssl-devel-1.0.2k-8.el7.x86_64.rpm
可以直接force安裝,可以將之前版本覆蓋。
3、修改root密碼
可以在/vr/log/mysqld.log中找到root的口令
mysql -u root -p
set password=password('123456');flush privileges;quit;
4、 修改wsrep.conf
第一個:
[root@10-248-56-192 percona-xtradb-cluster.conf.d]# cat wsrep.cnf
[mysqld]
#Path to Galera library
wsrep_provider=/usr/lib64/galera3/libgalera_smm.so
#Cluster connection URL contains IPs of nodes
#If no IP is found, this implies that a new cluster needs to be created,
#in order to do that you need to bootstrap this node
wsrep_cluster_address=gcomm://10.248.56.192,10.248.56.195,10.248.56.209
#In order for Galera to work correctly binlog format should be ROW
binlog_format=ROW
#MyISAM storage engine has only experimental support
default_storage_engine=InnoDB
#Slave thread to use
wsrep_slave_threads= 8
wsrep_log_conflicts
#This changes how InnoDB autoincrement locks are managed and is a requirement for Galera
innodb_autoinc_lock_mode=2
#Node IP address
wsrep_node_address=10.248.56.192
#Cluster name
wsrep_cluster_name=pxc-cluster
#If wsrep_node_name is not specified, then system hostname will be used
wsrep_node_name=pxc-cluster-node-1
#pxc_strict_mode allowed values: DISABLED,PERMISSIVE,ENFORCING,MASTER
pxc_strict_mode=ENFORCING
#SST method
wsrep_sst_method=xtrabackup-v2
#Authentication for SST method
wsrep_sst_auth="sstuser:s3cretPass"
第二個:
[root@10-248-56-195 percona-xtradb-cluster.conf.d]# cat wsrep.cnf
[mysqld]
#Path to Galera library
wsrep_provider=/usr/lib64/galera3/libgalera_smm.so
#Cluster connection URL contains IPs of nodes
#If no IP is found, this implies that a new cluster needs to be created,
#in order to do that you need to bootstrap this node
wsrep_cluster_address=gcomm://10.248.56.192,10.248.56.195,10.248.56.209
#In order for Galera to work correctly binlog format should be ROW
binlog_format=ROW
#MyISAM storage engine has only experimental support
default_storage_engine=InnoDB
#Slave thread to use
wsrep_slave_threads= 8
wsrep_log_conflicts
#This changes how InnoDB autoincrement locks are managed and is a requirement for Galera
innodb_autoinc_lock_mode=2
#Node IP address
wsrep_node_address=10.248.56.195
#Cluster name
wsrep_cluster_name=pxc-cluster
#If wsrep_node_name is not specified, then system hostname will be used
wsrep_node_name=pxc-cluster-node-2
#pxc_strict_mode allowed values: DISABLED,PERMISSIVE,ENFORCING,MASTER
pxc_strict_mode=ENFORCING
#SST method
wsrep_sst_method=xtrabackup-v2
#Authentication for SST method
wsrep_sst_auth="sstuser:s3cretPass"
第三個:
[root@10-248-56-192 percona-xtradb-cluster.conf.d]# cat wsrep.cnf
[mysqld]
#Path to Galera library
wsrep_provider=/usr/lib64/galera3/libgalera_smm.so
#Cluster connection URL contains IPs of nodes
#If no IP is found, this implies that a new cluster needs to be created,
#in order to do that you need to bootstrap this node
wsrep_cluster_address=gcomm://10.248.56.192,10.248.56.195,10.248.56.209
#In order for Galera to work correctly binlog format should be ROW
binlog_format=ROW
#MyISAM storage engine has only experimental support
default_storage_engine=InnoDB
#Slave thread to use
wsrep_slave_threads= 8
wsrep_log_conflicts
#This changes how InnoDB autoincrement locks are managed and is a requirement for Galera
innodb_autoinc_lock_mode=2
#Node IP address
wsrep_node_address=10.248.56.209
#Cluster name
wsrep_cluster_name=pxc-cluster
#If wsrep_node_name is not specified, then system hostname will be used
wsrep_node_name=pxc-cluster-node-3
#pxc_strict_mode allowed values: DISABLED,PERMISSIVE,ENFORCING,MASTER
pxc_strict_mode=ENFORCING
#SST method
wsrep_sst_method=xtrabackup-v2
#Authentication for SST method
wsrep_sst_auth="sstuser:s3cretPass"
5、啟動第一個節點:
systemctl restart mysql@bootstrap.service
show status like 'wsrep_%'; 查看現在集群狀態
6、啟動第二個節點:
需要將my.cnf中的sever_id與其他節點不一致
service mysql restart
[root@10-248-56-195 log]# pwd
/var/log/mysqld.log
2018-05-14T09:17:56.600663Z WSREP_SST: [INFO] ............Waiting for SST streaming to complete!
2018-05-14T09:17:57.737279Z 0 [Note] WSREP: (aeddf750, 'tcp://0.0.0.0:4567') turning message relay requesting off
2018-05-14T09:18:06.585389Z WSREP_SST: [ERROR] ******************* FATAL ERROR **********************
2018-05-14T09:18:06.587149Z WSREP_SST: [ERROR] xtrabackup_checkpoints missing. xtrabackup/SST failed on DONOR. Check DONOR log
2018-05-14T09:18:06.588852Z WSREP_SST: [ERROR] ******************************************************
2018-05-14T09:18:06.591227Z WSREP_SST: [ERROR] Cleanup after exit with status:2
2018-05-14T09:18:06.602013Z 0 [ERROR] WSREP: Process completed with error: wsrep_sst_xtrabackup-v2 --role 'joiner' --address '10.248.56.195' --datadir '/data0/mysql/' --defaults-file '/etc/my.cnf' --defaults-group-suffix '' --parent '27460' '' : 2 (No such file or directory)
主節點日志:
[root@10-248-56-192 mysql]#
/data0/mysql/innobackup.backup.log
報錯:
180514 17:14:44 version_check Connecting to MySQL server with DSN 'dbi:mysql:;mysql_read_default_group=xtrabackup;mysql_socket=/var/lib/mysql/mysql.sock' as 'sstuser' (using password: YES).
Failed to connect to MySQL server: DBI connect(';mysql_read_default_group=xtrabackup;mysql_socket=/var/lib/mysql/mysql.sock','sstuser',...) failed: Access denied for user 'sstuser'@'localhost' (using password: YES) at - line 1314.
180514 17:14:44 Connecting to MySQL server host: localhost, user: sstuser, password: set, port: not set, socket: /var/lib/mysql/mysql.sock
Failed to connect to MySQL server: Access denied for user 'sstuser'@'localhost' (using password: YES).
解決:
在主節點mysql內添加sstuser 用戶:
create user 'sstuser'@'%' identified by 's3cretPass';
報錯:180514 17:18:06 Executing LOCK TABLES FOR BACKUP...
Error: failed to execute query LOCK TABLES FOR BACKUP: Access denied; you need (at least one of) the RELOAD privilege(s) for this operation
----提示:缺少reload權限
查看用戶權限:
select user,host,Reload_priv from user where user='sstuser';
授權:
GRANT ALL PRIVILEGES ON *.* TO 'sstuser'@'localhost' IDENTIFIED BY 's3cretPass' WITH GRANT OPTION;
Delete FROM user Where User='sstuser' and Host='%';
7、啟動第三個節點
service mysql restart
8、測試
需要每個表建立主鍵
mysql> insert into kangning values (1,'ddd'),(2,'xxx'),(3,'ssss');
ERROR 1105 (HY000): Percona-XtraDB-Cluster prohibits use of DML command on a table (test.kangning) without an explicit primary key with pxc_strict_mode = ENFORCING or MASTER
mysql> alter table kangning add primary key(id);
mysql> insert into kangning values (1,'ddd'),(2,'xxx'),(3,'ssss');
Query OK, 3 rows affected (0.01 sec)
Records: 3 Duplicates: 0 Warnings: 0
- 一、日常運維腳本
- 1.1 批量創建用戶并賦予sudo權限
- 1.2 批量主機建立互信
- 1.3create_images.sh
- 1.4monitor.sh
- 1.5ftp腳本
- 1.6格式化分區
- 1.7簡單的遠程執行腳本
- 二、常用服務使用
- 1 ceph (分布式文件系統)
- 1.1 ceph 簡介
- 1.2 準備環境
- 1.3 開始部署
- 1.4 cephfs掛載
- 1.5 RBD塊存儲
- 1.6 object 對象存儲
- 1.7 集群擴展
- 1.7.1 增加刪除MON
- 1.7.2 增加刪除OSD
- 1.7.3 刪除MDS
- 注意事項
- 遇到的問題
- 1.8ceph查找數據文件
- 1.9卸載并清理環境
- 2、mysql (數據庫)
- 2.1 搭建
- 2.2 使用教程
- 2.2.1 mysql基礎配置
- 2.2.1.1 用戶權限管理
- 2.2.1.2用戶資源限制
- 2.2.1.3 密碼管理
- 2.2.1.4用戶lock
- 2.2.2mysql語法詳解
- 2.2.1建庫、表語句
- 2.2.2.2 插入 insert
- 2.2.2.3更新 update
- 2.2.2.4刪除 delete
- 2.2.2.5查詢 select
- 2.2.6視圖 索引 view index
- 2.2.7 修改 alert
- 2.2.2.8清理 truncate drop
- 2.2.9重命名 rename
- 示例語句
- 2.2.3mysql常用函數
- 2.3.1 對比操作符統概
- 2.3.2對比操作符詳解
- 2.3.3邏輯操作符
- 2.2.4分配操作符
- 2.2.5流程控制函數
- 2.2.6字符串函數
- 2.2.7字符串對比函數
- 2.2.8數字函數
- 2.2.9日期和時間函數
- 2.2.10聚合/格式轉換函數
- 2.2.11 子查詢
- 示例語句
- 2.2.4 mysql 高級應用
- 2.2.4.1 存儲過程 函數
- 2.2.4.2流程控制
- 2.2.4.3游標
- 2.2.4.4觸發器
- 課堂練習
- 2.2.2.5 數據庫設計
- 2.2.5.1 數據類型
- 2.2.5.2存儲引擎
- 2.2.6Innodb內核
- 1、innodb事務和多版本控制
- 2、體系結構
- 3、InnoDB配置
- 4、buffer pool設置
- 5、其他配置
- innodb限制
- 2.7 字符集
- 2.8鎖機制和事務
- 2.8.1鎖機制
- 2.8.2事務
- 2.9分區
- 2.9.1 自動分區
- 2.10復制
- 2.11mysql搬移數據目錄
- 2.12組復制 GR
- 簡介
- 搭建
- 2.3日常運維
- 2.3.1定時任務
- 2.4mycat
- 2.4.1 報錯分析
- 2.4.2 修改字符集
- 2.11 mycat使用
- 2.5遇到問題
- 2.5.1 表名庫名忽略大小寫
- 3、PAAS平臺搭建
- 問題匯總
- 1、docker
- 2、日常運維
- 3.1 Kubernetes
- 3.1 kubernetes 高版本搭建
- 4、GlusterFS搭建
- 5、MooseFS搭建
- 5.1搭建
- 5.2運維
- 5.2.1 mfs日志解析
- 5.2.2清理mfs的垃圾數據
- 5.2.3元數據故障恢復
- 5.2.4 MFS優化
- 5.2.5 配置機架感知
- 5.2.6 客戶端工具集
- 6、集群切換命令
- 7、ntp服務
- 8、monggoDB
- 8.1搭建單機
- 2、搭建集群及分片
- 9、MariaDB Galera Cluster
- 9.1源碼安裝MariaDB
- 9.2galera cluster 優劣
- 9.3 rpm安裝mariadb
- 10 HAproxy1.7搭建
- 11、sysbench 搭建使用
- 0.5版本
- 12 percona-xtradb-cluster
- 13http服務相關
- 13.1 http狀態碼解析
- 14 zookeeper
- 14.1 zookeeper日志查看
- 14.2 配置解析
- 14.3 優化
- 15搭建私有pip源
- 16/var/log的日志文件解釋
- 15 ansible的搭建及使用
- 15.1 搭建
- 15.2 使用說明
- 16. 搭建本地yum源
- zookeeper
- 優化
- 四、開發語言
- 1、GO語言
- 1.1go簡介
- 1.1.1hello_world初識GO
- 1.1.2并發介紹
- 1.1.3 chan介紹
- 1.1.4多返回值
- 1.2go基礎
- 1.2.1數據類型
- 1.2.2 go基礎結構
- 1.2.3 const及變量介紹
- 1.2.3os和time介紹
- 1.2.4 字符串
- 1.2.5條件判斷
- 1.2.6 homework
- go--help
- 1.3 go基礎2
- 1.3.1 數組 array
- 1.3.2切片 slice
- 1.3.3 時間和日期
- 1.3.4指針類型
- 1.3.5函數
- 1.3.6可變參數
- 1.3.7 defer
- 1.3.8遞歸
- 1.9閉包
- 1.10 map
- 1.11 sort
- 1.12 struct 結構體
- 2.perl語言
- 2.1 安裝lib包
- 3 python
- 1.語言基礎
- 2、編程教學
- 2.1變量和序列
- 2.2 條件語句