Giter VIP home page Giter VIP logo

trying-out-mha's Introduction

trying out mha

準備

鍵作成

$ ssh-keygen -f ./id_rsa

Vagrant up

$ vagrant up

mha-manager → mha-node ssh接続確認

All SSH connection tests passed successfullya.となればok

$ vagrant ssh manager
[vagrant@manager ~]$ sudo su -
[root@manager ~]# masterha_check_ssh --conf=/etc/mha.cnf

レプリケーション準備

master(db1)側

[vagrant@db1 ~]$ mysql -u root -e "FLUSH TABLES WITH READ LOCK;"
[vagrant@db1 ~]$ mysql -u root -e "SHOW MASTER STATUS;" # ポジションとログファイルのパスメモ
[vagrant@db1 ~]$ mysqldump -u root --all-databases --lock-all-tables > dbdump.db
[vagrant@db1 ~]$ mysql -u root -e "UNLOCK TABLES;"
[vagrant@db1 ~]$ scp dbdump.db [email protected]:

slave(db2)側

[vagrant@db2 ~]$ mysql -u root < dbdump.db
[vagrant@db2 ~]$ mysql -u root
mysql> CHANGE MASTER TO
    -> MASTER_HOST='192.168.44.20',
    -> MASTER_USER='repl',
    -> MASTER_PASSWORD='slavepass',
    -> MASTER_LOG_FILE='mysql-bin.000001', # メモした値に
    -> MASTER_LOG_POS=189;                 # メモした値に
mysql> START SLAVE;
mysql> SHOW SLAVE STATUS\G                 # Slave_SQL_Running, Slave_IO_Running がYesになっていればok

slave(db3)側

mysql5.0のdump食わせると何かのデータ読み込んだタイミングでクラッシュするので調査中

レプリケーション自体は正常に動いた(レプリケーション開始前のデータ捨てることになるけど)

レプリケーション確認

MySQL Replication Health is OK.となればok

[root@manager ~]# masterha_check_repl --conf=/etc/mha.cnf

mha-manager起動

[root@manager ~]# masterha_manager --conf=/etc/mha.cnf

mha-managerステータス

mha (pid:8925) is running(0:PING_OK), master:192.168.44.20となればok

[root@manager ~]# masterha_check_status --conf=/etc/mha.cnf

フェイルオーバーさせる

フェイルオーバーするとmha-managerがフェイルオーバー実行する

その後mha-managerは終了する?

$ vagrant ssh db1
[vagrant@db1 ~]$ sudo killall -9 mysqld mysqld_safe

trying-out-mha's People

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.