Ich arbeite an einer MySQL-Replikation mit Ansible.mysql Replikation mit ansible
Ich habe folgende ansible Aufgabe:
---
- 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] }}'
Diese Aufgaben sind in Ordnung, wenn ich es lief, aber wenn ich sehe mit phpMyAdmin den Replikationsstatus ich folgende Meldung haben (auf dem Server):
- Slave_IO_State: Connecting
- Slave_IO_Running zu meistern: Connecting
- Slave_SQL_Running: Ja
Ich bin kein Experte in Mysql-Replikation, sehen Sie etwas kann mir helfen?
(Ich folge diesem Tutorial: https://raymii.org/s/articles/Building_HA_Clusters_With_Ansible_and_Openstack.html)
Thx
Warum neu starten nach Erteilung von Privilegien und Master ändern? – mannoj