This chapter describes how to install and set up your environment for running Oracle JDeveloper Studio Edition 11g and Oracle Coherence 3.4.x. This chapter contains the following sections:
This chapter assumes that you have the privileges to install software and set system environment variables as the oracle user, an understanding of how to use a terminal window, including setting environment variables, and creating and moving between directories. It also assumes that you have a working installation of Java SE (JDK) version 1.6.
To download and install Oracle Coherence:
Download Oracle Coherence 3.4.x to your desktop.
Coherence (Java edition) ships as a single zip file, typically called coherence-<
version>.zip
. You can obtain Coherence 3.4.x from the following URL:
http://www.oracle.com/technology/products/coherence/index.html
Extract the contents of the zip file to a directory named C:\oracle\product
.
The zip file contains the coherence directory with these subdirectories:
bin
—contains command scripts
lib
—contains the required library files
examples
— contains the example code
doc
—contains the product documentation
To download and Install Oracle JDeveloper Studio Edition 11g:
Download Oracle JDeveloper Studio.
You can obtain JDeveloper Studio 11g from the following URL:
Run the JDeveloper Studio installer.
Follow the prompts in the installation screens. If the installer asks for a Middleware Home, enter C:\oracle\product
if it does not already exist.
If you are asked for a User Role when JDeveloper starts, select Default Role to enable all technologies.
In this exercise, you test whether your Coherence installation can cluster Java processes together. This will ensure that Coherence-based applications that ship with Coherence will run as expected. If Coherence is not capable of clustering on a single machine, then you will need to reconfigure your network and firewall settings.
This exercise assumes that you have installed Oracle Coherence (Java Edition) 3.4.1 (See "Downloading and Installing Coherence").
Coherence uses a variety of network addresses and ports to enable communication between clustered processes. If these addresses and/or ports are unavailable due to other applications using them, or because of a firewall, then Coherence may be unreliable, may fail to cluster, or may not work at all. By default, Coherence assumes that the network addresses and ports listed in Table 1-1 are available:
Table 1-1 Network Addresses and Ports Used by Coherence
Address / Port / Type | Purpose |
---|---|
|
Cluster member discovery and broadcast |
|
Inter-process communication between cluster members. ( |
Coherence ships with two simple command-line (shell-based) applications that can be used to determine whether Coherence will operate correctly.
The "cache server," is a simple application that hosts and manages data on behalf of other applications in a cluster.
The "coherence shell," is a simple application that enables a developer to access, process, and update cached data within a cluster. It also provides informaiton about the cluster. By executing these applications on either a single host or several hosts, you can determine whether Coherence is operating correctly locally or across a network.
When an application uses Coherence out-of-the-box, objects placed into Coherence caches are typically stored and managed in-process within the application. However, to increase the availability of the objects, Coherence may manage objects in-memory but out of the application process. This allows objects to survive possible application outages (either deliberate or accidental). To manage objects in this way, Coherence uses "Cache Servers". The purpose of a Coherence cache server is to manage application state in a cluster outside the application process. It is much like a database server, but without the requirement for storage.
To set up and run the cache server and client:
Open a terminal window and verify that the PATH
environment variable is set to include \oracle\product\jdk160_05\bin
. If the PATH
environment variable does not include jdk\jdk160_05\bin
directory, then set the variable as follows:
Set the JAVA_HOME
environment variable to the base of the JDK installation.
set JAVA_HOME=\oracle\product\jdk160_05
Include JAVA_HOME\bin
in the PATH
environment variable.
set PATH=%JAVA_HOME%\bin;%PATH%
Navigate to the directory where Coherence is installed. Edit cache-server.cmd
and set the COHERENCE_HOME
variable to point to the Coherence installation directory.
cd C:\oracle\product\coherence\bin
In cache-server.cmd
, set the COHERENCE_HOME
environment variable:
COHERENCE_HOME=C:\oracle\product\coherence
Save cache-server.cmd
and close the file.
Example 1-1 illustrates cache-server.cmd
with the edited value of COHERENCE_HOME
.
Example 1-1 cache-server.cmd File with an Edited COHERENCE_HOME
@echo off
@
@rem This will start a cache server
@
setlocal
:config
@rem specify the Coherence installation directory
set coherence_home=c:\oracle\product\coherence
@rem specify the JVM heap size
set memory=512m
:start
if not exist "%coherence_home%\lib\coherence.jar" goto instructions
if "%java_home%"=="" (set java_exec=java) else (set java_exec=%java_home%\bin\java)
:launch
set java_opts="-Xms%memory% -Xmx%memory%"
"%java_exec%" -server -showversion "%java_opts%" -cp "%coherence_home%\lib\coherence.jar" com.tangosol.net.DefaultCacheServer %1
goto exit
:instructions
echo Usage:
echo ^<coherence_home^>\bin\cache-server.cmd
goto exit
:exit
endlocal
@echo on
Execute the cache server application that is located in the coherence\bin
directory.
C:\oracle\product\coherence\bin>cache-server.cmd
When you start the first cache server, there is a slight delay because the cache server looks for an existing cluster. When it determines that there are no clusters to join, it starts one. On startup, the cache server will produce output similar to the code in Example 1-2.
Several important features are highlighted in the example:
the Java JDK version number: java version "1.6.0_05"
information about how configuration files are loaded. The default is to load from JAR: Loaded operational configuration from resource "jar:file:/C:/oracle/product/coherence/lib/coherence.jar!/tangosol-coherence.xml"
the Coherence version number: Oracle Coherence Version 3.4.1/407
the multicast address. This address changes with each Coherence version. Note the 3.4.1
in the address for Coherence version 3.4.1: Group{Address=224.3.4.1, Port=34407, TTL=4}
the Member Id indicates the number of members in your cluster. For the purposes of this exercise, the value should be 1. ThisMember=Member(Id=1 ...
Example 1-2 Output from Starting a Coherence Cache Server
C:\oracle\product\coherence\bin>cache-server.cmd java version "1.6.0_05" Java(TM) SE Runtime Environment (build 1.6.0_05-b13) Java HotSpot(TM) Server VM (build 10.0-b19, mixed mode) 2008-12-09 14:29:11.968/1.391 Oracle Coherence 3.4.1/407 <Info> (thread=main, me mber=n/a): Loaded operational configuration from resource "jar:file:/C:/oracle/p roduct/coherence/lib/coherence.jar!/tangosol-coherence.xml" 2008-12-09 14:29:11.983/1.406 Oracle Coherence 3.4.1/407 <Info> (thread=main, me mber=n/a): Loaded operational overrides from resource "jar:file:/C:/oracle/produ ct/coherence/lib/coherence.jar!/tangosol-coherence-override-dev.xml" 2008-12-09 14:29:11.983/1.406 Oracle Coherence 3.4.1/407 <D5> (thread=main, memb er=n/a): Optional configuration override "/tangosol-coherence-override.xml" is n ot specified 2008-12-09 14:29:11.983/1.406 Oracle Coherence 3.4.1/407 <D5> (thread=main, memb er=n/a): Optional configuration override "/custom-mbeans.xml" is not specified Oracle Coherence Version 3.4.1/407 Grid Edition: Development mode Copyright (c) 2000-2008 Oracle. All rights reserved. 2008-12-09 14:29:12.827/2.250 Oracle Coherence GE 3.4.1/407 <Info> (thread=main, member=n/a): Loaded cache configuration from resource "jar:file:/C:/oracle/prod uct/coherence/lib/coherence.jar!/coherence-cache-config.xml"2008-12-09 14:29:14.093/3.516 Oracle Coherence GE 3.4.1/407 <D5> (thread=Cluster , member=n/a): Service Cluster joined the cluster with senior service member n/a 2008-12-09 14:29:17.343/6.766 Oracle Coherence GE 3.4.1/407 <Info> (thread=Clust er, member=n/a): Created a new cluster "cluster:0x23CB" with Member(Id=1, Timest amp=2008-12-09 14:29:13.702, Address=130.35.99.248:8088, MachineId=49912, Locati on=site:us.oracle.com,machine:tpfaeffl-pc,process:4440, Role=CoherenceServer, Ed ition=Grid Edition, Mode=Development, CpuCount=1, SocketCount=1) UID=0x822363F80 000011E1DDE4966C2F81F98 2008-12-09 14:29:17.671/7.094 Oracle Coherence GE 3.4.1/407 <D5> (thread=Distrib utedCache, member=1): Service DistributedCache joined the cluster with senior se rvice member 12008-12-09 14:29:17.827/7.250 Oracle Coherence GE 3.4.1/407 <D5> (thread=Replica tedCache, member=1): Service ReplicatedCache joined the cluster with senior serv ice member 12008-12-09 14:29:17.843/7.266 Oracle Coherence GE 3.4.1/407 <D5> (thread=Optimis ticCache, member=1): Service OptimisticCache joined the cluster with senior serv ice member 12008-12-09 14:29:17.858/7.281 Oracle Coherence GE 3.4.1/407 <D5> (thread=Invocat ion:InvocationService, member=1): Service InvocationService joined the cluster w ith senior service member 12008-12-09 14:29:17.874/7.297 Oracle Coherence GE 3.4.1/407 <Info> (thread=main, member=1): Started DefaultCacheServer... SafeCluster: Name=cluster:0x23CB Group{Address=224.3.4.1, Port=34407, TTL=4} MasterMemberSet ( ThisMember=Member(Id=1, Timestamp=2008-12-09 14:29:13.702, Address=130.35.99.2 48:8088, MachineId=49912, Location=site:us.oracle.com,machine:tpfaeffl-pc,proces s:4440, Role=CoherenceServer) OldestMember=Member(Id=1, Timestamp=2008-12-09 14:29:13.702, Address=130.35.99 .248:8088, MachineId=49912, Location=site:us.oracle.com,machine:tpfaeffl-pc,proc ess:4440, Role=CoherenceServer) ActualMemberSet=MemberSet(Size=1, BitSetCount=2 Member(Id=1, Timestamp=2008-12-09 14:29:13.702, Address=130.35.99.248:8088, MachineId=49912, Location=site:us.oracle.com,machine:tpfaeffl-pc,process:4440, R ole=CoherenceServer) ) RecycleMillis=120000 RecycleSet=MemberSet(Size=0, BitSetCount=0 ) ) Services ( TcpRing{TcpSocketAccepter{State=STATE_OPEN, ServerSocket=130.35.99.248:8088}, Connections=[]} ClusterService{Name=Cluster, State=(SERVICE_STARTED, STATE_JOINED), Id=0, Vers ion=3.4, OldestMemberId=1} DistributedCache{Name=DistributedCache, State=(SERVICE_STARTED), LocalStorage= enabled, PartitionCount=257, BackupCount=1, AssignedPartitions=257, BackupPartit ions=0} ReplicatedCache{Name=ReplicatedCache, State=(SERVICE_STARTED), Id=2, Version=3 .0, OldestMemberId=1} Optimistic{Name=OptimisticCache, State=(SERVICE_STARTED), Id=3, Version=3.0, O ldestMemberId=1} InvocationService{Name=InvocationService, State=(SERVICE_STARTED), Id=4, Versi on=3.1, OldestMemberId=1} )
Note:
By default, Coherence uses multicast only to search for cluster members. Multicast is not used for data transfer. If you cannot use or do not want to use multicast, this can be configured.The output of cache-server.cmd
indicates whether you have one or more members in your cluster. The value of Member ID should be equal to 1:
...
In MasterMemberSet
ThisMember=Member(Id should be equal to 1)
...
If Member ID is greater than 1, then multiple clusters are being formed in your subnet. For the purposes of these exercises, there should only be one member in the cluster. Follow the steps in "Restricting Coherence to Your Own Host" to restrict Coherence to your own host.
Open another terminal window to run the cache client.
Verify that the PATH
environment variable is set to include \oracle\product\jdk160_05\bin
. If the PATH
environment variable does not include the jdk160_05\bin
directory, then set the variable as follows:
Set the JAVA_HOME
environment variable to the base of the JDK installation.
set JAVA_HOME=\oracle\product\jdk160_05
Include JAVA_HOME\bin
in the PATH
environment variable.
set PATH=%JAVA_HOME%\bin;%PATH%
Navigate to the \oracle\product\coherence\bin
directory. Edit coherence.cmd
and set the COHERENCE_HOME
variable to point to the Coherence installation directory. Save and close the file.
Example 1-3 illustrates the coherence.cmd
file, with COHERENCE_HOME=\oracle\product\coherence
.
Example 1-3 coherence.cmd File with an Edited COHERENCE_HOME
@echo off
@
@rem This will start a console application
@rem demonstrating the functionality of the Coherence(tm) API
@
setlocal
:config
@rem specify the Coherence installation directory
set coherence_home=c:\oracle\product\coherence
@rem specify if the console will also act as a server
set storage_enabled=false
@rem specify the JVM heap size
set memory=64m
:start
if not exist "%coherence_home%\lib\coherence.jar" goto instructions
if "%java_home%"=="" (set java_exec=java) else (set java_exec=%java_home%\bin\java)
:launch
if "%storage_enabled%"=="true" (echo ** Starting storage enabled console **) else (echo ** Starting storage disabled console **)
set java_opts="-Xms%memory% -Xmx%memory% -Dtangosol.coherence.distributed.localstorage=%storage_enabled%"
"%java_exec%" -server -showversion "%java_opts%" -cp "%coherence_home%\lib\coherence.jar" com.tangosol.net.CacheFactory %1
goto exit
:instructions
echo Usage:
echo ^<coherence_home^>\bin\coherence.cmd
goto exit
:exit
endlocal
@echo on
Execute the coherence.cmd
file to start the cache client. This application shows you the basic distributed cache functionality that is built within Coherence.
coherence.cmd
Example 1-4 illustrates the output from starting the cache client. Note the following features of the output:
the client is the second member of the cluster (the server is the first member): ThisMember=Member(Id=2,...
at the end of the output, you should see the Map(?)
prompt
Example 1-4 Output from Starting the Coherence Cache Client
** Starting storage disabled console **java version "1.6.0_05"Java(TM) SE Runtime Environment (build 1.6.0_05-b13)Java HotSpot(TM) Server VM (build 10.0-b19, mixed mode)2008-12-09 19:35:54.952/0.719 Oracle Coherence 3.4.1/407 <Info> (thread=main, member=n/a): Loaded operational configuration from resource "jar:file:/C:/oracle/product/coherence/lib/coherence.jar!/tangosol-coherence.xml"2008-12-09 19:35:54.968/0.735 Oracle Coherence 3.4.1/407 <Info> (thread=main, member=n/a): Loaded operational overrides from resource "jar:file:/C:/oracle/product/coherence/lib/coherence.jar!/tangosol-coherence-override-dev.xml"2008-12-09 19:35:54.968/0.735 Oracle Coherence 3.4.1/407 <D5> (thread=main, member=n/a): Optional configuration override "/tangosol-coherence-override.xml" is not specified2008-12-09 19:35:54.968/0.735 Oracle Coherence 3.4.1/407 <D5> (thread=main, member=n/a): Optional configuration override "/custom-mbeans.xml" is not specifiedOracle Coherence Version 3.4.1/407 Grid Edition: Development modeCopyright (c) 2000-2008 Oracle. All rights reserved.2008-12-09 19:35:56.843/2.610 Oracle Coherence GE 3.4.1/407 <D5> (thread=Cluster, member=n/a): Service Cluster joined the cluster with senior service member n/a 2008-12-09 19:35:56.999/2.766 Oracle Coherence GE 3.4.1/407 <Info> (thread=Clust er, member=n/a): Failed to satisfy the variance: allowed=16, actual=125 2008-12-09 19:35:56.999/2.766 Oracle Coherence GE 3.4.1/407 <Info> (thread=Clust er, member=n/a): Increasing allowable variance to 29 2008-12-09 19:35:57.264/3.031 Oracle Coherence GE 3.4.1/407 <Info> (thread=Clust er, member=n/a): This Member(Id=2, Timestamp=2008-12-09 19:35:57.046, Address=13 0.35.99.248:8089, MachineId=49912, Location=site:us.oracle.com,machine:tpfaeffl- pc,process:4716, Role=CoherenceConsole, Edition=Grid Edition, Mode=Development, CpuCount=1, SocketCount=1) joined cluster "cluster:0x23CB" with senior Member(Id =1, Timestamp=2008-12-09 18:30:10.436, Address=130.35.99.248:8088, MachineId=499 12, Location=site:us.oracle.com,machine:tpfaeffl-pc,process:4148, Role=Coherence Server, Edition=Grid Edition, Mode=Development, CpuCount=1, SocketCount=1) 2008-12-09 19:35:57.311/3.078 Oracle Coherence GE 3.4.1/407 <D5> (thread=Cluster , member=n/a): Member 1 joined Service DistributedCache with senior member 1 2008-12-09 19:35:57.311/3.078 Oracle Coherence GE 3.4.1/407 <D5> (thread=Cluster , member=n/a): Member 1 joined Service ReplicatedCache with senior member 1 2008-12-09 19:35:57.311/3.078 Oracle Coherence GE 3.4.1/407 <D5> (thread=Cluster , member=n/a): Member 1 joined Service OptimisticCache with senior member 1 2008-12-09 19:35:57.311/3.078 Oracle Coherence GE 3.4.1/407 <D5> (thread=Cluster , member=n/a): Member 1 joined Service InvocationService with senior member 1 SafeCluster: Name=cluster:0x23CB Group{Address=224.3.4.1, Port=34407, TTL=4} MasterMemberSet ( ThisMember=Member(Id=2, Timestamp=2008-12-09 19:35:57.046, Address=130.35.99.2 48:8089, MachineId=49912, Location=site:us.oracle.com,machine:tpfaeffl-pc,proces s:4716, Role=CoherenceConsole) OldestMember=Member(Id=1, Timestamp=2008-12-09 18:30:10.436, Address=130.35.99 .248:8088, MachineId=49912, Location=site:us.oracle.com,machine:tpfaeffl-pc,proc ess:4148, Role=CoherenceServer) ActualMemberSet=MemberSet(Size=2, BitSetCount=2 Member(Id=1, Timestamp=2008-12-09 18:30:10.436, Address=130.35.99.248:8088, MachineId=49912, Location=site:us.oracle.com,machine:tpfaeffl-pc,process:4148, R ole=CoherenceServer) Member(Id=2, Timestamp=2008-12-09 19:35:57.046, Address=130.35.99.248:8089, MachineId=49912, Location=site:us.oracle.com,machine:tpfaeffl-pc,process:4716, R ole=CoherenceConsole) ) RecycleMillis=120000 RecycleSet=MemberSet(Size=0, BitSetCount=0 ) ) Services ( TcpRing{TcpSocketAccepter{State=STATE_OPEN, ServerSocket=130.35.99.248:8089}, Connections=[]} ClusterService{Name=Cluster, State=(SERVICE_STARTED, STATE_JOINED), Id=0, Vers ion=3.4, OldestMemberId=1} ) Map (?): 2008-12-09 19:35:58.280/4.047 Oracle Coherence GE 3.4.1/407 <D5> (thread=TcpRing Listener, member=2): TcpRing: connecting to member 1 using TcpSocket{State=STATE _OPEN, Socket=Socket[addr=/130.35.99.248,port=2115,localport=8089]} Map (?):
Exercise the client application by executing the following Coherence commands in the Coherence shell:
Enter help
to see the list of commands that are available.
Enter cache mycache
.
The cache mycache
implements the com.tangosol.net.NamedCache
interface. Each NamedCache
can be thought of as a table. A cluster can have many named caches. Each NamedCache
holds one type of object. It can be a simple object, such as a String, or a complex object that you define.
Example 1-5 illustrates that using the default configuration files (coherence-cache-config.xml
) within the supplied coherence.jar
file, a NamedCache
called mycache
is created using the distributed scheme:
Example 1-5 Output from Starting a Coherence Cache
Map (?): cache mycache 2008-12-09 19:46:02.889/608.656 Oracle Coherence GE 3.4.1/407 <Info> (thread=mai n, member=2): Loaded cache configuration from resource "jar:file:/C:/oracle/prod uct/coherence/lib/coherence.jar!/coherence-cache-config.xml" 2008-12-09 19:46:03.421/609.188 Oracle Coherence GE 3.4.1/407 <D5> (thread=Distr ibutedCache, member=2): Service DistributedCache joined the cluster with senior service member 1 2008-12-09 19:46:03.452/609.219 Oracle Coherence GE 3.4.1/407 <D5> (thread=Distr ibutedCache, member=2): Service DistributedCache: received ServiceConfigSync con taining 258 entries <distributed-scheme> <!-- To use POF serialization for this partitioned service, uncomment the following section <serializer> <class- name>com.tangosol.io.pof.ConfigurablePofContext</class- name> </serializer> --> <scheme-name>example-distributed</scheme-name> <service-name>DistributedCache</service-name> <backing-map-scheme> <local-scheme> <scheme-ref>example-binary-backing-map</scheme-ref> </local-scheme> </backing-map-scheme> <autostart>true</autostart> </distributed-scheme> Map (mycache):
Execute the following commands at the Map(?)
prompt in the Coherence shell:
get
message
—retrieves the value for the given key from the named cache
put
message
"hello"
—puts a name/value pair (key and value) into the cache. This command always returns the last value assigned to the key.
list
—displays the contents of the named cache
size
get
message
put
message
"second message"
get
message
remove
message
—removes a key value from the cache
size
get
message
put
message
"hi"
bye
Example 1-6 illustrates the output of each of these commands.
Example 1-6 Exercising Coherence Commands
Map (mycache): get message null Map (mycache): put message "hello" null Map (mycache): list message = hello Map (mycache): size 1 Map (mycache): get message hello Map (mycache): put message "second message" hello Map (mycache): get message second message Map (mycache): remove message second message Map (mycache): size 0 Map (mycache): get message null Map (mycache): put message "hi" null Map (mycache): bye 2008-12-10 11:17:18.921/56484.688 Oracle Coherence GE 3.4.1/407 <D5> (thread=DistributedCache, member=2): Service DistributedCache left the cluster2008-12-10 11:17:19.061/56484.828 Oracle Coherence GE 3.4.1/407 <D5> (thread=Cluster, member=2): Service Cluster left the cluster C:\oracle\product\coherence\bin>
Open another terminal window and set the PATH
environment variable to include \oracle\product\jdk160_05\bin
. and the JAVA_HOME
variable to \oracle\product\jdk160_05
(See Step 4).
Start a second instance of coherence.cmd
in the new terminal window. Note that a message similar to the following will be displayed in the terminal window where the first client is running:
Map (mycache): 2008-12-10 11:51:15.468/66.407 Oracle Coherence GE 3.4.1/407 (thread=Cluster, member=3): Member 4 joined Service DistributedCache with senior member 1
Use the cache mycache
command in the new terminal to connect to the NamedCache
called mycache
. Try to get and put values in different sessions. notice that each client can observe changes made by the other client.
Close down one of the coherence.cmd
consoles. Note that a message indicating that the member has left the cluster will appear on the other console. For example:
Map (mycache): 2008-12-10 12:00:09.139/600.078 Oracle Coherence GE 3.4.1/407 <D5> (thread=Cluster, member=3): Member 4 left service DistributedCache with senior member 1 Map (mycache): 2008-12-10 12:00:09.249/600.188 Oracle Coherence GE 3.4.1/407 <D5> (thread=Cluster, member=3): MemberLeft notification for Member 4 received from Member(Id=4, Timestamp=2008-12-10 11:50:51.601, Address=130.35.99.248:8090, MachineId=49912, Location=site:us.oracle.com,machine:tpfaeffl-pc,process:5356, Role=CoherenceConsole) 2008-12-10 12:00:09.249/600.188 Oracle Coherence GE 3.4.1/407 <D5> (thread=Cluster, member=3): Member(Id=4, Timestamp=2008-12-10 12:00:09.249, Address=130.35.99.248:8090, MachineId=49912, Location=site:us.oracle.com,machine:tpfaeffl-pc,process:5356, Role=CoherenceConsole) left Cluster with senior member 1
If you close each of the Coherence shells (bye
), and then restart them, note that data from the previous session still available. This is because the data is held in the cache server.
If you run another Coherence cache server, and then kill the initial one that was started (using Ctrl+C
or by closing the Command Console window), is data still available from the Coherence shells? Why?
Shut down both the coherence.cmd
consoles and cache-server.cmd
. Start coherence.cmd
. Create a NamedCache
called test
using cachetest
. Try to put in a value as before. What happens and why?
Start up a cache server by running the cache-server.cmd
file from the coherence\bin
directory. Try to put in a value again. What happens and why?
Shut down all the cache servers.
If the value of Member ID in the cache-server.cmd
output is anything other than 1, then this indicates that the cache server has clustered with one or more other cache servers or processes running Coherence. These servers or processes may be running on the network or running locally on your host. Though this is default behavior for Coherence—to cluster with other processes running Coherence locally or on a network—it is strongly advised that you restrict Coherence to your own host.
The output of cache-server.cmd
indicates whether you have just one member in your cluster. The value of Member ID should be equal to 1:
...
In MasterMemberSet
ThisMember=Member(Id should be equal to 1)
...
If Member ID is greater than 1, it means that multiple clusters are being formed in your subnet. For the purposes of the exercises in this document, there should only be one member in the cluster.
To restrict Coherence to your own host:
Stop cache server by pressing Ctrl
+
C
.
Create a directory called backup
under oracle\product\coherence\lib
.
cd C:\oracle\product\coherence\lib mkdir backup
Copy coherence.jar
from the oracle\product\coherence\lib
directory to the backup
directory.
cp coherence.jar C:\oracle\product\coherence\lib\backup\coherence.jar
Navigate to the oracle\product\coherence\lib\backup
directory.
Extract tangosol-coherence.xml
from coherence.jar
.
jar -xvf coherence.jar tangosol-coherence.xml
Edit the tangosol-coherence.xml
file.
Change the multicast listener port to a unique value, for example, 34408
. Be sure that your multicast listener port value that you are setting is unique. For example, if you share the port value 34407
with another user, then change your port value to 34408 and the other user can change to 34409
. When you are finished, save the file and quit the editor.
Example 1-7 illustrates the multicast-listener
fragment of tangosol-coherence.xml
with its original port value of 34407
.
Example 1-7 Multicast-Listener Fragment of tangosol-coherence.xml File
...
<multicast-listener>
<address system-property="tangosol.coherence.clusteraddress">224.3.4.1</address>
<port system-property="tangosol.coherence.clusterport">34407</port>
<!--
Note: For production use, this value should be set to the lowest integer
value that works. On a single server cluster, it should work at "0"; on
a simple switched backbone, it should work at "1"; on an advanced backbone
with intelligent switching, it may require a value of "2" or more. Setting
the value too high can utilize unnecessary bandwidth on other LAN segments
and can even cause the OS or network devices to disable multicast traffic.
-->
<time-to-live system-property="tangosol.coherence.ttl">4</time-to-live>
Append the modified tangosol-coherence.xml
file to coherence.jar
in the backup
directory. Replace coherence.jar
in the lib
directory with the one in the backup
directory.
jar -uvf coherence.jar tangosol-coherence.xml cp coherence.jar \oracle\product\coherence\lib\coherence.jar
When you execute cache-server.cmd
, you should be able to view the modified port. Also, your cluster should now be restricted to your own host. If Membership ID still displays something other than 1
, then there may be additional issues with the installation. See "Advanced Steps to Restrict Coherence to Your Own Host" for more information.
If you follow the steps in the previous section and cache-server.cmd
still fails to return a Member Id value of 1, then there may be additional issues you must resolve.
Disconnect from the network or disable networking on your host. If errors or exceptions occur when starting the cache server, your network settings may need to be modified. Try each of the following one at a time, restarting the cache server between each attempt:
If connected to a VPN, disconnect from it. By default, most VPN networks are not configured to permit multicast and some unicast traffic. In this environment, Coherence may not work as it is configured out-of-the-box. Coherence can be configured to run across a VPN, but this requires some advanced settings.
If you are running a firewall, configure it to allow the specified addresses and ports.
If you still experience problems, unplug or disconnect from all the networks. This includes wireless and wired networks.
If all the preceding options fail, set up Coherence to run on a single host.