How to perform migration to fix "ID out of allocated range" issue or unable to add managed server into admin server due to "server id does not match" error in Applications Manager

How to perform migration to fix "ID out of allocated range" issue or unable to add managed server into admin server due to "server id does not match" error in Applications Manager

If the id value used internally for the monitors crosses the server id value specified in Settings -> Support -> Installation Information -> Server Id  - Managed server, then you will get the following alert in Admin server:

For existing Managed servers
 
ID range for AM_ManagedObject table is out of allocated range,thereby EE Sync has been disabled for this Managed Server in Admin Server. Please contact our support team with the logs/SIF to resolve this issue.
While adding new Managed server
The server Id does not match with the resource Id of the managed server.Kindly contact for details.

Initial troubleshooting:
  1. Share the output of these queries from the Managed servers having issue and following query output from all Managed server in the Admin server.
    1. Select min(RESOURCEID),max(RESOURCEID) from AM_ManagedObject;
  2. Once you get the response from us for the above query outputs, implement the necessary prerequisites and proceed with the steps.
Supported from Applications Manager version : 16510

Prerequisites:
  1. Take the database backup of both Admin and Managed servers that have the issue using the steps specified in this link.
  2. Schedule a maximum downtime of 4 to 5 hours for the Managed server that has the issue and the Admin server.
  3. If fail-over setup has been configured, shutdown Applications Manager fail-over setup service also.
  4. Shutdown Applications manager service for Managed server first and then Admin server service before running the migration script.

    For windows:
  5. Open Command prompt with administrator permission.
  6. Navigate to <ApplicationsManager_Home> folder.
  7. Run the command: shutdownApplicationsManager.bat -force.

    For Linux:
  8. Open Command prompt with administrator permission.
  9. Navigate to <ApplicationsManager_Home> folder.
  10. Run the command: sh shutdownApplicationsManager.sh -force

Steps to be performed in the Managed server to Migrate to a new server id:
  1. Check the maximum managed server id that exists in the Admin Server from the Admin Server web client as shown below:
  2. Go to Applications Manager Managed server installed machine.
  3. Open command prompt with Administrator privileges and navigate to <ApplicationsManager_Home>/working/bin folder.
  4. Run the migration script with new server id as the param. New server id should be the one value incremented from maximum server id found in step 1.
    For Windows: migrateId.bat <new server id>
    For Linux: sh migrateId.sh <new server id>
  5.  Once the script executes successfully, open AMServer.properties file in <ApplicationsManager_Home>/conf  folder and update the following key value:
    am.server.startresidrange = <old server id>+10000000
    to
    am.server.startresidrange =<new server id>+10000000
            Example: 
            Consider: old server id = 2, new server id = 4 
            Then, you will need to update the AMServer.properties file as shown below:
            am.server.startresidrange = 20000000
              to 
            am.server.startresidrange = 40000000
      6. Start the Applications Manager's Managed server service.
      7. You will now need to copy the Migration id mapping the data from Managed server to the Admin server.
      8. Run the following query from the Managed server to copy the data into a CSV file.
      PGSQL:  Connect to database using command prompt [refer this link] and run the query
      copy NEW_SERVERID_MAPPING to '<ApplicationsManager_Home>/filename.csv' with delimiter ','
      MSSQL: Connect through SQL Management studio and run the query
      Select * from NEW_SERVERID_MAPPING.  - Save the output as the csv file.

Steps to be performed in the Admin server to migrate managed server data to new server id:
  1. Go to Applications Manager Admin server installed machine.
  2. Copy the CSV file generated in Managed server to the Admin server installed directory.
  3. Run the following query in the Admin server database to copy data from the CSV file to the database.
    PGSQL:  Connect to database using command prompt [refer link] and run the queries
      1. ALTER TABLE NEW_SERVERID_MAPPING ADD COLUMN MigrationID BIGINT;
      2. Copy NEW_SERVERID_MAPPING from '<ApplicationsManager_Home>/filename.csv' with delimiter ',';
            MSSQL: Connect throught SQL Management studio and run the queries
      1. ALTER TABLE NEW_SERVERID_MAPPING ADD COLUMN MigrationID BIGINT;
      2. Bulk Insert NEW_SERVERID_MAPPING from '<ApplicationsManager_Home>/filename.csv' with (FieldTerminator=",",Rowterminator="\n");
NOTE: If Applications Manager and MSSQL database server are in different machines, then copy the CSV file to MS SQL server machine and give that absolute path in above query to execute.
      4. Open command prompt with Administrator privileges and navigate to <ApplicationsManager_Home>/working/bin folder.
      5. Run the migration script with managed server's old id and new id as param as shown below:
          For Windows: migrateId.bat  <Managed server old server id> <Managed server new server id>
          For Linux: sh migrateId.sh <Managed server old server id> <Managed server new server id>

          ExampleConsider: old server id = 2, new server id = 4
           Then you will need to run the script as shown below:
           For Windows: migrateId.bat  2 4
           For Linux: sh migrateId.sh 2 4
     6. Once migration script has executed, Start the Applications Manager Admin server service. 

In case of any failure during migration or if the product is not getting started after migration, generate and share the Support Information file with us to check the logs. 

                  New to ADManager Plus?

                    New to ADSelfService Plus?