User Tools

Site Tools


Starting and Stopping the Linux Agent

Since we want the replicator agent to run all the time we'll want to do a few tasks to ensure that it will be automatically started when the computer is started.

First, let's ensure that the replicator agent will run after we've made the necessary configuration changes. This can be done by issuing the following from within the root directory (Perspectium_Replicator-linux)

bin/agent status <cr>

This command won't actually start the agent but it will let us know that it's not running which is important. The following is a sample output when the agent is not running:

Perspectium Replicator Agent is not running.

Now let's start the agent. Again, from the root directory enter the following command:

bin/agent start <cr>

You should see a message similar to the following:

Starting Perspectium Replicator Agent...
Waiting for Perspectium Replicator Agent....
running: PID:12345

What we're expecting is the 'running' response and the process ID or PID number as reflected here. For the moment, let's assume all went well and the agent is running. Let's have a look at the agents output which will give us additional support of this assumption. One way to see the latest contents of the log file is by using the tail command. From the root directory issue the following command:

tail logs/perspectium.log <cr>

You should see the last few lines of the log and the date and time stamp should reflect the current time. You can also issue the following command to continuously get the latest log file entries:

tail -f logs/perspectium.log

You can issue a control-c <hold down the control key and hit the c key at the same time> to terminate this command.

If you see streaming log contents then the agent is running. Hold on a second, just because it's running does not necessarily mean it's working properly. The default replicator agent configuration file is called agent.xml and it's within the conf directory. By default, a message sharer has been configured to share the following message:

'This is a simple message that is being echoed.'

Furthermore, a subscriber has been configured to consume and log the message to the log. You should be able to find a log entry similar to the following in the log:

2014-09-08 10:37:21.265 example.echo - Received echoed message: This is a simple message that is being echoed.

One way to determine if this message exchange has been successful is to use the grep command to search the log by issuing the following command:

grep "Received echoed message" logs/perspectium.log <cr>

If the message is returned then the agent is functioning as expected. Assuming that's the case we can now proceed with establishing the agent as a service to be started upon system start up. First, let's stop the agent by issuing the following command:

bin/agent stop <cr>

You should see a message similar to the following:

Stopping Perspectium Replicator Agent...
Stopped Perspectium Replicator Agent.

Enter the following command to install the agent as a service:

bin/agent install <cr>

That's it! Please refer to the Replication Agent configuration documentation to further leverage the Perspectium Replicator Agent.

raagent_start.txt · Last modified: 2016/03/29 12:46 by mark.english