On this page:

Your Rating:
Results:
PatheticBadOKGoodOutstanding!
13 rates
This topic describes how to manage and troubleshoot Controllers as a high availability pair.

Set Up Monitoring for the HA Pair

You can set up monitoring for your HA pair by installing another Controller to act as the monitoring Controller. This provides the same administrative functionality as the HA toolkit used in 4.3 and earlier versions.

  1. If you do not already have an HA pair, set one up.
  2. Install the monitoring Controller on the Enterprise Console host in a new platform by selecting Custom Install:
    1. Create a platform (e.g.: Controller Monitor Platform).

      This platform should not be used for installing any other services.

    2. Install a Controller.
    3. Make sure to unselect the Install Events Service option before clicking Install.
  3. Complete the monitoring setup by installing and configuring the App Agents and Machine Agents on your HA pair:

Set Up App Agents for Monitoring

You can set up App Agents, which are automatically installed on the Controller hosts by the Enterprise Console, on both Controllers of an HA pair to report to the monitoring Controller. This can be done by updating the JVM options of your HA pair platform. To set up your App Agents using the Enterprise Console, perform the following steps:

  1. SSH into the primary Controller box and update the primary Controller App Agent's controller-info.xml by running the following commands:

    cd <controller-install-dir>/appserver/glassfish/domains/domain1/appagent
    cp conf/controller-info.xml ver<version#>/conf/
  2. Repeat step 1 for the secondary Controller.
  3. In the Enterprise Console UI, select your HA pair platform, and navigate to the JVM Options section by clicking ConfigurationsController Settings, and Appserver Configurations.

  4. Make the following updates to JVM Options:

    1. Update the appdynamics.controller.hostName to the monitoring Controller's IP.

    2.  Add the following required jvm-options for monitoring:

      -Dappdynamics.agent.applicationName=<app_name>, -Dappdynamics.agent.tierName=<tier_name>, 
      -Dappdynamics.agent.nodeName=<node_name>, -Dappdynamics.agent.accountName=<account_name>, 
      -Dappdynamics.agent.accountAccessKey=<access_key>

      You can get your access key from the Controller UI: navigate to Settings, License, and Account. Then click to show your access key. Note, when you log in to the Controller, use the account specified in appdynamics.agent.accountName.

  5. Scroll down the page and click Save. The job will apply these properties and restart both the primary and secondary Controllers.
  6. In the Enterprise Console UI, select your Controller Monitor Platform, and navigate to the Controller page.
  7. Click on External URL on the widget to open the monitoring Controller's UI.
  8. Log in to the Controller. You should be able to see the monitoring application for both the primary and secondary Controllers.

Install and Set Up Machine Agents for Monitoring

You must install Machine Agents on both Controllers of an HA pair to report to the monitoring Controller. These agents are Java programs that collect hardware metrics. To install and set up your machine agents, perform the following steps:

  1. Install the Standalone Machine Agent on the primary Controller box. Do not start the agent.

  2. Repeat step 1 for the secondary Controller.
  3. Configure the Machine Agent properties for both Machine Agents by editing the controller-info-xml file located in the <machine_agent_home>/conf directory.
    1. Update the <controller-host> to the monitoring Controller's IP.
    2.  Model the rest of your controller-info-xml file after the Example Configuration.

  4. Start both Machine Agents.
  5. In the Enterprise Console UI, select your Controller Monitor Platform, and navigate to the Controller page.
  6. Click on External URL on the widget to open the monitoring Controller's UI.
  7. Log in to the Controller. You should be able to see the monitoring application for both the primary and secondary Controllers.

Bouncing the Primary Controller Without Triggering Failover

The Enterprise Console does not allow you to stop and start the primary Controller without initiating failover. Therefore, to work around this, you will need to perform the following steps:

  1. Log in to the Enterprise Console and navigate to the Appserver Configurations page by clicking through Configurations, followed by Controller Settings.
  2. Unselect Enable Auto Failover, and click Save.
  3. SSH to the Controller machine where the Controller is installed.
  4. Run the following commands on the Enterprise Console host:

    platform-admin.sh stop-controller-appserver
    platform-admin.sh start-controller-appserver

    This will bounce the primary Controller in HA mode.

  5. Re-enable auto failover on the Enterprise Console Appserver Configurations page.

Starting and Stopping the Controller

The Enterprise Console does not allow you to shut down the primary Controller. However, you can restart the secondary Controller via the start and stop Controller commands.

To start or stop the Controller manually, use the following commands: 

  • To start: 

    platform-admin.sh start-controller-appserver --with-db
  • To stop: 

    platform-admin.sh stop-controller-appserver --with-db

Automatic Failover

The Enterprise Console monitors the health of the primary Appserver and database. If the Appserver or database is unresponsive, the Enterprise Console will by default wait for five minutes before initiating a failover. This interval can be configured by updating the default value in the Domain Protocol text field on the Appserver Configurations page under Controller settings.

Performing a Manual Failover and Failback

To fail over from the primary to the secondary manually, click the HA Failover option on the Controller page of the Enterprise Console or run the following command on the Enterprise Console host:

platform-admin.sh submit-job --service controller --job ha-failover --platform-name <name_of_the_platform>

This changes the Appserver on the secondary as primary and database on the secondary as the replication master. It also changes the old primary to secondary.

The process for performing a failback to the old primary is the same as failing over to the secondary. Simply run the following command on the Enterprise Console host:

platform-admin.sh submit-job --service controller --job ha-failover --platform-name <name_of_the_platform>

Note that if it has been down for more than seven days, you need to revive the database, as described in the following section.

Initiate Controller Database Incremental Replication

Re-enable Broken Replication

Incremental replication, replication via rsync when the primary database is up, is required in cases where the database replication on the secondary Controller is lagging behind the primary Controller by more than three days. This type of replication allows the primary Controller to keep operating while the disk contents are copied to the secondary node.

To initiate incremental replication:

  1. Run the following command on the Enterprise Console host:

    platform-admin.sh submit-job --service controller --job incremental-replication

    This launches a continuously running background job.

  2. Make sure replication occurs four or more times, by checking mysqlDir/incremental_sync.status on the primary database host.
    Sample rsync status file output:

    rsync started at Mon Mar  5 11:49:56 PST 2018
    rsync completed at Mon Mar  5 11:50:56 PST 2018
    rsync started at Mon Mar  5 11:51:01 PST 2018
    rsync completed at Mon Mar  5 11:51:11 PST 2018

    If replication fails, go to the secondary host and stop all rsync and ha-replicate.sh processes. Then try running the incremental-replication job again.

  3. Finalize the job by running the following command on the Enterprise Console host:

    platform-admin.sh submit-job --service controller --job finalize-replication

    This stops the incremental replication loop. The command will restart the primary Controller, resulting in downtime.

  4. Make sure replication is working by checking that there is no significant gap between the primary and secondary Controllers. You can run the following command on the Enterprise Console host to check the replication status:

    platform-admin.sh show-service-status --platform-name <platform_name> --service controller

    It may take a few minutes for the secondary status to catch up.

Add a Secondary Controller Using Incremental Replication

You can convert a single Controller with a large amount of data to an HA pair by using incremental replication. This way, you can rsync most of the Controller's data while the Controller is still running, limiting the downtime of adding a secondary Controller.

To add a secondary Controller using incremental replication:

  1. Start the incremental replication, giving host and rsync parameters:

    platform-admin.sh submit-job --service controller --job incremental-replication --args controllerSecondaryHost=1.1.1.1 rsyncThrottle=40000 rsyncCompress=true

    This launches a continuously running background job.

  2. Make sure replication occurs four or more times, by checking mysqlDir/incremental_sync.status on the primary database host.
    Sample rsync status file output: 

    rsync started at Mon Mar  5 11:49:56 PST 2018
    rsync completed at Mon Mar  5 11:50:56 PST 2018
    rsync started at Mon Mar  5 11:51:01 PST 2018
    rsync completed at Mon Mar  5 11:51:11 PST 2018

    If replication fails, go to the secondary host and stop all rsync and ha-replicate.sh processes. Then try running the incremental-replication job again.

  3. Run the add secondary job. The Enterprise Console will perform a final rsync and add the secondary.

    platform-admin.sh submit-job --service controller --job add-secondary --args controllerSecondaryHost=secondary mysqlRootPassword=‘password'

    The command will restart the primary Controller, resulting in downtime.

    Until you trigger the add_secondary command, the secondary Controller is not added to the Enterprise Console platform. Therefore, the Enterprise Console will not be able to perform any other operations on the secondary Controller.

If you need to stop replication, you can run the following command:

platform-admin.sh submit-job --service controller --job stop-incremental-replication

Troubleshooting the Incremental Replication Status

If your first incremental replication run is taking longer than usual, you can refer to the status file, incremental_sync.status, to review a detailed list of files that are being rsynced. You can find the file in the primary Controller host under the Platform folder: mysqlDir/incremental_sync.status.

Re-enable Controller Database Replication

The Controller databases can be synchronized using the replicate script if they have been out of sync for more than seven days. Synchronizing a database that is more than seven days behind a master is considered reviving a Controller database. Reviving a database involves essentially the same procedure as adding a new secondary Controller to an existing production Controller, as described in Set Up the Secondary Controller and Initiate ReplicationYou can also follow these steps in the case of an HA failover that failed at replication.

To re-enable replication or revive a Controller database:

  1. On the Controller page, click on Remove Controller, or run the following command on the Enterprise Console host:

    platform-admin.sh submit-job --job remove --service controller
  2. Enter the database root credentials.
  3. Check Remove Binaries, or run the following command on the Enterprise Console host:

    platform-admin.sh submit-job --job remove --service controller --args removeBinaries=true
  4. Uncheck Remove Controller Cluster. If it is already unchecked, remove the secondary server.
  5. Click Submit.
  6. Add a secondary controller from the Controller page, or run the following command on the Enterprise Console host:

    platform-admin.sh submit-job --service controller --job add-secondary --args controllerSecondaryHost=secondary mysqlRootPassword=‘password'

    The command will restart the primary Controller, resulting in downtime.

The Enterprise Console will onboard the secondary Controller and re-enable replication.

Backing Up and Restoring Controller Data in an HA Pair 

An HA deployment makes backing up Controller data relatively straightforward, since the secondary Controller offers a complete set of production data on which you can perform a cold backup without disrupting the primary Controller service. 

After setting up HA, perform a back up by stopping the Controller on the Enterprise Console and performing a file-level copy of the AppDynamics home directory (i.e., a cold backup). When finished, simply restart the Controller from the Enterprise Console. The secondary will then catch up its data to the primary.

When restoring the database from a back up in an HA or standalone environment, you should check that the primary and secondary servers ha.type and ha.mode are set properly to active and passive, respectively.

Updating the Configuration in an HA Pair

The Enterprise Console will copy any file-level configuration customizations made on the primary controller to the secondary controller, such as changes in domain.xml and db.cnf.

Over time, if you need to make modifications to the Controller configuration, always do those changes in the Enterprise Console on the Controller Settings page under Configurations. These changes will be preserved during upgrades. Any changes made outside the Enterprise Console will not be preserved after upgrade. 

Troubleshooting HA

Controller Diagnostic Data

The Enterprise Console writes log messages pertaining to HA to the platform-admin-server.log on the Enterprise Console host.

To diagnose the Controller, run the following command:

bin/platform-admin.sh submit-job --platform-name <name_of_the_platform> --job diagnosis --service controller 

Refer to the Controller diagnostic data in the platform-admin-server.log.

Sample Controller diagnostic data

Linux

 Click here to expand...
Controller diagnostic data:
123.45.0.1:
controller_database: running
controller_appserver: running
reports_service: running
operating_system: Linux
controller_version: 004-004-001-000
controller_performance_profile: small
controller_ha_type: primary
controller_appserver_mode: active
controller_metric_data_per_min: N/A
slave_io_state: Waiting for master to send event
seconds_behind_master: 0
master_server_id: 567.
master_host: controller-secondary
master_ssl_allowed: No

123.45.0.2:
controller_database: running
controller_appserver: not running
reports_service: running
operating_system: Linux
controller_version: 004-004-001-000
controller_performance_profile: small
controller_ha_type: secondary
controller_appserver_mode: passive

Invalid HA Controller Roles

If your HA Controller roles in the Controller databases are incorrect, the Enterprise Console will prevent discover and upgrade jobs. An invalid HA Controller state is when both of your Controller role types are identical, such as in a primary/primary or secondary/secondary case.

To fix this issue:

  1. Identify which server is the primary.
    1. Log in to one of the Controller databases by running the following command in the Controller installation directory:

      ./controller.sh login-db
    2. Run the following command:

      select * from global_configuration_local where name=‘ha.controller.type’;
  2. Ensure that ha.controller.type is set correctly in the database.
    1. Log in to the Controller database you would like to change by running the following command in the Controller installation directory:

      ./controller.sh login-db
    2. Run the following commands to set the database to the primary or secondary:

      Primary

      use controller;
      update global_configuration_local set value=‘primary’ where name=‘ha.controller.type’;
      update global_configuration_local set value=‘active’ where name=‘appserver.mode’;

      Secondary

      use controller:
      update global_configuration_local set value=‘secondary’ where name=‘ha.controller.type’;
      update global_configuration_local set value=‘passive’ where name=‘appserver.mode’;

  3. Restart the database for the change to take effect on the Appserver:

    platform-admin.sh stop-controller-appserver --with-db
    platform-admin.sh start-controller-appserver --with-db

    If the secondary Appserver is already in a shutdown state, then there is no need to restart the database.

  4. Verify the replication is healthy:

    show slave status\G

    Slave_IO_Running and Slave_SQL_Running should show Yes.

You may now retry the discover and upgrade job.

Failover Prevention

If failover is prevented on your Controller HA configuration, it may be due to one of two scenarios:

  • The secondary database is down. Failover cannot occur when the secondary database is not running.
    To fix this issue:
    1. Restart the secondary database by running the following command on the secondary host:

      ./controller.sh start-db
    If this does not enable failover, then it may be due to the second scenario.
  • The database replication is not healthy. Failover is not allowed when the database replication is not healthy.
    There are various reasons why this may be the case. Please work closely with your AppDynamics account representative to correct the issue.
  • No labels