Oracle by Example brandingGet Started with Oracle Coherence Cloud

section 0Before You Begin

This 15-minute tutorial shows you how to provision an Oracle Coherence cluster in Oracle Cloud Infrastructure using Marketplace and Resource Manager.

Background

You can use the Oracle Coherence Cloud application in the Oracle Cloud Infrastructure Marketplace to provision a cluster of Coherence server nodes. Marketplace uses Resource Manager to provision the network and compute instances as single unit called a stack.

This tutorial shows how to create an Oracle Coherence cluster in Oracle Cloud Infrastructure. In this tutorial, we create new virtual cloud network (VCN) and subnet in Oracle Cloud Infrastructure to support the Coherence cluster. However, you can also use an existing VCN and existing subnet if desired. We provision the Coherence cluster in a regional-scoped public subnet that is accessible from external clients. Alternatively, you can limit the scope of the subnet to one availability domain (AD) in a region, or limit access by provisioning the cluster in a private subnet.

What Do You Need?

  • Your Oracle Cloud Infrastructure user name and password.
  • An Oracle Cloud Infrastructure compartment. See Managing Compartments.
  • An Oracle Cloud Infrastructure policy that enables you to work with or create these resources in the selected compartment:
    • Marketplace applications
    • Resource Manager stacks and jobs
    • Compute instances and networks

    See Common Policies.

  • An SSH public key and corresponding private key.

section 1Create the Stack

  1. Sign in to the Oracle Cloud Infrastructure console.
  2. Click the navigation menu, and then click Marketplace.
  3. Select the Coherence Cloud Edition application from the list of available applications.
  4. Select the default version 12.2.1.4.0-default.
  5. Select the Compartment in which to create the stack.
  6. Select the Terms and Restrictions check box, and then click Launch Stack.

    The Stack Information page displays.

  7. For Name, enter MyCohStack.
  8. Click Next.

    The Configure Variables page displays.

  9. For Resource Name Prefix, enter MyCoh.
  10. For Coherence Shape, select the shape of the compute instances.

    See Compute Shapes.

  11. For SSH Public Key, paste the contents of your SSH public key file.
  12. For Coherence Instance Availability Domain, select the availability domain in which to create the compute instances.
  13. For Number of Compute Instances, select 2.
  14. For Virtual Cloud Network Strategy, select Create New VCN.

    Oracle Coherence Cloud creates a new network and subnets to support this stack.

  15. For Coherence Network, enter MyCohStackNetwork.
  16. For Subnet Strategy, select Create New Subnet.
  17. For Subnet Type, keep the default Use Public Subnet selection.
  18. For Subnet Span, keep the default Regional Subnet selection.
  19. Click Next.

    The Review page of the Create Stack wizard appears.

  20. Click Create. The Job Details page in Resource Manager appears.
  21. Once the stack is created, navigate to the Stack Details page in Resource Manager.

    Click the Terraform Actions drop-down menu and select Apply.

    An Apply job is started to provision your cluster. On the Job Details page in Resource Manager, periodically monitor the progress of the Apply job until it succeeds.


section 3Test Coherence

Connect to your Coherence cluster with an SSH client and view cluster logs.

  1. From the Job Details page, click Associated Resources.
  2. Click the MyCohPrefix-coh-0 instance.
  3. Identify and copy the Public IP Address value of this instance.
  4. From your computer, open an SSH tunnel to an unused port as the opc user.
  5. Note the path to your SSH private key that corresponds to the public key that you specified when you created the Coherence stack.
  6. Enter the following SSH command:
    ssh -i path_to_private_key opc@public_ip

    Once you are connected to the cluster, you can perform a variety of operations including, starting or stopping a cluster instance, viewing logs, adding a new cluster instance, and more.

  7. Run the following command to view the cluster logs for the current node:
    sudo journalctl -u coherence@default-cluster.service
    To follow cluster logs, add the -f option to the above command.

section 4Start and Stop Cluster Services

  1. In the same terminal window as the opc user, enter the following command to check if the cluster on that node is running:
    sudo systemctl status coherence@default-cluster.service

    This command returns the running status of the cluster on that node:

    coherence@default-cluster.service - Oracle Coherence cache server for cluster default-cluster
       Loaded: loaded (/etc/systemd/system/coherence@.service; enabled; vendor preset: disabled)
       Active: active (running) since Wed 2019-09-25 07:02:40 GMT; 14s ago
         Docs: https://www.oracle.com/middleware/technologies/coherence.html
     Main PID: 7388 (java)
       CGroup: /system.slice/system-coherence.slice/coherence@default-cluster.service
               7388 /opt/usr/local/jdk/jdk1.8.0_211/bin/java -cp /opt/usr/local/etc:/opt/usr/local/lib/*:/opt/usr/local/oracle/coherence_home/coherence/lib/coherence.jar -Dtangosol.co...
  2. Enter the following command to stop the cluster:
    sudo systemctl stop coherence@default-cluster.service

    To ensure that the cluster services have stopped, check the status of the cluster using the sudo systemctl status command.

  3. To start the cluster services again, enter the command:
    sudo systemctl start coherence@default-cluster.service

section 5Delete the Stack (Optional)

  1. Return to the Oracle Cloud Infrastructure console.
  2. Click the navigation menu, select Resource Manager, and then click Stacks.
  3. Click MyCohStack.
  4. Click Terraform Actions, and then select Destroy.
  5. When prompted for confirmation, click Destroy.

    Periodically monitor the progress of the Destroy job until it is finished.

  6. Once the job is complete, click Delete Stack.
  7. When prompted for confirmation, click Delete.

more informationWant to Learn More?