How to Setup OCI Storage Gateway?

What is Storage Gateway?

Using Storage Gateway, your applications can interact with Oracle Cloud Infrastructure Object Storage through standard NFSv4 protocols. You connect Storage Gateway file systems to Object Storage buckets. Storage Gateway stores files as objects in an Oracle Cloud Infrastructure Object Storage bucket and supports multipart uploads for large objects. Object Storage does not, however, support symbolic links, hard links, or special device files.

Storage Gateway is installed in an Oracle Cloud Infrastructure compute instance or as a Linux Docker instance on one or more hosts in your on-premises data center. Applications store and retrieve objects from Oracle Cloud Infrastructure Object Storage through file systems that you create in Storage Gateway.

Following steps helps to setup Storage Gateway and how to use it.

Create OCI instance

Detailed steps to create virtual machine (VM) Compute instance

Create Block Volume

Steps to create block volume from OCI console.

Attach Block Volume to Instance & Create filesystem

 
 sudo mkfs.xfs /dev/oracleoci/oraclevdb
 sudo mkdir /ocisg
 sudo mount /dev/oracleoci/oraclevdb /ocisg 

Generate an API Signing Key

Login to VM instance and generate API Signing Key in PEM format using below commands.

Generate Key in PEM format
 
 mkdir ~/.oci
 openssl genrsa -out ~/.oci/oci_api_key.pem 2048
 ls -l ~/.oci/oci_api_key.pem
 chmod go-rwx ~/.oci/oci_api_key.pem
 openssl rsa -pubout -in ~/.oci/oci_api_key.pem -out ~/.oci/oci_api_key_public.pem 
 ls -l ~/.oci/oci_api_key_public.pem
 cat ~/.oci/oci_api_key_public.pem

Upload Key to an existing user account

Copy Fingerprint for further authentication

You can generate fingerprint from command line as well
openssl rsa -pubout -outform DER -in ~/.oci/oci_api_key.pem | openssl md5 -c

Download and Install Storage Gateway
Download and Extract

Download archive

Extract files from TAR archive

cd /tmp
sudo tar xvzf ocisg-1.3.tar.gz

Install using ocisg-install.sh

Script will install docker if does not exists

Important inputs

Enter the path for OCISG file system cache : /ocisg/ocisgfilecache
Enter the path for OCISG metadata storage : /ocisg/ocisgmetadata
Enter the path for OCISG log storage : /ocisg/ocisglog

NFS Port and Example script to mount

After a successful installation, the script provides the following information:

The URL to log in to the Storage Gateway management console.
https://din-storageg-test:32769/

The NFS port number.
32770

An example command for mounting your Storage Gateway file systems.
mount -t nfs -o vers=4,port=32770 din-storageg-test:/<OCISG Filesystem Name> /local_mount_point

Add Security List for NFS and Console Port

Login to Storage Gateway Management Console

Login to management console using URL (https://hostname:32769/) and set new password

Main Dashboard

Create New file system

Steps to create new file system

Important fields while creating file system

Select the Object Storage tier in which you want to store your data
Standard

Object Storage API Endpoint
https://objectstorage.ap-mumbai-1.oraclecloud.com

Compartment OCID
ocid1.tenancy.oc1..aaaaaaaa6lokt3tofxsugf6fdp5manv3nh2jrrjsjv2rajzxf7xxxxxxxxxx

Tenant OCID
ocid1.tenancy.oc1..aaaaaaaa6lokt3tofxsugf6fdp5manv3nh2jrrjsjv2rajzxf7xxxxxxxxxx

User OCID
ocid1.user.oc1..aaaaaaaalslavevw24ve6fxfxkzb3zxzyg27cnuozcrrj2zrd4xxxxxxxxxx

Public Key’s Finger Print
be:20:b3:33:43:3d:89:01:b3:5c:a2:be:d9:9f:02:13

Private Key
PEM private key from “Generate Key in PEM format”

After filling up details SAVE and CONNECT from console

File System Created

Click on Setting Tab

Object storage Bucket Created automatically

Mount FileSystem in OCI VM instance

sudo mkdir /storagegatewaytest
sudo mount -t nfs -o vers=4,port=32770 140.238.240.88:/storagegatewaytest /storagegatewaytest
df -hH

As captured in above image, df command shows Avail space 9.3E. It is knows issue of Storage Gateway where df command cannot report accurate size and capacity.

Create dummy files and verify from Object Storage Bucket

Objects Uploaded automatically

Leave a Reply

Your email address will not be published. Required fields are marked *