Download - Deploy In-Memory Parallel Graph Analytics (PGX) to Oracle Java Cloud …€¦ · Service step: Provide a Service Name and optional Service Description Select Oracle Java Cloud Service

Transcript
Page 1: Deploy In-Memory Parallel Graph Analytics (PGX) to Oracle Java Cloud …€¦ · Service step: Provide a Service Name and optional Service Description Select Oracle Java Cloud Service

Deploy In-Memory Parallel Graph Analytics (PGX)

to Oracle Java Cloud Service (JCS)

Overview

This document provides detailed steps required to deploy PGX to Java Cloud Service

Instance. This exercise is based on Oracle Spatial and Graph Property Graph 12.2.0.1;

steps may vary if you are using another database version.

The following tasks are covered:

� Create an Oracle Java Cloud Service (JCS) instance

� Download and Deploy the PGX onto the above JCS instance

� Download and install the certificate of the HTTPS/SSL based server

� Connect to the PGX server using SSL

� Run graph analytics against the remote PGX server

Before You Get Started

Become familiar with JCS, Oracle Spatial and Graph, as well as Oracle Spatial

and Graph Property Graph capabilities

� JCS Help Center (https://docs.oracle.com/en/cloud/paas/java-cloud/index.html)

� Oracle Spatial and Graph

� (http://www.oracle.com/technetwork/database/options/spatialandgraph/overview

� /index.html )

� Oracle Spatial and Graph Property Graph capabilities

(https://docs.oracle.com/database/122/nav/spatial-and-graph.htm )

Obtain an Oracle Cloud subscription or trial account including Java Cloud

Service (JCS)

Available at http://cloud.oracle.com

Page 2: Deploy In-Memory Parallel Graph Analytics (PGX) to Oracle Java Cloud …€¦ · Service step: Provide a Service Name and optional Service Description Select Oracle Java Cloud Service

Create an Oracle Java Cloud Service (JCS) instance

� Sign in to your Oracle Cloud account

� With your account welcome email handy, navigate to at https://cloud.oracle.com/

� Select the Data Center listed in your welcome email and click “My Services”

� Enter the Identity Domain listed in your welcome email and continue

� Enter your username and password listed in your welcome email and sign in

� If this is your first time signing in, follow the instructions to change your password

You will be taken to your Dashboard listing your available services:

� Click the Action Menu for Java and select Open Service Console.

� If you do not see the Java in Dashboard, click in Customize Dashboard and set

Java to show.

� Click Create Service > Java Cloud Service

Page 3: Deploy In-Memory Parallel Graph Analytics (PGX) to Oracle Java Cloud …€¦ · Service step: Provide a Service Name and optional Service Description Select Oracle Java Cloud Service

� Service step:

Provide a Service Name and optional Service Description

� Select Oracle Java Cloud Service as Service Level, 12.2.1.2 as Software

Release, Enterprise Edition as Software Edition

� Click Next

Page 4: Deploy In-Memory Parallel Graph Analytics (PGX) to Oracle Java Cloud …€¦ · Service step: Provide a Service Name and optional Service Description Select Oracle Java Cloud Service

Create Server details steps:

� Under WebLogic Configuration

� Select a Compute Shape, here we select the lowest one for this document

purpose

� For SSH Public Key, click Edit and then Browse to select the Public Key you

created earlier or you can create one by select ‘Create a New key’

� For this exercise, we can leave cluster size as 1

� Under WebLogic Access, provide a password for the weblogic user (i.e. admin user)

� Expand Advanced Settings

� Check the option to Enable access to Administrative Consoles

� Leave Domain Partitions as 0

� Optionally uncheck the option to Deploy Sample Application

� Under Database Configuration

� For Name, select your DBCS instance from the pull-down menu

� For Administrator Username, enter sys

� For password, enter the administrator password you chose when creating your

DBCS instance

� Under Load Balancer, leave response as no

� Under Backup and Recovery

� For Backup Destination, select Both Cloud Storage and Local Storage

� Enter a Cloud Storage Container name as we did when creating DBCS instance,

for example:

https://uspm020.storage.oraclecloud.com/v1/Storage-uspm020/GDBC2

� Enter your cloud account Username and Password

� Check the box to Create Cloud Storage Container if this is a new container

Page 5: Deploy In-Memory Parallel Graph Analytics (PGX) to Oracle Java Cloud …€¦ · Service step: Provide a Service Name and optional Service Description Select Oracle Java Cloud Service

� Click Next

� Confirm step

� Observe conformation of backup container creation If you checked the create new

container box

� Verify other settings

� Click Create

Page 6: Deploy In-Memory Parallel Graph Analytics (PGX) to Oracle Java Cloud …€¦ · Service step: Provide a Service Name and optional Service Description Select Oracle Java Cloud Service

� It may take 20 to 30 minutes to create the instance; it will send notice to the mail box

that you entered.

� To monitor progress , click the refresh button (circular arrow button to the right of the

‘As of’ date-time)

� Once the service has been created, click on the service name to view details

� Observe details and note the Public IP of our JCS instance

Page 7: Deploy In-Memory Parallel Graph Analytics (PGX) to Oracle Java Cloud …€¦ · Service step: Provide a Service Name and optional Service Description Select Oracle Java Cloud Service

� (Optional) Enable 7002 port to be allowed to access WebLogic console if you didn’t

select this when you create the service.

� Click the button to the right of your JCS name and select Open WebLogic Server

Console

Page 8: Deploy In-Memory Parallel Graph Analytics (PGX) to Oracle Java Cloud …€¦ · Service step: Provide a Service Name and optional Service Description Select Oracle Java Cloud Service

� You should see the WebLogic Server Console log in page.

Page 9: Deploy In-Memory Parallel Graph Analytics (PGX) to Oracle Java Cloud …€¦ · Service step: Provide a Service Name and optional Service Description Select Oracle Java Cloud Service

Download and Deploy PGX to JCS instance

� Download the Oracle Big Data Spatial and Graph with this link:

https://support.oracle.com/epmos/faces/PatchDetail?patchId=27118297&requestId=

21722011

� Unzip the file and locate the pgx war file, pgx-webapp-wls.war, under folder:

md/property_graph/pgx/server/

� In your browser Open WebLogic Server Console log in page

� Log in with the user weblogic and the password you defined when creating the

instance.

� At the top left, click the button “Lock & Edit”

� On the left under Domain Structure, click Deployments

� In the middle under Deployments, click Install

� Above the Path textbox, click the link to Upload your file(s)

Page 10: Deploy In-Memory Parallel Graph Analytics (PGX) to Oracle Java Cloud …€¦ · Service step: Provide a Service Name and optional Service Description Select Oracle Java Cloud Service

� Next to Deployment Archive, click “BrowseL” and open

“pgx-webapp-<version>-wls.war” which you downloaded earlier

� Click Next and wait for the upload to complete.

� Upload % complete is displayed on the lower left corner of your browser

� When complete you will see a message indicating upload successful.

Page 11: Deploy In-Memory Parallel Graph Analytics (PGX) to Oracle Java Cloud …€¦ · Service step: Provide a Service Name and optional Service Description Select Oracle Java Cloud Service

� Click Next

� Under “Choose installation type and scope”, leave the default selection (“Install this

deployment as an application”)

� Click Next

� Under Servers check the JCS1_dom_adminserver, you can also use the clusters and

check all servers in the cluster

� Click Next

� Under General, leave the name as it is

� Click Next

� Under Additional Configuration leave default (“Yes, take me to the deployment's

configuration screen.”)

� Click Finish

� At top left, click button “Activate Changes”

� In the middle under “Settings for pgx-webapp-name”, click the tab “Control”

� Check the box next to “pgx-webapp-name”

� Click on the menu “Start” and select “Servicing all requests”

Page 12: Deploy In-Memory Parallel Graph Analytics (PGX) to Oracle Java Cloud …€¦ · Service step: Provide a Service Name and optional Service Description Select Oracle Java Cloud Service

� Click “Yes” when prompted to confirm

� You should now see pgx state is “Active”

Congratulation! The PGX server is now deployed to Java Cloud Service and ready to be

used with your PGX client instance for development.

Page 13: Deploy In-Memory Parallel Graph Analytics (PGX) to Oracle Java Cloud …€¦ · Service step: Provide a Service Name and optional Service Description Select Oracle Java Cloud Service

Connect to the PGX server using HTTPS/SSL

� Download the server side certificate

Simply used Firefox, connected to the SSL-based endpoint, and exported the certificate.

You may refer to the following screenshot to download the pgx server side self-signed

certification, note the host name, you will need to add this to your client hosts file.

� Add the server side certificate to your client* key store

� Create an empty keystore

The following example command creates a keystore.jks. It will ask a few

questions along the way but those are very straightforward. You definitely want

to use a much stronger password than "changeit".

keytool -genkey -keyalg RSA -alias selfsigned -keystore

keystore.jks -storepass changeit -validity 360 -keysize

2048

� Import the server side certificate to the above keystore

keytool -import -trustcacerts -alias

DemoCertFor_JCS1_domain -file

<YOUR_CERTIFICATE_FILE_HERE> -keystore keystore.jks

� Specify the keystore for your client

Page 14: Deploy In-Memory Parallel Graph Analytics (PGX) to Oracle Java Cloud …€¦ · Service step: Provide a Service Name and optional Service Description Select Oracle Java Cloud Service

For example, if you are using the built-in Groovy, you can add the following to the

JAVA_OPTIONS setting in gremlin-opg-rdbms.sh.

-Djavax.net.ssl.trustStore=/home/oracle/keystore.jks

-Djavax.net.ssl.trustStorePassword=changeit

Or run below scripts with your console

export JAVA_OPTIONS="$JAVA_OPTIONS

-Djavax.net.ssl.trustStore=/home/oracle/jcs_final/keysto

re.jks -Djavax.net.ssl.trustStorePassword=changeit"

� Configure the client hosts file for the connection

Because the self signed certificate uses host name instead of IP address, user

needs to modify the client side hosts file to translate the specified host name to

an IP address, you can follow the below steps to complete this operation

1, Login to the client machine

2, Open the /etc/hosts file (assume client system is Linux based)

3, Add one line like below to the end of the file and save the change

<YOUR_IP_ADDRESS> <YOUT_HOST_NAME>

You may refer to another post for this topic:

https://blogs.oracle.com/oraclespatial/four-quick-steps-to-use-a-https-ssl-based-pgx-servi

ce-endpoint

� Now it is time to test the secure connection to the PGX server from your client.

cd $ORACLE_HOME/md/property_graph/dal/groovy

sh ./gremlin-opg-rdbms.sh

cfg

=GraphConfigBuilder.forPropertyGraphRdbms().setJdbcUrl("jdbc:o

racle:thin:@(DESCRIPTION=(ADDRESS=(HOST=YOUR_CLIENT_IP)(PORT=1

521)(PROTOCOL=tcp))(CONNECT_DATA=(SERVICE_NAME=PDB1.uspm020.or

aclecloud.internal)))").setUsername("scott").setPassword("<YOU

R_PASSWORD_HERE>").setName("connections").setMaxNumConnections

(8).setLoadEdgeLabel(false).addVertexProperty("name",PropertyT

ype.STRING,

"default_name").addEdgeProperty("cost",PropertyType.DOUBLE,

"1000000").build();

opg = OraclePropertyGraph.getInstance(cfg);

opg.clearRepository(); // start from scratch

opgdl=OraclePropertyGraphDataLoader.getInstance();

vfile="../../data/connections.opv" //vertex flat file

efile="../../data/connections.ope" //edge flat file

opgdl.loadData(opg, vfile, efile, 2,10000, true, null);

session=Pgx.createSession("https://YOUR_HOST_NAME:PORT/pgx",

"session-id-1231");

Page 15: Deploy In-Memory Parallel Graph Analytics (PGX) to Oracle Java Cloud …€¦ · Service step: Provide a Service Name and optional Service Description Select Oracle Java Cloud Service

opg-nosql> analyst=session.createAnalyst();

opg-nosql> pgxGraph =

session.readGraphWithProperties(opg.getConfig(),true);

//count triangles

analyst.countTriangles(pgxGraph, true);

//pgql

pgxResultSet = pgxGraph.queryPgql("SELECT n.company,m WHERE (n

WITH company='Koch Industries')->(m)->(n), n!=m")

pgxResultSet.print(10);

+------------------------------------+

| n | m |

+------------------------------------+

| PgxVertex[ID=2] | PgxVertex[ID=1] |

| PgxVertex[ID=3] | PgxVertex[ID=1] |

| PgxVertex[ID=6] | PgxVertex[ID=1] |

| PgxVertex[ID=7] | PgxVertex[ID=1] |

| PgxVertex[ID=8] | PgxVertex[ID=1] |

| PgxVertex[ID=9] | PgxVertex[ID=1] |

| PgxVertex[ID=10] | PgxVertex[ID=1] |

| PgxVertex[ID=11] | PgxVertex[ID=1] |

| PgxVertex[ID=12] | PgxVertex[ID=1] |

| PgxVertex[ID=19] | PgxVertex[ID=1] |

*A PGX client could be any machine with the database (12.2 or above) installed.