Questo contenuto non è disponibile nella lingua selezionata.
10. Example: Managing JBoss ON Server Configuration
Even in different environments, JBoss ON servers can share a lot of the same configuration. For example, different JBoss ON servers may manage a development environment, staging environment, and production environment, yet on all three, the servers use similar metric templates and configuration settings. To simplify managing separate but similar environments, JBoss ON can export the configuration for a server and then import that configuration into another server.
Any user with permissions to manage settings can export the server configuration.
10.1. Simple Export/Import Synchronization Copia collegamentoCollegamento copiato negli appunti!
Copia collegamentoCollegamento copiato negli appunti!
At its simplest, synchronizing server settings exports all metrics and server configuration settings and then imports that information directly, without any adjustment to the data before its imported or filters on what data to import.
Note
This can be automated by including login information for both JBoss ON servers, and then running the script. This could also be broken into two scripts, one run against server1 and the other against server2. Using a wrapper script would allow you to run the export script, then to run a utility like SCP to copy over the archive, and then to run the import script.
The first part of the script exports the data from server1 and creates a zipped XML archive.
The archive file then needs to be copied over to server2 in some way.
When the archive is copied over, it can then be imported into server2. The null parameter means that the import process uses the default settings in the XML file or, if the defaults are missing from the XML, that it uses the settings defined on the target server.
10.2. Changing Server Configuration Before Importing Copia collegamentoCollegamento copiato negli appunti!
Copia collegamentoCollegamento copiato negli appunti!
Metrics schedules and server configuration are applied through synchronizers. Synchronizers control what elements are imported into the JBoss ON server and how to apply them to the server. The synchronizer has a default template which applies configuration changes to every import operation.
The synchronizer configuration can be changed to change what settings are imported into the target server.
The first part of the script would export the XML archive, as before.
The XML file contains the full configuration information, so just checking that file can give you an idea of what settings to change.
On the second server, change the synchronizer settings.
- Get the default definition.
rhqadmin@localhost:7080$ var systemSettingsImportConfigurationDefinition = SynchronizationManager.getImportConfigurationDefinition('org.rhq.enterprise.server.sync.SystemSettingsSynchronizer')
rhqadmin@localhost:7080$ var systemSettingsImportConfigurationDefinition = SynchronizationManager.getImportConfigurationDefinition('org.rhq.enterprise.server.sync.SystemSettingsSynchronizer')
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Create a new configuration instance.
rhqadmin@localhost:7080$ var configurationObject = systemSettingsImportConfigurationDefinition.configurationDefinition.defaultTemplate.createConfiguration() rhqadmin@localhost:7080$ var systemSettingsImportConfiguration = new ImportConfiguration(systemSettingsImportConfigurationDefinition.synchronizerClassName, configurationObject)
rhqadmin@localhost:7080$ var configurationObject = systemSettingsImportConfigurationDefinition.configurationDefinition.defaultTemplate.createConfiguration() rhqadmin@localhost:7080$ var systemSettingsImportConfiguration = new ImportConfiguration(systemSettingsImportConfigurationDefinition.synchronizerClassName, configurationObject)
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Change the settings.For example, this edits the server synchronizer so that it imports only the database settings for storing monitoring data.
rhqadmin@localhost:7080$ configurationObject.getSimple('propertiesToImport').setValue('CAM_DATA_PURGE_1H, CAM_DATA_PURGE_6H, CAM_DATA_PURGE_1D, CAM_DATA_MAINTENANCE')
rhqadmin@localhost:7080$ configurationObject.getSimple('propertiesToImport').setValue('CAM_DATA_PURGE_1H, CAM_DATA_PURGE_6H, CAM_DATA_PURGE_1D, CAM_DATA_MAINTENANCE')
Copy to Clipboard Copied! Toggle word wrap Toggle overflow For the metrics template synchronizer, define which metric schedules to import per resource type, based on a properties list or a properties map. For example:Copy to Clipboard Copied! Toggle word wrap Toggle overflow
After changing the synchronizer settings, then import the configuration.
rhqadmin@localhost:7080$ var configsToImport = new java.util.ArrayList() rhqadmin@localhost:7080$ configsToImport.add(systemSettingsImportConfiguration); rhqadmin@localhost:7080$ configsToImport.add(metricTemplatesImportConfiguration); rhqadmin@localhost:7080$ SynchronizationManager.importAllSubsystems(ex, configToImport);
rhqadmin@localhost:7080$ var configsToImport = new java.util.ArrayList()
rhqadmin@localhost:7080$ configsToImport.add(systemSettingsImportConfiguration);
rhqadmin@localhost:7080$ configsToImport.add(metricTemplatesImportConfiguration);
rhqadmin@localhost:7080$ SynchronizationManager.importAllSubsystems(ex, configToImport);