QUESTION:
How do I move devices from one DGE to another DGE?
SOLUTION:
Requirements
- Target DGE should not contain any existing devices (unless you do not wish to retain historical data for the moved devices)
- Source DGE and target DGE are running similar OS type (e.g. Windows vs Linux)
- During the actual move, source DGE and target DGE components will need to be offline
- BVE needs the 'Provisioning Database' and 'BVE API' components running
- If dependencies need to be retained, exportAndDeleteDependency.pl and importAndCrateDependency.pl to be placed under \plugin\utils on the BVE (Download the attachment migrations-tools.zip at the end of this article)
Before migrating, we suggest you review the steps below and have attempted on a test environment if possible. In order to move devices from an existing source DGE to the target DGE, you may use individual device names or you may use wildcards on the device name. It is strongly recommended that you create a backup of the provisioning database on the BVE and (at least) the "database" directory on the source/target DGEs in case you need to rollback the changes.
Device list preparation
Should you need to move devices by individual device names, you can start by creating a list of devices that to be migrated. If you do not have a list of devices handy, you may create one by following these steps:
- On BVE (make sure the BVE API component is running)
- Create an empty file named devicelist.txt file and add the following line: device.list "devicename=*"
- From command line: utils\bveCLI.pl --host localhost --username=superuser --password=SUPERUSERPASSWORD --input=devicelist.txt 'devicename=*'" --format=csv --fields=devicename,dgename --output devicelist.csv
"SUPERUSERPASSWORD" will of course need to be changed to the correct password associated with the superuser account. This command will output all devices provisioned in Traverse, redirected into devicelist.csv. You should be able to open this file with an Excel spreadsheet and sort by the dgename column and delete the unwanted devices (rows) so you are left with only the desired devices from the desired DGE.
Migration Steps (commands are run from <TRAVERSE_HOME> on BVE)
- Backup your BVE and source DGE databases: On BVE and source DGE run: utils\db_backup.cmd (Windows) or utils/db_backup.sh (Linux)
- Stop all Traverse components on source DGE and target DGE
- Please make sure only the following components are running on the BVE: "Provisioning Database" and "BVE API"
- To retain historical data, copy source DGE database to target DGE (retaining history requires that there be no provisioned devices on target DGE)
- Copy database\mysql\aggregateddatadb directory from source DGE to target DGE (same path)
- Export device dependencies: (This entire step can be skipped if there are no device dependencies or you do not wish to retain device dependencies)
Note: device parameter can be a wildcard of the devicename (only '*' is supported) otherwise each device can be defined individually
From <TRAVERSE_HOME>, where --user is the department level user and --pass is the corresponding password and --device is the device name or a valid device name wildcard string:
(Windows)
Wildcard examples:
plugin\utils\exportAndDeleteDependency.pl --user DEPARTMENTLEVELUSER --pass PA$$W0RD --device "ABACABA*" >> c:\temp\list1.csv
plugin\utils\exportAndDeleteDependency.pl --user DEPARTMENTLEVELUSER --pass PA$$W0RD --device "CDCABA*" >> c:\temp\list1.csv
plugin\utils\exportAndDeleteDependency.pl --user DEPARTMENTLEVELUSER --pass PA$$W0RD --device "CA*" >> c:\temp\list1.csv
Individual device examples:
plugin\utils\exportAndDeleteDependency.pl --user DEPARTMENTLEVELUSER --pass PA$$W0RD --device "DEVICE1" >> c:\temp\list1.csv
plugin\utils\exportAndDeleteDependency.pl --user DEPARTMENTLEVELUSER --pass PA$$W0RD --device "DEVICE2" >> c:\temp\list1.csv
plugin\utils\exportAndDeleteDependency.pl --user DEPARTMENTLEVELUSER --pass PA$$W0RD --device "DEVICE3" >> c:\temp\list1.csv
(Linux)
Wildcard examples:
plugin/utils/exportAndDeleteDependency.pl --user DEPARTMENTLEVELUSER --pass PA$$W0RD --device "ABACABA*" >> /root/temp/list1.csv
plugin/utils/exportAndDeleteDependency.pl --user DEPARTMENTLEVELUSER --pass PA$$W0RD --device "CDCABA*" >> /root/temp/list1.csv
plugin/utils/exportAndDeleteDependency.pl --user DEPARTMENTLEVELUSER --pass PA$$W0RD --device "CA*" >> /root/temp/list1.csv
Individual device examples:
plugin/utils/exportAndDeleteDependency.pl --user DEPARTMENTLEVELUSER --pass PA$$W0RD --device "DEVICE1" >> c:\temp\list1.csv
plugin/utils/exportAndDeleteDependency.pl --user DEPARTMENTLEVELUSER --pass PA$$W0RD --device "DEVICE2" >> c:\temp\list1.csv
plugin/utils/exportAndDeleteDependency.pl --user DEPARTMENTLEVELUSER --pass PA$$W0RD --device "DEVICE3" >> c:\temp\list1.csv
- Move the devices from source DGE to target DGE
(Windows)
Wildcard examples:
apps\jre\bin\java -Xmx1024m -noverify -Dnetvigil.config="%CD%\etc\emerald.properties" -Dlog4j.configuration="file:///%CD%\etc\log4j.conf" -Djava.ext.dirs=webapp\WEB-INF\lib com.zyrion.traverse.utils.MoveDevices "%CD%\etc\emerald.xml" "sourceDGENAME" "targetDGENAME" "ABACABA*"
apps\jre\bin\java -Xmx1024m -noverify -Dnetvigil.config="%CD%\etc\emerald.properties" -Dlog4j.configuration="file:///%CD%\etc\log4j.conf" -Djava.ext.dirs=webapp\WEB-INF\lib com.zyrion.traverse.utils.MoveDevices "%CD%\etc\emerald.xml" "sourceDGENAME" "targetDGENAME" "CDCABA*"
apps\jre\bin\java -Xmx1024m -noverify -Dnetvigil.config="%CD%\etc\emerald.properties" -Dlog4j.configuration="file:///%CD%\etc\log4j.conf" -Djava.ext.dirs=webapp\WEB-INF\lib com.zyrion.traverse.utils.MoveDevices "%CD%\etc\emerald.xml" "sourceDGENAME" "targetDGENAME" "CA*"
Individual device examples:
apps\jre\bin\java -Xmx1024m -noverify -Dnetvigil.config="%CD%\etc\emerald.properties" -Dlog4j.configuration="file:///%CD%\etc\log4j.conf" -Djava.ext.dirs=webapp\WEB-INF\lib com.zyrion.traverse.utils.MoveDevices "%CD%\etc\emerald.xml" "sourceDGENAME" "targetDGENAME" "DEVICE1"
apps\jre\bin\java -Xmx1024m -noverify -Dnetvigil.config="%CD%\etc\emerald.properties" -Dlog4j.configuration="file:///%CD%\etc\log4j.conf" -Djava.ext.dirs=webapp\WEB-INF\lib com.zyrion.traverse.utils.MoveDevices "%CD%\etc\emerald.xml" "sourceDGENAME" "targetDGENAME" "DEVICE2"
apps\jre\bin\java -Xmx1024m -noverify -Dnetvigil.config="%CD%\etc\emerald.properties" -Dlog4j.configuration="file:///%CD%\etc\log4j.conf" -Djava.ext.dirs=webapp\WEB-INF\lib com.zyrion.traverse.utils.MoveDevices "%CD%\etc\emerald.xml" "sourceDGENAME" "targetDGENAME" "DEVICE3"
(Linux) Wildcard examples:
database/schema/alter/moveDevices.sh 'sourceDGENAME' 'targetDGENAME' 'ABACABA*' database/schema/alter/moveDevices.sh 'sourceDGENAME' 'targetDGENAME' 'CDCABA*' database/schema/alter/moveDevices.sh 'sourceDGENAME' 'targetDGENAME' 'CA*'
Individual device examples:
database/schema/alter/moveDevices.sh 'sourceDGENAME' 'targetDGENAME' 'DEVICE1' database/schema/alter/moveDevices.sh 'sourceDGENAME' 'targetDGENAME' 'DEVICE2' database/schema/alter/moveDevices.sh 'sourceDGENAME' 'targetDGENAME' 'DEVICE3'
- Import device dependencies: (This entire step can be skipped if there are no device dependencies or you do not wish to retain device dependencies)
From <TRAVERSE_HOME>, where --user is the department level user and --pass is the corresponding password and --file is the list of device dependencies generated in the step above:
(Windows)
plugin\utils\importAndCreateDependency.pl --user DEPARTMENTLEVELUSER --pass PA$$W0RD --file c:\temp\list1.csv
(Linux)
plugin/utils/importAndCreateDependency.pl --user DEPARTMENTLEVELUSER --pass PA$$W0RD --file /root/temp/list1.csv
- Optimize db on source DGE and target DGE
Start the 'performance and event database' component on both the source DGE and target DGE
(Windows)
utils\db_optimize.pl --optimize --run
(Linux)
utils/db_optimize.pl --optimize --run
Once complete, start all Traverse services. When the source DGE connects to the BVE, it will delete data for the devices that have been moved out of it from its database, and the target DGE will start to collect new data for those devices/tests that have been moved. During this cleanup phase you may see some extra disk I/O and writer queue backlog, but that should settle down after a while.
RELATED ARTICLES: