AWS FSx ONTAP中的自动化 Oracle HA/DR
NetApp解决方案工程团队
该解决方案提供了一个基于 Ansible 的自动化工具包,用于配置 Oracle 数据库高可用性和灾难恢复 (HA/DR),其中 AWS FSx ONTAP作为 Oracle 数据库存储,EC2 实例作为 AWS 中的计算实例。
目的
该工具包可自动执行在 AWS 云中部署的 Oracle 数据库的高可用性和灾难恢复 (HR/DR) 环境的设置和管理任务,该数据库具有 FSx ONTAP存储和 EC2 计算实例。
此解决方案适用于以下用例:
-
设置 HA/DR 目标主机 - 内核配置、Oracle 配置以与源服务器主机匹配。
-
设置 FSx ONTAP - 集群对等、vserver 对等、从源到目标的 Oracle 卷 snapmirror 关系设置。
-
通过快照备份 Oracle 数据库数据 - 关闭 crontab 执行
-
通过快照备份 Oracle 数据库存档日志 - 执行 crontab
-
在 HA/DR 主机上运行故障转移和恢复 - 测试并验证 HA/DR 环境
-
故障转移测试后运行重新同步 - 在 HA/DR 模式下重新建立数据库卷 SnapMirror 关系
受众
此解决方案适用于以下人群:
-
一位 DBA 在 AWS 中设置了 Oracle 数据库,以实现高可用性、数据保护和灾难恢复。
-
对 AWS 云中的存储级 Oracle HA/DR 解决方案感兴趣的数据库解决方案架构师。
-
管理支持 Oracle 数据库的 AWS FSx ONTAP存储的存储管理员。
-
喜欢在 AWS FSx/EC2 环境中建立 Oracle 数据库以实现 HA/DR 的应用程序所有者。
许可证
通过访问、下载、安装或使用此 GitHub 存储库中的内容,您同意"许可证文件"。
|
制作和/或共享此 GitHub 存储库中内容的任何衍生作品都受到某些限制。请确保在使用该内容之前阅读许可条款。如果您不同意所有条款,请不要访问、下载或使用此存储库中的内容。 |
解决方案部署
部署先决条件
Details
部署需要以下先决条件。
Ansible v.2.10 and higher ONTAP collection 21.19.1 Python 3 Python libraries: netapp-lib xmltodict jmespath
AWS FSx storage as is available
AWS EC2 Instance RHEL 7/8, Oracle Linux 7/8 Network interfaces for NFS, public (internet) and optional management Existing Oracle environment on source, and the equivalent Linux operating system at the target
下载工具包
Details
git clone https://github.com/NetApp/na_ora_hadr_failover_resync.git
全局变量配置
Details
Ansible 剧本是变量驱动的。包含一个示例全局变量文件 fsx_vars_example.yml 来演示典型配置。以下是主要考虑因素:
ONTAP - retrieve FSx storage parameters using AWS FSx console for both source and target FSx clusters. cluster name: source/destination cluster management IP: source/destination inter-cluster IP: source/destination vserver name: source/destination vserver management IP: source/destination NFS lifs: source/destination cluster credentials: fsxadmin and vsadmin pwd to be updated in roles/ontap_setup/defaults/main.yml file
Oracle database volumes - they should have been created from AWS FSx console, volume naming should follow strictly with following standard: Oracle binary: {{ host_name }}_bin, generally one lun/volume Oracle data: {{ host_name }}_data, can be multiple luns/volume, add additional line for each additional lun/volume in variable such as {{ host_name }}_data_01, {{ host_name }}_data_02 ... Oracle log: {{ host_name }}_log, can be multiple luns/volume, add additional line for each additional lun/volume in variable such as {{ host_name }}_log_01, {{ host_name }}_log_02 ... host_name: as defined in hosts file in root directory, the code is written to be specifically matched up with host name defined in host file.
Linux and DB specific global variables - keep it as is. Enter redhat subscription if you have one, otherwise leave it black.
主机变量配置
Details
主机变量在 host_vars 目录中定义,名为 {{ host_name }}.yml。包含一个示例主机变量文件 host_name.yml 来演示典型配置。以下是主要考虑因素:
Oracle - define host specific variables when deploying Oracle in multiple hosts concurrently ansible_host: IP address of database server host log_archive_mode: enable archive log archiving (true) or not (false) oracle_sid: Oracle instance identifier pdb: Oracle in a container configuration, name pdb_name string and number of pdbs (Oracle allows 3 pdbs free of multitenant license fee) listener_port: Oracle listener port, default 1521 memory_limit: set Oracle SGA size, normally up to 75% RAM host_datastores_nfs: combining of all Oracle volumes (binary, data, and log) as defined in global vars file. If multi luns/volumes, keep exactly the same number of luns/volumes in host_var file
Linux - define host specific variables at Linux level hugepages_nr: set hugepage for large DB with large SGA for performance swap_blocks: add swap space to EC2 instance. If swap exist, it will be ignored.
数据库服务器主机文件配置
Details
AWS EC2 实例默认使用 IP 地址进行主机命名。如果您在 Ansible 的 hosts 文件中使用不同的名称,请在 /etc/hosts 文件中为源服务器和目标服务器设置主机命名解析。以下是一个例子。
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 172.30.15.96 db1 172.30.15.107 db2
Playbook 执行 - 按顺序执行
Details
-
安装 Ansible 控制器先决条件。
ansible-playbook -i hosts requirements.yml
ansible-galaxy collection install -r collections/requirements.yml --force
-
设置目标 EC2 DB 实例。
ansible-playbook -i hosts ora_dr_setup.yml -u ec2-user --private-key db2.pem -e @vars/fsx_vars.yml
-
设置源数据库卷和目标数据库卷之间的 FSx ONTAP snapmirror 关系。
ansible-playbook -i hosts ontap_setup.yml -u ec2-user --private-key db2.pem -e @vars/fsx_vars.yml
-
通过 crontab 的快照备份 Oracle 数据库数据卷。
10 * * * * cd /home/admin/na_ora_hadr_failover_resync && /usr/bin/ansible-playbook -i hosts ora_replication_cg.yml -u ec2-user --private-key db1.pem -e @vars/fsx_vars.yml >> logs/snap_data_`date +"%Y-%m%d-%H%M%S"`.log 2>&1
-
通过 crontab 的快照备份 Oracle 数据库存档日志卷。
0,20,30,40,50 * * * * cd /home/admin/na_ora_hadr_failover_resync && /usr/bin/ansible-playbook -i hosts ora_replication_logs.yml -u ec2-user --private-key db1.pem -e @vars/fsx_vars.yml >> logs/snap_log_`date +"%Y-%m%d-%H%M%S"`.log 2>&1
-
在目标 EC2 DB 实例上运行故障转移并恢复 Oracle 数据库 - 测试并验证 HA/DR 配置。
ansible-playbook -i hosts ora_recovery.yml -u ec2-user --private-key db2.pem -e @vars/fsx_vars.yml
-
故障转移测试后运行重新同步 - 在复制模式下重新建立数据库卷 snapmirror 关系。
ansible-playbook -i hosts ontap_ora_resync.yml -u ec2-user --private-key db2.pem -e @vars/fsx_vars.yml
在哪里可以找到更多信息
要了解有关NetApp解决方案自动化的更多信息,请访问以下网站"NetApp解决方案自动化"