Mariadb 이중화(galera) - CentoOS7.x MySQL/MariaDB

# yum clean headers
# yum clean metadata
# yum clean packages

# vi /etc/yum.repos.d/MariaDB.repo
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.4/centos6-amd64
gpgkey = https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck = 1

# vi /etc/yum.repos.d/percona.repo
[percona]
name = CentOS $releasever - Percona 
baseurl=http://repo.percona.com/centos/$releasever/os/$basearch/ 
enabled = 1 
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-percona 
gpgcheck = 1

# yum -y install MariaDB-client MariaDB-server MariaDB-devel galera(자동설치됨)


# /etc/init.d/mysql start
# mysql_secure_installation (root 비번설정)
# mysql -uroot -p

>GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'replica' WITH GRANT OPTION;
Query OK, 0 rows affected (0.122 sec)
>GRANT ALL PRIVILEGES ON *.* TO 'replica'@'%' IDENTIFIED BY 'replica' WITH GRANT OPTION;
>FLUSH PRIVILEGES;


서버 1번 : /usr/bin/mysqld_safe --wsrep-new-cluster
서버 2번 : /etc/init.d/mysql start
        
>show status like 'wsrep%';
>show status like 'wsrep_cluster_size';
# mysqladmin -uroot -preplica shutdown


curl -sS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | sudo bash
[maxscale]
# To use the latest stable release of MaxScale, use "latest" as the version
# To use the latest beta (or stable if no current beta) release of MaxScale, use "beta" as the version
name = MariaDB MaxScale
baseurl = https://downloads.mariadb.com/MaxScale/2.2/centos/$releasever/$basearch
gpgkey = file:///etc/pki/rpm-gpg/MariaDB-MaxScale-GPG-KEY
gpgcheck = 1
enabled = 1

# yum install maxscale

# vi /etc/maxscale.cnf
[server1]
type=server
address=192.168.100.57
port=3306
protocol=MariaDBBackend

[server2]
type=server
address=192.168.100.56
port=3306
protocol=MariaDBBackend

[Read-Only-Service]
type=service
router=readconnroute
servers=server1
user=replica
passwd=replica
router_options=slave

[Read-Write-Service]
type=service
router=readwritesplit
servers=server1
user=replica
passwd=replica

# maxadmin list servers
Servers.
-------------------+-----------------+-------+-------------+--------------------
Server             | Address         | Port  | Connections | Status              
-------------------+-----------------+-------+-------------+--------------------
server1            | 192.168.100.57  |  3306 |           0 | Running
server2            | 192.168.100.56  |  3306 |           0 | Running
-------------------+-----------------+-------+-------------+--------------------

# maxadmin list listeners
Listeners.
--------------+---------------------+--------------------+-----------------+-------+--------
Name                 | Service Name        | Protocol Module    | Address         | Port  | State
--------------+---------------------+--------------------+-----------------+-------+--------
Read-Only-Listener   | Read-Only-Service   | MariaDBClient      | *               |  4008 | Running
Read-Write-Listener  | Read-Write-Service  | MariaDBClient      | *               |  4006 | Running
MaxAdmin-Listener    | MaxAdmin-Service    | maxscaled          | default         |     0 | Running
--------------+---------------------+--------------------+-----------------+-------+--------
=================================================

68.100.56' --datadir '/var/lib/mysql/'   --parent '28925'  ''  '''
2018-12-13 16:56:40 0 [ERROR] WSREP: Failed to read 'ready <addr>' from: wsrep_sst_xtrabackup-v2 --role 'joiner' --address '192.168.100.56' --datadir '/var/lib/mysql/'   --parent '28925'  ''  ''
        Read: ''innobackupex' not found in PATH'
2018-12-13 16:56:40 0 [ERROR] WSREP: Process completed with error: wsrep_sst_xtrabackup-v2 --role 'joiner' --address '192.168.100.56' --datadir '/var/lib/mysql/'   --parent '28925'  ''  '': 2 (No such file or directory)
2018-12-13 16:56:40 2 [ERROR] WSREP: Failed to prepare for 'xtrabackup-v2' SST. Unrecoverable.
2018-12-13 16:56:40 2 [ERROR] Aborting

Error in my_thread_global_end(): 1 threads didn't exit

# yum install ftp://ftp.pbone.net/mirror/ftp5.gwdg.de/pub/opensuse/repositories/home:/rudi_m:/devel-snap/CentOS_CentOS-6/x86_64/libev4-4.15-7.1.x86_64.rpm

# yum install -y percona-xtrabackup
# yum install -y https://forensics.cert.org/centos/cert/6/i386//socat-1.7.3.2-1.1.el6.i686.rpm
# chown -h mysql:mysql mysql
 

덧글

댓글 입력 영역