私はAnsibleでMySQLのレプリケーションを行っています。可能なmysqlのレプリケーション
私は、次のansibleタスクがあります。
---
- name: update mysql config file
template:
src: templates/my.cnf.j2
dest: /etc/mysql/my.cnf
notify:
- restart mysql
- name: create replicator user
mysql_user:
name: "replicator"
host: "%"
password: "{{ mysql_replicator_password }}"
priv: "*.*:REPLICATION SLAVE"
state: present
notify:
- restart mysql
- name: Check replication init with checking file existence
stat: path=/etc/mysql/repl.ansible
register: check_sql_path
- mysql_replication:
mode: changemaster
master_host: "{{ groups.web[1] }}"
master_user: replicator
master_password: "{{ mysql_replicator_password }}"
when: groups.web[1] is defined and check_sql_path.stat.exists == false and '{{ inventory_hostname }}' == '{{ groups.web[0] }}'
notify:
- restart mysql
- command: touch /etc/mysql/repl.ansible
when: groups.web[1] is defined and check_sql_path.stat.exists == false and '{{ inventory_hostname }}' == '{{ groups.web[0] }}'
- mysql_replication:
mode: changemaster
master_host: "{{ groups.web[0] }}"
master_user: replicator
master_password: "{{ mysql_replicator_password }}"
when: groups.web[1] is defined and check_sql_path.stat.exists == false and '{{ inventory_hostname }}' == '{{ groups.web[1] }}'
notify:
- restart mysql
- command: touch /etc/mysql/repl.ansible
when: groups.web[1] is defined and check_sql_path.stat.exists == false and '{{ inventory_hostname }}' == '{{ groups.web[1] }}'
私はそれを実行したときに、このタスクはOKですが、私はphpMyAdminのレプリケーションの状態を見ると、私は次のメッセージ(両方のサーバ上に)持っている:
を- Slave_IO_State:
- Slave_IO_Runningをマスターするの接続:はい :
- Slave_SQL_Runningを接続します
私は、MySQLのレプリケーションの専門家ではありませんが、何か私を助けることが表示されますか?
(私はこのチュートリアルは、次のとおりです。https://raymii.org/s/articles/Building_HA_Clusters_With_Ansible_and_Openstack.html)を
Thxを
特権を与えてマスターを変更した後に再起動するのはなぜですか? – mannoj