In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-20 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Galera Cluster1, Lab preparation and Topology of MySQL High availability Architecture
At least three nodes are required
Node1 192.168.150.137node2 192.168.150.138node3 192.168.150.139
The mariadb version is a branch version of mariadb that supports galera cluster
MariaDB-Galera-server-5.5.46
Prepare before the experiment:
1. The first condition of HA environment: the time synchronization three nodes add the timing script [root@localhost ~] # crontab-l synchronization account 5 * / usr/sbin/ntpdate 1.cn.pool.ntp.org2, and the three local yum repositories are all configured with MariaDB-Galera. I try to use the yum repository provided by mariadb officially. China's net will kill you [root@localhost] # cat / etc/yum.repos.d/galera.repo [galera] name=galerabaseurl= file:///root/galera_clustergpgcheck=0enable=13, yum installation, only need to install MariaDB-Galera-server, the rest will depend on installing yum-y install Mariadb-Galera-server2, configuration 1, check the location of the libraries needed to be called by galera rpm-ql galera | grep-I smm.so/usr/lib64/galera/libgalera_smm.so2, modify the configuration file Three-node synchronous modification [root@localhost yum.repos.d] # cat / etc/my.cnf.d/server.cnf## These groups are read by MariaDB server.# Use it for options that only the server (but not clients) should see## See the examples of server my.cnf files in / usr/share/mysql/## this is read by the standalone daemon and embedded servers [server] # this is only for the mysqld standalone daemon [mysqld] # # * Galera-related settings# [galera] # Mandatory settingswsrep_provider= / usr/lib64/galera/libgalera_smm.so wsrep_cluster_address= "gcomm://192.168.150.137192.168.150.138192.168.150.139" binlog_format=rowdefault_storage_engine=InnoDBinnodb_autoinc_lock_mode=2bind-address=0.0.0.0wsrep_cluster_name='mycluster'## Optional setting#wsrep_slave_threads=1#innodb_flush_log_at_trx_commit=0# this is only for embedded server [embedded] # This group is only read by MariaDB-5.5 servers.# If you use the same .cnf file for MariaDB of different versions # use this group for options that older servers don't understandard [mysqld-5.5] # These two groups are only read by MariaDB servers, not by MySQL.# If you use the same .cnf file for MySQL and MariaDB,# you can put MariaDB-only options here [mariadb] [mariadb-5.5] 3, node 1 to mysql and cluster to open [root@localhost] # / etc/rc.d/init.d/mysql start-- wsrep-new-cluster Starting MySQL.... SUCCESS! 4. The other two nodes perform normal mysql to open [root@localhost] # service mysql startStarting MySQL....SST in progress, setting sleep higher. SUCCESS! The configuration is complete at this time. 3. Function verification 1. Node 1 creates a database, and node 2 / 3 can view node 1: [root @ localhost ~] # mysqlWelcome to the MariaDB monitor. Commands end with; or\ g.Your MariaDB connection id is 4Server version: 5.5.46-MariaDB-wsrep MariaDB Server, wsrep_25.12.r4f81026Copyright (c) 2000, 2015, Oracle, MariaDB Corporation Ab and others.Type 'help;' or'\ h' for help. Type'\ c'to clear the current input statement.MariaDB [(none)] > CREATE DATABASE mydb;Query OK, 1 row affected (0.00 sec) MariaDB [(none)] > SHOW DATABASES +-+ | Database | +-+ | information_schema | | mydb | | mysql | | performance_schema | | test | +-+ node 2 3: [root@localhost ~] # mysqlWelcome to the MariaDB monitor. Commands end with; or\ g.Your MariaDB connection id is 4Server version: 5.5.46-MariaDB-wsrep MariaDB Server, wsrep_25.12.r4f81026Copyright (c) 2000, 2015, Oracle, MariaDB Corporation Ab and others.Type 'help;' or'\ h' for help. Type'\ c'to clear the current input statement.MariaDB [(none)] > SHOW DATABASES +-+ | Database | +-+ | information_schema | | mydb | | mysql | | performance_schema | | test | +-+ 5 rows in set (0.01 sec) 2, create tables in node 2 database Node 1 and 2 can view node 2:MariaDB [(none)] > use mydb normally. Database changedMariaDB [mydb] > CREATE TABLE tb1 (id int,name char (10)); Query OK, 0 rows affected (0.01 sec) Node 1 3:MariaDB [(none)] > use mydbReading table information for completion of table and column namesYou can turn off this feature to get a quicker startup with-ADatabase changedMariaDB [mydb] > SHOW TABLES-> +-+ | Tables_in_mydb | +-+ | tb1 | +-+ 1 row in set (0.00 sec) MariaDB [mydb] > DESC tb1 +-+ | Field | Type | Null | Key | Default | Extra | +-+-+ | id | int ( 11) | YES | | NULL | name | char (10) | YES | | NULL | | +-+-+ 2 rows in set (0.02 sec) 3. Testing of self-increasing fields Each point will jump to increase itself, and insert at the same time, for example, 1 node 1 4 7 2 nodes 258 and 3 nodes 369. Node 1:MariaDB [mydb] > CREATE TABLE tb2 (id int UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,name char (30) uery OK, 0 rows affected (0.01 sec) MariaDB [mydb] > INSERT INTO tb2 (name) VALUES ('void'), (' yao'); Query OK, 2 rows affected (0.01 sec) Records: 2 Duplicates: 0 Warnings: 0 node 2:MariaDB [mydb] > select * from tb2 +-+-+ | id | name | +-- + | 1 | void | 4 | yao | +-- +-+ 2 rows in set (0.01sec) MariaDB [mydb] > INSERT INTO tb2 (name) VALUES ('amy'), (' apple'); Query OK, 2 rows affected (0.00 sec) Records: 2 Duplicates: 0 Warnings: 0MariaDB [mydb] > select * from tb2 +-+-- +-- + | id | name | +-+-+ | 1 | void | 4 | yao | | 5 | amy | | 8 | apple | +-+-+ 4 rows in set (0.00 sec)
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.