|
| 1 | +# Oracle ASM on NFS Server for RAC testing |
| 2 | +Sample Docker and Podman build files to facilitate installation, configuration, and environment setup for DevOps users. |
| 3 | + |
| 4 | +**IMPORTANT:** This image can be used to setup ASM on NFS for RAC. You can skip if you have physical block devices or NAS server for Oracle RAC and Grid. You need to make sure that NFS server container must be up and running for RAC functioning. This image is for only testing purpose. |
| 5 | + |
| 6 | +Refer below instructions for setup of NFS Container for RAC - |
| 7 | + |
| 8 | +- [Oracle ASM on NFS Server for RAC testing](#oracle-asm-on-nfs-server-for-rac-testing) |
| 9 | +- [How to build NFS Storage Container Image](#how-to-build-nfs-storage-container-image) |
| 10 | + - [How to build NFS Storage Container Image on Docker Host](#how-to-build-nfs-storage-container-image-on-docker-host) |
| 11 | + - [How to build NFS Storage Container Image on Podman Host](#how-to-build-nfs-storage-container-image-on-podman-host) |
| 12 | +- [Create Bridge Network](#create-bridge-network) |
| 13 | +- [NFS Server installation on Host](#nfs-server-installation-on-host) |
| 14 | +- [Running RACStorageServer container](#running-racstorageserver-container) |
| 15 | + - [RAC Storage container for Docker Host Machine](#rac-storage-container-for-docker-host-machine) |
| 16 | + - [RAC Storage Container for Podman Host Machine](#rac-storage-container-for-podman-host-machine) |
| 17 | +- [Create NFS Volume](#create-nfs-volume) |
| 18 | +- [Copyright](#copyright) |
| 19 | + |
| 20 | +## How to build NFS Storage Container Image |
| 21 | + |
| 22 | +### How to build NFS Storage Container Image on Docker Host |
| 23 | +You need to make sure that you have atleast 60GB space available for container to create the files for RAC storage. |
| 24 | + |
| 25 | +**IMPORTANT:** If you are behind the proxy, you need to set http_proxy env variable based on your enviornment before building the image. Please ensure that you have the `podman-docker` package installed on your OL8 Podman host to run the command using the docker utility. |
| 26 | +```bash |
| 27 | +dnf install podman-docker -y |
| 28 | +``` |
| 29 | + |
| 30 | +To assist in building the images, you can use the [buildDockerImage.sh](dockerfiles/buildDockerImage.sh) script. See below for instructions and usage. |
| 31 | + |
| 32 | +The `buildDockerImage.sh` script is just a utility shell script that performs MD5 checks and is an easy way for beginners to get started. Expert users are welcome to directly call `docker build` with their prefered set of parameters. Go into the **dockerfiles** folder and run the **buildDockerImage.sh** script: |
| 33 | + |
| 34 | +```bash |
| 35 | +cd <git-cloned-path>/docker-images/OracleDatabase/RAC/OracleRACStorageServer/dockerfiles |
| 36 | +./buildDockerImage.sh -v 19.3.0 |
| 37 | +``` |
| 38 | + |
| 39 | +For detailed usage of command, please execute folowing command: |
| 40 | +```bash |
| 41 | +cd <git-cloned-path>/docker-images/OracleDatabase/RAC/OracleRACStorageServer/dockerfiles |
| 42 | +./buildDockerImage.sh -h |
| 43 | +``` |
| 44 | +### How to build NFS Storage Container Image on Podman Host |
| 45 | + |
| 46 | +You need to make sure that you have atleast 60GB space available for container to create the files for RAC storage. |
| 47 | + |
| 48 | +**IMPORTANT:** If you are behind the proxy, you need to set `http_proxy` and `https_proxy` env variable based on your enviornment before building the image. |
| 49 | + |
| 50 | +To assist in building the images, you can use the [buildDockerImage.sh](dockerfiles/buildDockerImage.sh) script. See below for instructions and usage. |
| 51 | + |
| 52 | +The `buildDockerImage.sh` script is just a utility shell script that performs MD5 checks and is an easy way for beginners to get started. Expert users are welcome to directly call `docker build` with their prefered set of parameters. Go into the **dockerfiles** folder and run the **buildDockerImage.sh** script: |
| 53 | + |
| 54 | +```bash |
| 55 | +cd <git-cloned-path>/docker-images/OracleDatabase/RAC/OracleRACStorageServer/dockerfiles |
| 56 | +./buildDockerImage.sh -v latest |
| 57 | +``` |
| 58 | +You would see successful build message similar like below- |
| 59 | +```bash |
| 60 | + Oracle RAC Storage Server Podman Image version latest is ready to be extended: |
| 61 | + |
| 62 | + --> oracle/rac-storage-server:latest |
| 63 | +``` |
| 64 | + |
| 65 | +## Create Bridge Network |
| 66 | +Before creating container, create the bridge private network for NFS storage container. |
| 67 | + |
| 68 | +On the host- |
| 69 | +```bash |
| 70 | +docker network create --driver=bridge --subnet=192.168.17.0/24 rac_priv1_nw |
| 71 | +``` |
| 72 | + |
| 73 | +**Note:** You can change subnet according to your environment. |
| 74 | + |
| 75 | + |
| 76 | +## NFS Server installation on Host |
| 77 | +Ensure to install NFS server rpms on host to utilize NFS volumes in containers- |
| 78 | + |
| 79 | +```bash |
| 80 | +yum -y install nfs-utils |
| 81 | +``` |
| 82 | +## Running RACStorageServer container |
| 83 | + |
| 84 | +### RAC Storage container for Docker Host Machine |
| 85 | + |
| 86 | +#### Prerequisites for RAC Storage Container for Docker Host |
| 87 | + |
| 88 | +Create placeholder for NFS storage and make sure it is empty - |
| 89 | +```bash |
| 90 | +export ORACLE_DBNAME=ORCLCDB |
| 91 | +mkdir -p /docker_volumes/asm_vol/$ORACLE_DBNAME |
| 92 | +rm -rf /docker_volumes/asm_vol/$ORACLE_DBNAME/asm_disk0* |
| 93 | +``` |
| 94 | + |
| 95 | +Execute following command to create the container: |
| 96 | + |
| 97 | +```bash |
| 98 | +export ORACLE_DBNAME=ORCLCDB |
| 99 | +docker run -d -t --hostname racnode-storage \ |
| 100 | +--dns-search=example.com --cap-add SYS_ADMIN --cap-add AUDIT_WRITE \ |
| 101 | +--volume /docker_volumes/asm_vol/$ORACLE_DBNAME:/oradata --init \ |
| 102 | +--network=rac_priv1_nw --ip=192.168.17.80 --tmpfs=/run \ |
| 103 | +--volume /sys/fs/cgroup:/sys/fs/cgroup:ro \ |
| 104 | +--name racnode-storage oracle/rac-storage-server:19.3.0 |
| 105 | +``` |
| 106 | + |
| 107 | +**IMPORTANT:** During the container startup 5 files named as `asm_disk0[1-5].img` will be created under /oradata.If the files are already present, they will not be recreated.These files can be used for ASM storage in RAC containers. |
| 108 | + |
| 109 | +**NOTE**: Expose directory to container which has atleast 60GB. In the above example, we are using `/docker_volumes/asm_vol/$ORACLE_DBNAME` and you need to change values according to your env. Inside container, it will be /oradata and do not change this. |
| 110 | + |
| 111 | +In the above example, we used **192.168.17.0/24** subnet for NFS server. You can change the subnet values according to your environment. Also, SELINUX must be disabled or in permissive mode in Docker Host Machine. |
| 112 | + |
| 113 | +To check the racstorage container/services creation logs , please tail docker logs. It will take 10 minutes to create the racnode-storage container service. |
| 114 | + |
| 115 | +```bash |
| 116 | +docker logs -f racnode-storage |
| 117 | +``` |
| 118 | + |
| 119 | +you should see following in docker logs output: |
| 120 | + |
| 121 | +```bash |
| 122 | +################################################# |
| 123 | +runOracle.sh: NFS Server is up and running |
| 124 | +Create NFS volume for /oradata |
| 125 | +################################################# |
| 126 | +``` |
| 127 | + |
| 128 | +### RAC Storage Container for Podman Host Machine |
| 129 | + |
| 130 | +#### Prerequisites for RAC Storage Container for Podman Host |
| 131 | + |
| 132 | +Create placeholder for NFS storage and make sure it is empty - |
| 133 | +```bash |
| 134 | +export ORACLE_DBNAME=ORCLCDB |
| 135 | +mkdir -p /scratch/stage/rac-storage/$ORACLE_DBNAME |
| 136 | +rm -rf /scratch/stage/rac-storage/$ORACLE_DBNAME/asm_disk0* |
| 137 | +``` |
| 138 | + |
| 139 | +If SELinux is enabled on Podman Host (you can check by running `sestatus` command), then execute below to make SELinux policy as `permissive` and reboot the host machine. This will allow permissions to write to `asm-disks*` in the `/oradata` folder inside the podman containers- |
| 140 | +```bash |
| 141 | +sed -i 's/^SELINUX=.*/SELINUX=permissive/' /etc/selinux/config |
| 142 | +reboot |
| 143 | +``` |
| 144 | + |
| 145 | +Execute following command to create the container: |
| 146 | + |
| 147 | +```bash |
| 148 | +export ORACLE_DBNAME=ORCLCDB |
| 149 | +podman run -d -t \ |
| 150 | + --hostname racnode-storage \ |
| 151 | + --dns-search=example.com \ |
| 152 | + --cap-add SYS_ADMIN \ |
| 153 | + --cap-add AUDIT_WRITE \ |
| 154 | + --cap-add NET_ADMIN \ |
| 155 | + --volume /scratch/stage/rac-storage/$ORACLE_DBNAME:/oradata \ |
| 156 | + --network=rac_priv1_nw \ |
| 157 | + --ip=192.168.17.80 \ |
| 158 | + --systemd=always \ |
| 159 | + --restart=always \ |
| 160 | + --name racnode-storage \ |
| 161 | + localhost/oracle/rac-storage-server:latest |
| 162 | +``` |
| 163 | + |
| 164 | +To check the racstorage container/services creation logs , please tail docker logs. It will take 10 minutes to create the racnode-storage container service. |
| 165 | + |
| 166 | +```bash |
| 167 | +podman exec racnode-storage tail -f /tmp/storage_setup.log |
| 168 | +``` |
| 169 | +You would see successful message like below - |
| 170 | +```bash |
| 171 | +################################################# |
| 172 | + Setup Completed |
| 173 | +################################################# |
| 174 | +``` |
| 175 | + |
| 176 | +**NOTE**: Expose directory to container which has atleast 60GB. In the above example, we are using `/scratch/stage/rac-storage/$ORACLE_DBNAME` and you need to change values according to your env. Inside container, it will be /oradata and do not change this. |
| 177 | + |
| 178 | +In the above example, we used **192.168.17.0/24** subnet for NFS server. You can change the subnet values according to your environment. |
| 179 | + |
| 180 | +**Note** : If SELINUX is enabled on the Podman host, then you must create an SELinux policy for Oracle RAC on Podman. For details about this procedure, see "How to Configure Podman for SELinux Mode" in the publication [Oracle Real Application Clusters Installation Guide for Podman Oracle Linux x86-64](https://docs.oracle.com/en/database/oracle/oracle-database/21/racpd/target-configuration-oracle-rac-podman.html#GUID-59138DF8-3781-4033-A38F-E0466884D008). |
| 181 | + |
| 182 | + |
| 183 | +**IMPORTANT:** During the container startup 5 files named as `asm_disk0[1-5].img` will be created under /oradata.If the files are already present, they will not be recreated.These files can be used for ASM storage in RAC containers. |
| 184 | + |
| 185 | +### Create NFS Volume |
| 186 | +Create NFS volume using following command on Podman Host: |
| 187 | + |
| 188 | +```bash |
| 189 | +docker volume create --driver local \ |
| 190 | +--opt type=nfs \ |
| 191 | +--opt o=addr=192.168.17.80,rw,bg,hard,tcp,vers=3,timeo=600,rsize=32768,wsize=32768,actimeo=0 \ |
| 192 | +--opt device=192.168.17.80:/oradata \ |
| 193 | +racstorage |
| 194 | +``` |
| 195 | + |
| 196 | +**IMPORTANT:** If you are not using 192.168.17.0/24 subnet then you need to change **addr=192.168.17.25** based on your environment. |
| 197 | + |
| 198 | +**IMPORTANT:** The NFS volume must be `/oradata` which you will export to RAC containers for ASM storage. It will take 10 minutes for setting up NFS server. |
| 199 | + |
| 200 | +## Copyright |
| 201 | + |
| 202 | +Copyright (c) 2014-2024 Oracle and/or its affiliates. All rights reserved. |
0 commit comments