Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
ansible_adanced_oci [2022/02/08 21:13] – andonovj | ansible_adanced_oci [2024/08/19 13:03] (current) – andonovj | ||
---|---|---|---|
Line 696: | Line 696: | ||
With this, we were able to setup replication using OCI and ansible. The resnap can be done as many time as needed. It will always clone the primary' | With this, we were able to setup replication using OCI and ansible. The resnap can be done as many time as needed. It will always clone the primary' | ||
+ | |||
+ | There is one more playbook which we need to add. | ||
+ | |||
+ | < | ||
+ | --- | ||
+ | |||
+ | - name: Detach the device | ||
+ | vars: | ||
+ | ansible_user: | ||
+ | ansible_become: | ||
+ | ansible_become_method: | ||
+ | |||
+ | hosts: '{{ instance_ip }}' | ||
+ | tasks: | ||
+ | - name: Find the IQN | ||
+ | shell: | | ||
+ | iscsiadm --mode session | ||
+ | register: iqn | ||
+ | |||
+ | - name: Stop MySQL | ||
+ | service: name=mysqld state=stopped enabled=false | ||
+ | when: iqn.stdout != "" | ||
+ | |||
+ | - name: Find possible processes holding the file system | ||
+ | shell: | | ||
+ | lsof +D / | ||
+ | register: locking_processes | ||
+ | ignore_errors: | ||
+ | |||
+ | - name: Print locking process | ||
+ | debug: | ||
+ | msg: '{{ locking_processes }}' | ||
+ | when: locking_processes.stdout_lines|length != 0 | ||
+ | |||
+ | - name: Kill and unmount the file system | ||
+ | shell: | | ||
+ | kill -9 '{{ item }}' | ||
+ | with_items: '{{ locking_processes.stdout_lines }}' | ||
+ | when: locking_processes.stdout_lines|length != 0 | ||
+ | |||
+ | - name: Print IQN | ||
+ | debug: | ||
+ | msg: ' | ||
+ | |||
+ | - name: Unmount File system | ||
+ | mount: | ||
+ | path: / | ||
+ | state: unmounted | ||
+ | |||
+ | - name: Detach the iSCSI | ||
+ | community.general.open_iscsi: | ||
+ | login: no | ||
+ | target: ' | ||
+ | when: iqn.stdout != "" | ||
+ | </ | ||
+ | |||
+ | That playbook will stop the MySQL and detach the iSCSI from the compute node, so we can safely, remove it from the OCI as well. | ||
+ | |||
+ | =====MySQL Clusterset Automation===== | ||
+ | This ansible project consists of 3 roles: | ||
+ | - MySQL Instance | ||
+ | - MySQL InnoDB Cluster | ||
+ | - MySQL Router | ||
+ | |||
+ | That will create architecture with 1 InnoDB Clusterset and a replicaset attached to it. The full code, you can see here: | ||
+ | |||
+ | https:// | ||
+ |