In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
PXC installation is very simple!
-- Software download
Https://www.percona.com/downloads/Percona-XtraDB-Cluster-57/LATEST/
-- basic environmental preparation
[root@node2 ~] # vim / etc/hosts-add the following information to the 3-node hosts file
192.168.2.100 node1
192.168.2.200 node2
192.168.2.210 node3
[root@localhost] # rpm-e-- nodeps mariadb mariadb-server mariadb-libs marisa-- Uninstall
1, 3 nodes install dependency packages
Yum install-y git scons gcc* gcc-c++ openssl* check cmake bison\ boost-devel asio-devel libaio-devel ncurses-devel readline-devel pam-devel\ socat perl-time-hires perl-io-socket-ssl.noarch perl-dbd-mysql.x86_64
-- extract the package and install:
Note to download the package: remember to choose the ssl101 version, the official user manual has the following instructions
[root@localhost] # rpm-ivh libev-4.15-1.el6.rf.x86_64.rpm [root@localhost ~] # rpm-ivh percona-xtrabackup-24-2.4.11-1.el7.x86_64.rpm [root@node1 ~] # tar zxvf Percona-XtraDB-Cluster-5.7.21-rel20-29.26.1.Linux.x86_64.ssl101.tar.gz-C / usr/local/ ^ C [root@node1 ~] # cd / usr/local/ [ Root@node1 local] # ln-s Percona-XtraDB-Cluster-5.7.21-rel20-29.26.1.Linux.x86_64.ssl101.tar.gz pxc_mysql
2. To create a user, please authorize [all three nodes] to create a new folder:
[root@localhost ~] # userdel mysql [root@localhost ~] # useradd-g mysql mysql [root@localhost ~] # passwd mysql [root@localhost ~] # mkdir-p / usr/local/pxc_mysql/ {data,logs,tmp} [root@localhost ~] # mkdir-p / usr/local/pxc_mysql/logs/ binlog [root @ localhost ~] # chown-R mysql:mysql / usr/local/pxc_mysql/ [root @ localhost ~] # chmod-R + x / usr/local/pxc_mysql/
3. Switch mysql users to create my.cnf (the configuration file has only a few simple parameters, if the production environment requires more database parameters)
[root@node1 ~] # su-mysql [mysql@node1 ~] $cd / usr/local/pxc_mysql/ [MySQL @ node1 pxc_mysql] $vi my.cnf [client] socket=/usr/local/pxc_mysql/ data [mysqld] server-id=142port = 3306basedir=/usr/local/pxc_mysqldatadir=/usr/local/pxc_mysql/datasocket=/usr/local/pxc_mysql/data/mysql.socklog-error=/usr/local/pxc_mysql/data/mysqld.logpid-file=/usr/local/pxc_mysql / data/mysqld.pidlog-bin=/usr/local/pxc_mysql/logsslow_query_log_file = / usr/local/pxc_mysql/data/slow.loglog_slave_updatesexpire_logs_days=7binlog_format=ROWinnodb_buffer_pool_size = 1524M#pxcwsrep_provider=/usr/local/pxc_mysql/lib/libgalera_smm.so wsrep_cluster_name=pxc-niewsrep_cluster_address=gcomm://192.168.2.100192.168.2.200192.168.2.210wsrep_node_name=node1wsrep_node_address=192.168 .2.100wsrep _ sst_method=xtrabackup-v2 wsrep_sst_auth=pxc:123456pxc_strict_mode=ENFORCING binlog_format=ROW default_storage_engine=InnoDBinnodb_autoinc_lock_mode=2
Note:
The other two nodes only need to be modified:
Server-id=142-- id can't be the same
Wsrep_node_name=node1-change to the hostname of your own node
Wsrep_node_address=192.168.2.100-- changed to the host IP of your own node
4. Initialize the database with 3 nodes
/ usr/local/pxc_mysql/bin/mysqld-defaults-file=/usr/local/pxc_mysql/my.cnf-datadir=/usr/local/pxc_mysql/data-basedir=/usr/local/pxc_mysql-initialize
(there is a root password in the / usr/local/pxc_mysql/data/mysqld.log log)
5. Start the first node first:
[root@node1 pxc_mysql] # / usr/local/pxc_mysql/bin/mysqld_safe-- defaults-file=/usr/local/pxc_mysql/my.cnf-- wsrep-new-cluster-- user=mysql &-- start with root
Then enter MySQL and perform the following operations (if you cannot enter, the password has expired, then add: skip-grant-tables in the my.cnf file, and then enter the database without a password: update mysql.user set password_expired= "N" where user= "root"; finally, remove the parameters from the configuration file, restart the database, and enter with the root password you just had. )
MySQL [(none)] > show databases +-+ | Database | +-+ | information_schema | | mysql | | performance_schema | | sys | +-+ 4 rows in set (0.00 sec) MySQL [(none)] > show status like 'wsrep_local_state%' +-- +-+ | Variable_name | Value | +- -- +-+ | wsrep_local_state_uuid | c2ab52e7-67cf-11e8-9d02-e76acee85210 | | wsrep_local_state | 4 | | wsrep_local_state_comment | Synced | +- -- +-+ 3 rows in set (0.00 sec) MySQL [(none)] > show status like 'wsrep_cluster_%' +-- +-- + | Variable_name | Value | +-+ -- + | wsrep_cluster_conf_id | 1 | | wsrep_cluster_size | 1 | | wsrep_cluster_state_uuid | c2ab52e7-67cf-11e8-9d02-e76acee85210 | | wsrep_cluster_status | | Primary | +-- +-- + 4 rows in set (0.00 sec) MySQL [(none)] > GRANT RELOAD | LOCK TABLES, PROCESS, REPLICATION CLIENT ON *. * TO 'pxc'@'%' IDENTIFIED BY' 123456' -create a SST user MySQL [(none)] > flush privileges
(from the information cluster above, the size of the cluster is 1 node, the state is primary, and the node is in the Synced state, which is fully connected and ready for write-set replication. )
6. Start the second node and the third node in turn:
[root@node2 pxc_mysql] # / usr/local/pxc_mysql/bin/mysqld_safe-defaults-file=/usr/local/pxc_mysql/my.cnf-user=mysql &
7. Verify that the cluster deployment is successful:
View at each node:
MySQL [(none)] > show status like 'wsrep_cluster_%' +-- +-- + | Variable_name | Value | +-+ -- + | wsrep_cluster_conf_id | 5 | | wsrep_cluster_size | 3 |-now all three nodes have joined the cluster | wsrep_cluster_state_ Uuid | c2ab52e7-67cf-11e8-9d02-e76acee85210 | | wsrep_cluster_status | Primary | +-+-+
Create a table or database on one of the nodes to see if all three nodes are completed synchronously.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.