Get the App
SLTechnology News&Howtos  ›  Servers  › 

Add amoeba to the method of mysql master-slave replication

Shulou Source: shulou.com Published: 2022-06-03 06:26:54 10月03日 Update

The following to understand the realization of mysql master-slave replication method plus amoeba, I believe you will benefit a lot after reading, the text in the essence is not much, hope to achieve mysql master-slave replication method plus amoeba this short content is what you want.

MYSQL master-slave replication

Yum install ntp-y

Time synchronization service

Master

Vim / etc/ntp.conf

Server 127.127.1.0

Fudge 127.127.1.0 stratum 8

Systemctl start ntpd

Slave

Yum install ntp ntpdate-y

Systemctl start ntpd

Ntpdate 192.168.1.15

Yum-y install mariadb mariadb-server

Systemctl stop firewall

Systemctl start mariadb

Mster primary CVM configuration

Yum-y install libaio-devel # installs liaio to support Icano

Vim / etc/my.cnf

Server-id = 1

Log-bin=master-bin

Log-slave-updates=true

Mysql-p1

Mysql > grant replication slave on *. * to 'myslave'@'192.168.1.%' identified by' 123'

Mysql > flush privileges

Slave1 is configured from CVM

Yum-y install libaio-devel

Vim / etc/my.cnf

Server-id = 2

Relay-log=relay-log-bin

Relay-log-index=slave-relay-bin.inde

Slave1 is configured from CVM

Yum-y install libaio-devel

Vim / etc/my.cnf

Server-id = 3

Relay-log=relay-log-bin

Relay-log-index=slave-relay-bin.inde

Mysql > change master to master_host='192.168.1.101',master_user='myslave'

Master_password='123',master_log_file='master-bin.000003',master_log_pos=472

Mysql > start slave

Mysql > stop slave

Mysql > show slave status\

There are actually many reasons for the error of Slave_IO_Running: NO. Let's start with one here.

Environment: Centos6.7, MySQL-5.6.25

First of all, I only installed one linux and cloned two more, one master and two slaves. The key point is that I was cloned, which led to the newspaper Slave_IO_Running: NO.

Reason 1:

Reason: mysql has a uuid, but uuid is uniquely identified, so the uuid I cloned is the same. I only need to modify the uuid to ok. Find the auto.cnf file to modify the uuid.

Auto.cnf files are usually located in. / var/lib/mysql/auto.cnf, if not, then use the linux query command to find: find /-name auto.cnf

Vim / usr/local/mysql/data/auto.cnf

Mv / usr/local/mysql/data/auto.cnf / usr/local/mysql/data/auto.cnf.ba

Amoeba service

Install JDK first

Chmod + x jdk-6u14-linux-x64.bin

. / jdk-6u14-linux-x64.bin

Mv jdk1.6.0_14/ / usr/local/jdk1.

Export JAVA_HOME=/usr/local/jdk1.6

Export CLASSPATH=$CLASSPATH:$JAVA_HOME/lib:$JAVA_HOME/jre/lib

Export PATH=$JAVA_HOME/lib:$JAVA_HOME/jre/bin/:$PATH:$HOME/bin

Export AMOEBA_HOME=/usr/local/amoeba

Export PATH=$PATH:$AMOEBA_HOME/bi

Source / etc/profil

MYSQL read-write separation

Mkdir / usr/local/amoeba/

Tar zxvf amoeba-mysql-binary-2.2.0.tar.gz-C / usr/local/amoeba/

Chmod 755 / usr/local/amoeba

Open permissions to amoeba access in Master Slave1 Slave2

Grant all on *. * to test@'192.168.1.%' identified by 'test'

Vim / usr/local/amoeba/conf/amoeba.xml

30 lines of amoeba

123456

Tags: Service master-slave replication method method reason server configuration content file more industry affirmation benefit a lot information key key command customer situation text Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Xiaomi MySQL Docker macOS Microsoft