首页 > 其他分享 >PXC 57 二进制安装

PXC 57 二进制安装

时间:2023-08-26 12:33:47浏览次数:37  
标签:12 二进制 57 -- 2018 mysql PXC WSREP usr

1.准备阶段
1.1 在三个节点上分别创建:用户组 用户组 目录
    --用户组 用户组
    #/usr/sbin/groupadd mysql
    #/usr/sbin/useradd -g mysql mysql

    --目录
    #mkdir –p  /usr/local/mysql
    #chown -R mysql:mysql /usr/local/mysql
    #chmod -R  755 /usr/local/mysql

    #mkdir -p  /mysql/3306/{data,redo,binlog,tmp,logs}
    #chown -R  mysql:mysql /mysql
    #chmod -R  755 /mysql

1.2 修改内核参数
    切换到root用户
    [root@DBMysql2 ~]# vi  /etc/security/limits.conf 
    mysql   soft    nproc   65535
    mysql   hard    nproc   65535
    mysql   soft    nofile  65535
    mysql   hard    nofile  65535
    [root@node1 ~]#
    

2.开始部署
2.1 三个节点分别安装依赖包:
    yum -y install percona-xtrabackup-24-2.4.12-1.el7.x86_64.rpm
    yum -y install 
    
2.2 解压Percona-XtraDB-Cluster
    在mysql用户下,将压缩包(Percona-XtraDB-Cluster-5.7.23-rel23-31.31.2.Linux.x86_64.ssl101.tar)解压到 /usr/local/mysql下
    [mysql@node1 mysql]$ pwd
    /usr/local/mysql
    [mysql@node1 mysql]$ ls -l
    总用量 88
    drwxrwxr-x.  2 mysql mysql  4096 12月 19 14:28 bin
    -rw-rw-r--.  1 mysql mysql 17987 12月 19 14:31 COPYING
    -rw-rw-r--.  1 mysql mysql  1703 12月 19 14:31 COPYING-jemalloc
    -rw-rw-r--.  1 mysql mysql 17987 12月 19 14:31 COPYING-test
    drwxrwxr-x.  2 mysql mysql    55 12月 19 14:28 docs
    drwxrwxr-x.  3 mysql mysql  4096 12月 19 14:28 include
    drwxrwxr-x.  4 mysql mysql   228 12月 19 14:28 lib
    drwxrwxr-x.  4 mysql mysql    30 12月 19 14:28 man
    drwxrwxr-x. 10 mysql mysql  4096 12月 19 14:31 mysql-test
    drwxrwxr-x.  5 mysql mysql    50 12月 19 14:31 percona-xtradb-cluster-tests
    -rw-rw-r--.  1 mysql mysql  2478 12月 19 14:31 README.MySQL
    -rw-rw-r--.  1 mysql mysql   444 12月 19 14:31 README-test
    -rw-rw-r--.  1 mysql mysql 19626 12月 19 14:31 README-wsrep
    drwxrwxr-x. 28 mysql mysql  4096 12月 19 14:31 share
    drwxrwxr-x.  2 mysql mysql   110 12月 19 14:31 support-files
    drwxrwxr-x.  2 mysql mysql    22 12月 19 14:31 xinetd.d
    [mysql@node1 mysql]$    

2.3 创建my.cnf配置文件(只截取pxc部分)
    #pxc
    server_id  = 1
    wsrep_provider=/usr/local/mysql/lib/libgalera_smm.so  
    wsrep_cluster_name=pxc-mysql
    wsrep_cluster_address=gcomm://192.168.2.55,192.168.2.56,192.168.2.57
    wsrep_node_name=node1
    wsrep_node_address=192.168.2.55
    wsrep_sst_method=xtrabackup-v2 
    wsrep_sst_auth=pxc:123456
    pxc_strict_mode=ENFORCING 
    binlog_format=ROW 
    default_storage_engine=InnoDB
    innodb_autoinc_lock_mode=2

    注意:
    其他两个个节点,只需要修改:
    server-id=1             --id不能一样
    wsrep_node_name=node1   --改成自己节点的主机名
    wsrep_node_address=192.168.2.55  --改成自己节点的主机IP
    
    
2.4 各个节点分别初始化数据库:
    ./mysqld --defaults-file=/mysql/3306/my.cnf --initialize
    ./mysqld --defaults-file=/mysql/3306/my.cnf --initialize
    ./mysqld --defaults-file=/mysql/3306/my.cnf --initialize

2.5 启动节点node1
    ./mysqld_safe --defaults-file=/mysql/3306/my.cnf --wsrep-new-cluster  &
    

2.6 在node1节点修改密码,创建复制用户
    --修改密码
    (root@localhost:mysql.sock) [(none)]>set password='123456';
    Query OK, 0 rows affected (0.32 sec)      
    ---创建一个SST用户
    (root@localhost:mysql.sock) [(none)]>GRANT RELOAD, LOCK TABLES, PROCESS, REPLICATION CLIENT ON *.* TO 'pxc'@'%' IDENTIFIED BY '123456';    ---创建一个SST用户    
    
2.7 启动节点node2、node3    
    ./mysqld_safe --defaults-file=/mysql/3306/my.cnf  --user=mysql &
    ./mysqld_safe --defaults-file=/mysql/3306/my.cnf  --user=mysql &

3、验证集群
   --节点node1
   (root@localhost:mysql.sock) [(none)]>show status like 'wsrep_cluster_%';
    +--------------------------+--------------------------------------+
    | Variable_name            | Value                                |
    +--------------------------+--------------------------------------+
    | wsrep_cluster_weight     | 3                                    |
    | wsrep_cluster_conf_id    | 3                                    | --表示3个节点
    | wsrep_cluster_size       | 3                                    |
    | wsrep_cluster_state_uuid | 1814041e-0365-11e9-9a41-53781b688bfb |
    | wsrep_cluster_status     | Primary                              |
    +--------------------------+--------------------------------------+
    5 rows in set (0.00 sec)

    (root@localhost:mysql.sock) [(none)]>
    
    --任意一个节点执行创建数据库操作,看其他节点是否同步
    PXC-01:
    (root@localhost:mysql.sock) [(none)]>> create database pxc01;          #注意查看其他节点是否同步
    PXC-02:
    (root@localhost:mysql.sock) [(none)]>> create database pxc02;         #注意查看其他节点是否同步
    PXC-03:
    (root@localhost:mysql.sock) [(none)]>> create database pxc03;          #注意查看其他节点是否同步

    停止数据库:
    --最后停主节点
    ./mysqladmin --defaults-file=/mysql/3306/my.cnf -uroot -p123456 -hlocalhost shutdown    

4.部署期间遇到的问题:

    --关闭防火墙:systemctl stop firewalld
    2018-12-19T08:44:46.598184Z 0 [Warning] WSREP: last inactive check more than PT1.5S (3*evs.inactive_check_period) ago (PT3.5271S), skipping check
    2018-12-19T08:45:16.264325Z 0 [Note] WSREP: Current view of cluster as seen by this node
    view ((empty))
    2018-12-19T08:45:16.266833Z 0 [ERROR] WSREP: failed to open gcomm backend connection: 110: failed to reach primary view (pc.wait_prim_timeout): 110 (Connection timed out)
             at gcomm/src/pc.cpp:connect():159
    2018-12-19T08:45:16.267665Z 0 [ERROR] WSREP: gcs/src/gcs_core.cpp:gcs_core_open():209: Failed to open backend connection: -110 (Connection timed out)
    2018-12-19T08:45:16.272534Z 0 [ERROR] WSREP: gcs/src/gcs.cpp:gcs_open():1514: Failed to open channel 'pxc-mysql' at 'gcomm://192.168.2.55,192.168.2.56,192.168.2.57': -110 (Connection timed out)
    2018-12-19T08:45:16.272618Z 0 [ERROR] WSREP: gcs connect failed: Connection timed out
    2018-12-19T08:45:16.272647Z 0 [ERROR] WSREP: Provider/Node (gcomm://192.168.2.55,192.168.2.56,192.168.2.57) failed to establish connection with cluster (reason: 7)
    2018-12-19T08:45:16.272676Z 0 [ERROR] Aborting

    2018-12-19T08:45:16.272695Z 0 [Note] Giving 0 client threads a chance to die gracefully
    2018-12-19T08:45:16.272723Z 0 [Note] WSREP: Waiting for active wsrep applier to exit
    2018-12-19T08:45:16.272741Z 0 [Note] WSREP: Service disconnected.
    2018-12-19T08:45:16.272756Z 0 [Note] WSREP: Waiting to close threads......
    2018-12-19T08:45:21.274280Z 0 [Note] WSREP: Some threads may fail to exit.
    2018-12-19T08:45:21.275314Z 0 [Note] Binlog end
    2018-12-19T08:45:21.277021Z 0 [Note] /usr/local/mysql/bin/mysqld: Shutdown complete

    

    --安装 percona-xtrabackup-24-2.4.12-1.el7.x86_64.rpm
    2018-12-20T05:53:59.541638Z 0 [Note] WSREP: Initiating SST/IST transfer on JOINER side (wsrep_sst_xtrabackup-v2 --role 'joiner' --address '192.168.2.56' --datadir '/my
    sql/3306/data/' --defaults-file '/mysql/3306/my.cnf' --defaults-group-suffix '' --parent '14448' --mysqld-version '5.7.23-23-31.31'   '' )
    which: no xtrabackup in (/usr/sbin:/sbin:/usr/local/mysql/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/home/mysql/.local/bin:/home/mysql/bin)
            2018-12-20T05:53:59.695991Z WSREP_SST: [ERROR] ******************* FATAL ERROR ********************** 
            2018-12-20T05:53:59.700710Z WSREP_SST: [ERROR] xtrabackup not in path: /usr/sbin:/sbin:/usr/local/mysql/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/s
    bin:/home/mysql/.local/bin:/home/mysql/bin
            2018-12-20T05:53:59.705288Z WSREP_SST: [ERROR] ****************************************************** 
    2018-12-20T05:53:59.708133Z 0 [ERROR] WSREP: Failed to read 'ready <addr>' from: wsrep_sst_xtrabackup-v2 --role 'joiner' --address '192.168.2.56' --datadir '/mysql/330
    6/data/' --defaults-file '/mysql/3306/my.cnf' --defaults-group-suffix '' --parent '14448' --mysqld-version '5.7.23-23-31.31'   '' 
            Read: '(null)'
    2018-12-20T05:53:59.708181Z 0 [ERROR] WSREP: Process completed with error: wsrep_sst_xtrabackup-v2 --role 'joiner' --address '192.168.2.56' --datadir '/mysql/3306/data
    /' --defaults-file '/mysql/3306/my.cnf' --defaults-group-suffix '' --parent '14448' --mysqld-version '5.7.23-23-31.31'   '' : 2 (No such file or directory)
    2018-12-20T05:53:59.708302Z 2 [ERROR] WSREP: Failed to prepare for 'xtrabackup-v2' SST. Unrecoverable.
    2018-12-20T05:53:59.708333Z 2 [ERROR] Aborting


    
    ---主节点忘记安装:percona-xtrabackup-24-2.4.12-1.el7.x86_64.rpm
    2018-12-20T07:27:52.624492Z 2 [Note] WSREP: Requesting state transfer: success, donor: 0
    2018-12-20T07:27:52.624544Z 2 [Note] WSREP: GCache history reset: 00000000-0000-0000-0000-000000000000:0 -> 1814041e-0365-11e9-9a41-53781b688bfb:3
    2018-12-20T07:27:52.769911Z 0 [Warning] WSREP: 0.0 (node1): State transfer to 1.0 (node2) failed: -2 (No such file or directory)
    2018-12-20T07:27:52.769950Z 0 [ERROR] WSREP: gcs/src/gcs_group.cpp:gcs_group_handle_join_msg():766: Will never receive state. Need to abort.
    2018-12-20T07:27:52.770158Z 0 [Note] WSREP: gcomm: terminating thread
    2018-12-20T07:27:52.770181Z 0 [Note] WSREP: gcomm: joining thread

 

标签:12,二进制,57,--,2018,mysql,PXC,WSREP,usr
From: https://blog.51cto.com/u_14682436/7242507

相关文章

  • 二进制
    二进制给定一个长度为$N$的二进制串($01$串)以及一个正整数$K$。按照从左到右的顺序,依次遍历给定二进制串的$N-K+1$个长度为$K$的子串,并计算每个遍历子串的各位数字之和。将这$N-K+1$个子串数字和按照子串的遍历顺序进行排列,得到的序列就是给定二进制串的$\texttt{K-}......
  • k8s 下安装 pxc
    https://artifacthub.io/packages/helm/percona/pxc-operator安装helmrepoaddperconahttps://percona.github.io/percona-helm-charts/helminstallperconapercona/pxc-operator--version1.13.0--namespacepercona--create-namespacehelminstallmy-dbpercona......
  • pd.read_csv pandas.errors.ParserError: Error tokenizing data. C error: Expected
    df1=pd.read_csv(path1,encoding="utf-8",chunksize=50000,error_bad_lines=False)尽管提示:Warning(fromwarningsmodule):File"D:\Python37\lib\idlelib\run.py",line550exec(code,self.locals)FutureWarning:Theerror_bad_linesargu......
  • Leetcode——1957、删除字符使字符串变好
    一个字符串如果没有 三个连续 相同字符,那么它就是一个 好字符串 。给你一个字符串 s ,请你从 s 删除 最少 的字符,使它变成一个 好字符串 。请你返回删除后的字符串。题目数据保证答案总是 唯一的 。 示例1:输入:s="leeetcode"输出:"leetcode"解释:从第一组'......
  • CF757G 题解
    Lnk。这是一个dfs序+主席树的乱搞做法。首先把树上距离拆开,令\(\operatorname{dis}(u)\)表示\(u\)到根的路径长度:\[\left(\sum_{i=l}^r\operatorname{dis}(p_i)\right)+\left(\sum_{i=l}^r\operatorname{dis}(x)\right)-2\sum_{i=l}^r\operatorname{dis}(\operatorna......
  • C语言实现十进制转为二进制 递归法
    //ConsoleApplication15.cpp:此文件包含"main"函数。程序执行将在此处开始并结束。//  #include<iostream>#include<stdio.h>usingnamespacestd;voidto_binary(unsignedlongn);intmain(void){  unsignedlongnumber;  printf("Enteraninteger(......
  • P9572 Colorful Days♪
    思路Step0.骗分显然,题目中的\(c_1,c_2\)就是为了送分,如果比赛中没有思路,倒是可以直接输出两个\(0\)先得到\(2\)分,聊胜于无。Step1.暴力不出奇迹显然第一个想到的是暴力,枚举\(k\),容易观察得出,若一次增加\(k\)而LCS不变,则再增加\(k\)也无用。可凭借这个结论暴力验......
  • P9574 「TAOI-2」Break Through the Barrier
    思路首先我们可以肯定的是,无论如何变化,答案最多比原序列的连续\(T\)的个数多\(2\)。理由很简单,对于\(...BT...TB...\),最好的可能就是前后两个\(B\)可以变成\(T\),因为只可能是\(BTTB\)变成\(TBBT\),所以变了以后再外面就一定是\(B\)了,且无法再变。所以我们可以先找到......
  • P9571 Horizon Blue
    思路首先分析一下操作\(2,3\)。对于操作\(2\),容易发现如果\(k\)相等,就只可能是平行或者重合,显然不满足,那么答案就是总剩余直线数减去\(k\)相同的直线数。对于操作\(3\),发现只有平行的直线不会被删去,也就是只有\(k\)相同而\(b\)不同的直线不会被删去。如此一来,这道......
  • P9575 「TAOI-2」喵了个喵 Ⅳ
    思路考试的时候打死没想出来,一直在想暴力和质因数分解,我实在是太弱了,比赛后看了官方题解才恍然大悟,于是来蹭写篇题解。首先是一些特殊点:当\(n\)是偶数时,显然\(x\)可以取\(1\),这样\(\gcd\)就都是\(1\),然后随便平分就好了。恭喜你,你获得了\(2\)分。当\(n\)不是......