Setup Oracle Graph on Cloud (ADB)
(Updated for version 22.4 on Nov 24, 2022)
In this article, I will share a brief overview of the setup procedure for Oracle Graph using an Autonomous Database. The steps are explained more comprehensively in this workshop, so please see it for more details.
Oracle Graph can be used with any edition of Oracle Database, on-premises or in the cloud (starting with 12.2). Oracle Cloud Always Free Services include two Autonomous Database instances, which is a fully-managed database service. I will explain the setup procedure for Database Cloud Service (DBCS) in a separate article.
We will create a Graph Server, which is an in-memory graph analytics environment, and integrate it with the backend database. The Marketplace image for Graph Server is available on Oracle Cloud, making it easy to deploy. You can launch the image using a Compute instance included in Always Free Services.
Create an ADB instance
I won’t describe this step in detail, as there are no special settings for the ADB related to Oracle Graph. You can select ATP (Autonomous Transaction Processing) or ADW (Autonomous Data Warehouse) for Oracle Graph.
Let’s assume that the ADB is named as adb1
here.
Create a Network
Create a network and open the necessary port. Go to Networking > Virtual Cloud Networks.
Use the wizard to create a new VCN. Start VCN Wizard > Create VCN with Internet Connectivity > Start VCN Wizard.
VCN Name: vcn1
Other items: (no need to change)
Here, we create a VCN named vcn1
.
Make port 7007 accessible. Go to Virtual Cloud Networks > vcn1 > Public Subnet-vcn1 > Default Security List for vcn1 > Add Ingress Rules, and create the following rules. In production use, restrict the IP addresses of clients for better security.
Source Type: CIDR
Source CIDR: 0.0.0.0/0
IP Protocol: TCP
Source Port Range: (All)
Destination Port Range: 7007
Description: Graph Server
Create a Graph Server
Go to the Marketplace tab and search for “Graph Server and Client”.
Here we are selecting version 22.4.0.0, but the procedure is the same if you select the other versions.
Stack Information does not need to be changed.
Go to the Configure variables screen and select the shape of the compute instance you wish to create. There are two options in Always-free: A1.Flex (Ampere ARM) and E2.1.Micro (AMD). A1.Flex has larger memory and is preferable, but A1.Flex instances are so popular that there is no available one in some regions.
My recommendation is to confirm the following steps with E2.1.Micro first, which is normally available, and then try with A1.Flex later.
Upload your public key for connecting the instance via SSH later, and select the VCN and public subnet created above.
Finally, specify the JDBC URL. For the connection from the Graph Server to the database, we will use a secure method called database wallet. Change adb1_low
according to the name of the ADB. /etc/oracle/graph/wallets
is the directory path on the Compute instance that will be created, so you do not need to modify it. We will store a wallet (= a unique encrypted key used for database authentication) in this directory in a later step.
jdbc:oracle:thin:@adb1_low?TNS_ADMIN=/etc/oracle/graph/wallets
Create the stack. This usually takes a few minutes.
At the end of the log, the IP address of the Compute instance and the URL of the graph visualization application are shown.
If there is no Compute instance available in the domain, the job will fail with an “Out of host capacity” message in the log. Please go to Edit job, change the shape or domain, and try again.
Provide an ADB Wallet
Navigate to the target ADB from the Oracle Cloud console.
Click DB Connection.
Select Instance Wallet to download.
Enter the password to protect the Wallet.
Upload the Wallet (ZIP file) to the directory /etc/oracle/graph/wallets
(this location was specified in the step above) on the Compute instance.
$ scp -i <private_key> <Wallet_database_name>.zip opc@<public_ip_for_compute>:/etc/oracle/graph/wallets
Example:
$ scp -i key.pem ~/Downloads/Wallet_ADB1.zip [email protected]:/etc/oracle/graph/wallets
To deploy the Wallet, log in to the Compute instance.
$ ssh -i <private_key> opc@<public_ip_for_compute>
Example:
$ ssh -i key.pem [email protected]
Extract the ZIP file and change the group permissions.
$ cd /etc/oracle/graph/wallets/
$ unzip Wallet_ADB1.zip
$ chgrp oraclegraph *
Create a User
Create a user and give it the role created above.
Select Database Users from the menu.
Click on the Create User button and enter a user name and password. Also, enable Graph and Web Access and set the tablespace quota to UNLIMITED (or any appropriate amount).
From the Granted Roles tab, select GRAPH_DEVELOPER and PGX_SESSION_ADD_PUBLISHED_GRAPH roles. The roles CONNECT and RESOURCE should be also selected, so leave these roles checked as they are also required.
After creating the user, log back into Database Actions.
Verify that you can log in as the new user.
Open the Graph Viz app
Open https://<public_ip_for_compute>:7007/ui
in a web browser.
The Marketplace image is provided with a self-signed SSL certificate, which must be changed to your own certificate for production use. If you keep using the self-signed SSL certificate, your web browser will display a warning.
In Chrome, typing thisisunsafe
in the window (there is no textbox, but just type on the window) will take you to the Graph Viz screen.
In Firefox click Advanced > Accept the Risk and Continue.
Log in as the database user created above.
Since the sample graph “hr” has already been loaded, press the Execute Query button and it will draw a subgraph taken from the database.
Setup is complete. Let’s experiment more with creating and visualizing different graphs in future articles!
Please learn more about Oracle Graph from:
- Medium (= all articles with Oracle Graph tag)
- Stack Overflow (= questions with oracle-graph tag)
- Slack AnDOUC (= invitation link, please visit #graph)
- Slack OracleDevRel (= invitation link, please visit #oracle-db-graph)