Home PC Games Linux Windows Database Network Programming Server Mobile  
           
  Home \ Database \ MySQL multi-master multi-cluster deployment uses alive Galera     - Using Linux / Unix Text processing (Linux)

- Ubuntu users to install household financial management tools HomeBank 5.0.0 (Linux)

- Linux dmidecode command detail (Linux)

- error 1819 (HY000): your password does not satisfy the current policy requirements (Database)

- CentOS7 install NTFS-3G driver (Linux)

- Python script running in the background (Programming)

- Hyper-V virtual hard disk how to copy files to and attached to the virtual machine (Linux)

- Mybatis + binding Struts2: achieving user to insert and find (Programming)

- Linux SSH login without a password (Linux)

- To configure Samba to share files with Windows under CentOS (Linux)

- The virtual memory (Linux)

- To configure parameter configuration and software installation and uninstallation under Linux (Linux)

- Linux scp remote file copy (Linux)

- When the master key encounter NULL (Database)

- ELKstack log analysis platform (Server)

- Java8 Lambda expressions and flow operations (Programming)

- pga_aggregate_target and _pga_max_size can not use absolute limit actual PGA (Database)

- The three-way division of the sorting algorithm Quicksort (Programming)

- Docker study notes (Server)

- iostat command Detailed (Linux)

 
         
  MySQL multi-master multi-cluster deployment uses alive Galera
     
  Add Date : 2018-11-21      
         
         
         
  Galera is a MySQL replication allows the tools to achieve true dual-master, multi-master, the client connects to a different MySQL instance to read and write operations with just one example, the data between multiple MySQL completely consistent. Galera mainly to improve the overall read throughput in the premise to ensure data consistency, so the main way better than MySQL comes from.

Galera and no sub-table sub-library function, if you want to use Galera, want to sub-table sub-library can be used in conjunction with Cobar, Cobar if used under Galara can achieve higher reliability, data consistency and avoid some Cobar switched master-slave, while others did not bring switching data inconsistencies.

Step One: Download and install

When using galera, Galera also need a library official download address is http://galeracluster.com/downloads/.
MySQL / MariaDB Galera version needs to have a extra wsrep patch, and therefore can not directly use the ordinary version. MySQL version can be downloaded from the official website Galera, currently offers two versions 5.5 and 5.6.
MariaDB MariaDB version can be downloaded from the official website to https://downloads.mariadb.org/mariadb-galera/, MariaDB MySQL 10.0 corresponding to 5.6.

Source compiler needs to be installed before galera dependent libraries have boost, scons, check, openssl development version, you can install according to their own situation. galera use scons installed, so with regular command, in fact, as long as the implementation of a script.

$ Scripts / build.sh

Libgalera_smm.so generate files in the current directory compiled.

Step Two: Configure

Galera only need to add a few lines wsrep relevant content in the MySQL configuration file my.cnf in to

[Mysqld]
# Compiler configuration file path in front of libgalera_smm.so
wsrep_provider = /home/lyw/c2/galera-3-25.3.12/libgalera_smm.so
 
# Configure each instance the entire cluster ip: port
wsrep_cluster_address = 'gcomm: //192.168.1.8: 24011,192.168.1.8: 24021,192.168.1.8: 24031'
 
# Configure your ip: port, each configuration is different
wsrep_node_address = '192.168.1.8:24011'

Other configurations depending on your situation configuration. I configured here three, my11.cnf, my21.cnf, my31.cnf.

The third step: initialize

Initialized with MySQL, as performed on each database to look mysql_install_db script:

$ Scripts / mysql_install_db --defaults-file = etc / my11.cnf
$ Scripts / mysql_install_db --defaults-file = etc / my21.cnf
$ Scripts / mysql_install_db --defaults-file = etc / my31.cnf

Step Four: Start

Three previously configured MySQL, let's start first, we need to set --wsrep_cluster_address = gcomm: // Parameters:

$ Bin / mysqld_safe --defaults-file = etc / my11.cnf --wsrep_cluster_address = gcomm: // &

Wait first successful start, we start behind the two, and this time does not require the above parameters, in fact, is the use of the configuration values in the file:

$ Bin / mysqld_safe --defaults-file = etc / my21.cnf &
$ Bin / mysqld_safe --defaults-file = etc / my31.cnf &

This entire cluster to start a good future, if there is a process linked to the need to restart, you do not need to add --wsrep_cluster_address parameters.

Step five: Test

After a good start to our testing whether it was successful. I'm using mysql client, you can use your favorite client tools Note that the port is connected to the MySQL port instead of the above Galera port.
$ Bin / mysql -uroot -h127.0.0.1 -P14011
MariaDB [(none)]> create database lyw;

$ Bin / mysql -uroot -h127.0.0.1 -P14021
MariaDB [(none)]> show databases like 'lyw';
+ ---------------- +
| Database (lyw) |
+ ---------------- +
| Lyw |
+ ---------------- +
1 row in set (0.00 sec)

$ Bin / mysql -uroot -h127.0.0.1 -P14031
MariaDB [(none)]> show databases like 'lyw';
+ ---------------- +
| Database (lyw) |
+ ---------------- +
| Lyw |
+ ---------------- +
1 row in set (0.00 sec)

A library made visible in an operation in other libraries also have the same modifications, Galera started successfully.
We can also see wsrep relevant parameters to determine whether a successful start:

MariaDB [(none)]> show variables like 'wsrep_on';
+ --------------- + ------- +
| Variable_name | Value |
+ --------------- + ------- +
| Wsrep_on | ON |
+ --------------- + ------- +
 
MariaDB [(none)]> show status like 'wsrep_connected';
+ ----------------- + ------- +
| Variable_name | Value |
+ ----------------- + ------- +
| Wsrep_connected | ON |
+ ----------------- + ------- +
 
MariaDB [(none)]> show status like 'wsrep_ready';
+ --------------- + ------- +
| Variable_name | Value |
+ --------------- + ------- +
| Wsrep_ready | ON |
+ --------------- + ------- +

wsrep_on is ON it indicates a successful start.
wsrep_connected value ON Description Connect to the cluster.
wsrep_ready value ON instructions ready to accept SQL requests. This value is the most critical.
wsrep starts with galera parameters are related to the other in use slowly study.
     
         
         
         
  More:      
 
- Java source implementation of the observer pattern instance (Programming)
- Android Application Development: an argument between Activity (Programming)
- SSH configuration under Linux (Linux)
- Linux screen command (Linux)
- CentOS-based Kickstart automated installation practice (Linux)
- Ubuntu 15.04 installation Powercommands 2.0 (Linux)
- Compare Several MySQL environmental issues (Database)
- Ubuntu 12.04 / 14.04 users to install software LyX document processing (Linux)
- Lua4.0 interpreter entrance (Programming)
- Database start listening TNS-12537, TNS-12560 error (Database)
- CentOS 6 rapid deployment of Java applications (Linux)
- Linux atomic operations and synchronization mechanisms (Programming)
- JDK installation and configuration environment variable under linuxb (Linux)
- How to protect the Apache website under Linux system (Linux)
- Ubuntu configuration SVN and http mode access (Server)
- Compile and install the latest version of Redis Stable (Database)
- Java learning problems encountered (Programming)
- Linux Mint under tty.js Installation Guide (Linux)
- Linux, C programming language library file handling and preparation of Makefile (Programming)
- PL / SQL in forall simple test (Database)
     
           
     
  CopyRight 2002-2020 newfreesoft.com, All Rights Reserved.