Before 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.
Create the Stack
- Sign in to the Oracle Cloud Infrastructure console.
- Click the navigation menu, and then click Marketplace.
- Select the Coherence Cloud Edition application from the list of available applications.
- Select the default version 12.2.1.4.0-default.
- Select the Compartment in which to create the stack.
- Select the Terms and Restrictions check
box, and then click Launch Stack.
The Stack Information page displays.
- For Name, enter
MyCohStack
. - Click Next.
The Configure Variables page displays.
- For Resource Name Prefix, enter
MyCoh
. - For Coherence Shape, select the shape of
the compute instances.
See Compute Shapes.
- For SSH Public Key, paste the contents of your SSH public key file.
- For Coherence Instance Availability Domain, select the availability domain in which to create the compute instances.
- For Number of Compute Instances, select 2.
- For Virtual Cloud Network Strategy, select
Create New VCN.
Oracle Coherence Cloud creates a new network and subnets to support this stack.
- For Coherence Network, enter
MyCohStackNetwork
. - For Subnet Strategy, select Create New Subnet.
- For Subnet Type, keep the default Use Public Subnet selection.
- For Subnet Span, keep the default Regional Subnet selection.
- Click Next.
The Review page of the Create Stack wizard appears.
- Click Create. The Job Details page in Resource Manager appears.
- 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.
Test Coherence
Connect to your Coherence cluster with an SSH client and view cluster logs.
- From the Job Details page, click Associated Resources.
- Click the MyCohPrefix-coh-0 instance.
- Identify and copy the Public IP Address value of this instance.
- From your computer, open an SSH tunnel to an unused port as
the
opc
user. - Note the path to your SSH private key that corresponds to the public key that you specified when you created the Coherence stack.
- 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.
- 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.
Start and Stop Cluster Services
- 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...
- 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. - To start the cluster services again, enter the command:
sudo systemctl start coherence@default-cluster.service
Delete the Stack (Optional)
- Return to the Oracle Cloud Infrastructure console.
- Click the navigation menu, select Resource Manager, and then click Stacks.
- Click MyCohStack.
- Click Terraform Actions, and then select Destroy.
- When prompted for confirmation, click Destroy.
Periodically monitor the progress of the Destroy job until it is finished.
- Once the job is complete, click Delete Stack.
- When prompted for confirmation, click Delete.