Copyright © Cloud Software Group, Inc. All Rights Reserved
Copyright © Cloud Software Group, Inc. All Rights Reserved


Chapter 5 Using the Example Code : Shared-Nothing Persistence

Shared-Nothing Persistence
This example shows how to make an application be its own persister using the internal shared-nothing persistence feature.
Overview
Shared-nothing persistence can be demonstrated using the ASOperations example. With shared-nothing persistence, each seeder in the space stores its space entries locally on disk.
Using ASOperations for shared-nothing persistence, you will be able to see how data is recovered from disk. If all seeders in a space go down, data recovery is initiated using as-admin after the seeders are brought back up.
The following is the default location for persisting data:
data_store_path/metaspace_name/space_name/member_name
Where data_store_path defaults to your user home directory. Use the -data_store command line option to change the default data_store_path location.
Shared-nothing persistence is built into ActiveSpaces, so there is no persistence interface that you need to implement. The only thing you have to do is to define a space with a persistence type of shared-nothing.
Starting ASOperations for Shared-Nothing Persistence
The following examples show how to invoke ASOperations for shared-nothing persistence.
Java Invocation
java ASOperations -metaspace examplems -space shared_nothing_persisted -persistence shared_nothing -role seeder [-data_store path]
C Invocation
ASOperations -metaspace examplems -space shared_nothing_persisted -persistence shared_nothing -role seeder [-data_store path]
.NET Invocation
AS_HOME\examples\dotnet\ASOperations.exe -metaspace examplems -persistence shared_nothing -role seeder [-data_store path]
When using ASOperations for shared-nothing persistence, you must start ASOperations as a seeder so that data will be stored on the node running ASOperations. The basic space definition is used, but the persistence type of the space is set to shared-nothing. To identify this slightly different space, ASOperations uses a default space name of shared_nothing_persisted when it detects that shared-nothing persistence has been specified. This is done to prevent conflicts with other examples which may already be running and using the default space definition.
Starting as-agents for Shared-Nothing Persistence
You can also run as-agents to provide additional persistence nodes for the space. The following are examples of how to invoke as-agent to work in conjunction with ASOperations when invoked for shared-nothing persistence:
Java Invocation
java [-d64] -jar AS_HOME/lib/as-agent.jar -metaspace examplems [-data_store path]
C Invocation
AS_HOME/bin/as-agent.exe -metaspace examplems [-data_store path]
.NET Invocation
AS_HOME\bin\Agent.NET.exe -metaspace examplems [-data_store path]
Starting ASOperations for Shared-Nothing Persistence With Security
The following example shows the command line options that you can use when starting ASOperations for shared-nothing persistence to have it join the security domain exdomain:
-persistence shared_nothing -role seeder [-data_store path] -security_token exdomain_token.txt -encrypt_field
These command line options start ASOperations using the default metaspace named ms and allow it to connect to a security domain controller that has been started using the example security policy file example_policy.txt.
When you use ASOperations to put data into the space, you will see the following additional prompt:
Put: Enter the value to be encrypted (string):
The value you enter at this prompt is stored into a field named secure_value, which is defined as a string. Any string value that you enter in response to this prompt is encrypted when it is stored in the space and when it is persisted.
See the section Data Encryption in Chapter 4., “Implementing ActiveSpaces Security” for information on encrypting data fields.
Using Shared-Nothing Persistence
One of the interesting things to see demonstrated for shared-nothing persistence, is how recovery occurs when all of the seeders for a space go down and then come back up.
Complete these steps to see how a space is recovered when using ASOperations for shared-nothing persistence:
1.
Start ASOperations as described above.
We will refer to this process as ASOperations1.
2.
Start another ASOperations as described above.
We will refer to this process as ASOperations2.
3.
4.
Use the br command with ASOperations2 to verify the entries in the space.
5.
Exit the ASOperations1 process (enter quit at the command line).
6.
Use the br command with ASOperations2 to verify that the entries have been redistributed to ASOperations2.
7.
Exit the ASOperations2 process (enter quit at the command line).
8.
You will see a message indicating that the space is not ready and instructing you to issue a recover space admin command.
9.
connect name "examplems"
10.
recover space shared_nothing_persisted with data
11.
When you see the message indicating the persisted data has been loaded in the window used to start ASOperations2, use the br command with ASOperations2 to verify that the entries in the space have been restored.

Copyright © Cloud Software Group, Inc. All Rights Reserved
Copyright © Cloud Software Group, Inc. All Rights Reserved