Running the Availability Management Framework (AMF) Example
The AMF provides redundancy, failure monitoring and restart for applications. To implement this, the AMF requires a description of the cluster, which is essentially a description of all the programs that should be run, whether they "understand" SAF communications, and their redundancy relationships. This is called the "cluster model" or just "model".
An example model and simple redundant "Hello World" application is included with SAFplus and is located in the source code under "examples/eval/basic" (and on download.openclovis.com). This model specifies applications that are "SAF-aware" -- that is, the applications can communicate with the AMF to receive work assignments. Another example model is also provided at "examples/eval/exampleNonSafApp" that handles "non-SAF-aware" applications. Non-SAF-aware applications do not communicate with the AMF -- they may be legacy apps, standard Linux services (e.g Apache), or applications that you do not have access to the source code.
The "Basic" Example: Compiling and Running
This example presumes that you have already installed SAFplus, built it from source.
First, Download and detar the example, or cd to <safplus>/examples/eval/basic if you are using SAFplus source from Github. Next build:
make V=1
The program "basicApp" will be created. If you installed SAFplus it will be created in this directory, but if you are using SAFplus from source, it will be located in the SAFplus target directory (<safplus>/target/<architecture>/bin). This will be called the "bin" directory.
Next, we need to load a cluster model. Two example models are provided in this sample:
- SAFplusAmf1Node1SG1Comp.xml: Run redundant copies of the app on a single node
- SAFplusAmf2Node1SG1Comp.xml: Run on two nodes
Please choose which option you want, cd to the bin directory, and install the model:
cd SAFplus/target/i686-linux-gnu/bin ./safplus_db -x <example_source_dir>/SAFplusAmf1Node1SG1Comp.xml safplusAmf
This command reads the model XML in and writes it to a file called safplusAmf.db in the current directory. The AMF will read this file to access the cluster model.
Finally, run the SAFplus AMF to start up the model:
./safplus_amf
Troubleshooting
- SAFplus AMF never starts any applications. It just says:
Fri Apr 8 14:07:07.388 2016 [nPlusmAmfPolicy.cxx:510] (.0.7671 : AMF.N+M.AUDIT:00996 : INFO) Service Instance [si] should be fully assigned but is [unassigned]. Current active assignments [0], targeting [1] Fri Apr 8 14:07:07.388 2016 [nPlusmAmfPolicy.cxx:527] (.0.7671 : AMF.N+M.AUDIT:00997 : INFO) Service Instance [si] cannot be assigned 0th active. No available service units. Fri Apr 8 14:07:07.388 2016 [customAmfPolicy.cxx:36] (.0.7671 : AMF.POL.CUSTOM:00998 : INFO) Active audit Fri Apr 8 14:07:07.388 2016 [customAmfPolicy.cxx:47] (.0.7671 : AMF.CUSTOM.AUDIT:00999 : INFO) Auditing service group sg0
Did you forget to set a node name? The node names in the model do not match the nodes running.