8

Build Oracle Graph on Docker (Part 2/2)

 2 years ago
source link: https://medium.com/oracledevs/build-oracle-graph-on-docker-part-2-2-407827b0b93
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Build Oracle Graph on Docker (Part 2/2)

In Part 1, I explained how to run Oracle Database on a container and use it as a graph database. There are various ways to use it in this environment alone, such as converting table data to graphs, creating views, and even combining it with JSON, which I will introduce in the future.

However, this article will focus only on explaining the procedure to build and add a container for Graph Server. In the architecture diagram below, we have already built the 2-tier deployment, and now we will add the 3-tier deployment.

1*GZLOqIeqmM8CvH-M-l3fFw.png?q=20
build-oracle-graph-on-docker-part-2-2-407827b0b93

Building the Graph Server

Download the RPM package that contains Graph Server and Graph Viz from this site. When you select the package below, you will be asked to agree to the license and log in with your Oracle account.

  • Oracle Graph Server

In addition, download JDK 11 from this site. There is no license fee for personal or development use.

  • Linux - x64 RPM Package

Place these RPM packages and the Dockerfile you will create next in the same directory.

  • oracle-graph-21.4.0.x86_64.rpm
  • jdk-11.x.xx_linux-x64_bin.rpm
vi Dockerfile

This is a sample Dockerfile.

FROM oraclelinux:7
ARG VERSION_JDK
ARG VERSION_GSC
COPY ./jdk-${VERSION_JDK}_linux-x64_bin.rpm /tmp
COPY ./oracle-graph-${VERSION_GSC}.x86_64.rpm /tmp
RUN yum install -y unzip numactl vim python3 openssl \
&& yum clean all \
&& rm -rf /var/cache/yum/* \
&& rpm -ivh /tmp/jdk-${VERSION_JDK}_linux-x64_bin.rpm \
&& rpm -ivh /tmp/oracle-graph-${VERSION_GSC}.x86_64.rpm
ENV JAVA_HOME=/usr/java/jdk-${VERSION_JDK}
ENV PATH=$PATH:/opt/oracle/graph/bin
ENV SSL_CERT_FILE=/etc/oracle/graph/ca_certificate.pem
RUN keytool -import -trustcacerts \
-keystore $JAVA_HOME/lib/security/cacerts -storepass changeit \
-alias pgx -file /etc/oracle/graph/ca_certificate.pem -noprompt \
&& pip3 install pyjnius
EXPOSE 7007
WORKDIR /opt/oracle/graph/bin
CMD ["sh", "/opt/oracle/graph/pgx/bin/start-server"]

Build the image, replacing the JDK version <version_of_JDK> with the proper version number, such as 11.0.13.

docker build . \
--tag graph-server:21.4.0 \
--build-arg VERSION_GSC=21.4.0 \
--build-arg VERSION_JDK=<version_of_JDK>

Once the image is built, create a container.

docker run \
--name graph-server \
--publish 7007:7007 \
graph-server:21.4.0

Edit the JDBC URL for the database connection.

docker exec -it graph-server /bin/bashvi /etc/oracle/graph/pgx.conf

pgx.conf:

"jdbc_url": "jdbc:oracle:thin:@host.docker.internal:1521/xepdb1",

Restart the container.

docker restart graph-server

Log in to Graph Viz

Now you can log in to Graph Visualization from your web browser.

You will see a security warning because of the self-signed certificate. So you have to proceed with:

  • Chrome: Type “thisisunsafe” on the screen
  • Firefox: Advanced > Accept the risk and continue

Log in as the database user you created before.

  • User: graphuser
  • Password: Welcome1 (if you set it as described in the previous article)
  • Advanced Options: Database
    jdbc:oracle:thin:@host.docker.internal:1521/xepdb1

To visualize the graph GRAPH1 created in the previous article, execute the following PGQL query.

SELECT v1.name, v2.brand, e.since
FROM MATCH (v1)-[e]->(v2)
LIMIT 100

You can right-click on a node or edge to see its property values.

1*3KZoXE7LNFGwqOM3o5463w.jpeg?q=20
build-oracle-graph-on-docker-part-2-2-407827b0b93

We have now created an environment for Oracle Graph. Let’s use this environment to discuss various use cases of graph databases, which I will cover in future articles.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK