What is the easiest method to take all values from a persistent-TCP datasource and feed them back into a Modbus I/P data source containing the same point xid's?
MattFox last edited by
The best I've got was writing a dashboard screen to extract all values from one point, in iterations if needed. replacing the old XID with the destination point XID and convert the data to csv and downloading the generated file to my computer. once I'd finished generating all of them, I used the data import option on the old UI to update all of the points. Sorry that's the best I managed to do with what I had. I half would have thought the points would update if the XIDs are the same but not sure Mango would allow it (I believe it treats it like a unique key).
Lots of ways!
- Have the H2 database available as well, change the XID to remove the publisher's prefix from the points on the persistent data source (if any). Use the "Migrate NoSQL Data into Mango" tab on /mango_no_sql.shtm to copy all data over based on matching XIDs between the SQL databases.
- Figure out the ID of the point you wish to copy the data to, and the ID of the point you wish to copy the data from. Copy the files directly from Source Mango/databases/mangoTSDB/x/ID/* to Target Mango/database/mangoTSDB/x/ID/ so you need to find the existing ID folders in each. Then restart Mango.
- Create a new publisher from the side with all the data, and sync the data into new points on the target. Then, delete all the new points and change the IDs of the Modbus points to match, and restart Mango.
- Do what Fox described and upload the data to the data import module.
Phil please elaborate on 3 further.. Assuming I use only the target installation with the persistent TCP data source which contains all the data... If I then delete this TCP data source, will the NoSQL data be unaffected? And can I then create a new Modbus data source on the same installation using the same xid's and this new Modbus data source will find these former persistent TCP values in the NoSQL on restart??
If I then delete this TCP data source, will the NoSQL data be unaffected?
Orphaned point values are deleted during the nightly purge.
And can I then create a new Modbus data source on the same installation using the same xid's and this new Modbus data source will find these former persistent TCP values in the NoSQL on restart??
You could do something close to that. But, upon creating the Modbus data source you would need to change the IDs of the points to the IDs those XIDs had when it was a persistent data source. So before deleting that data source, you could,
select id, xid from dataPoints where dataSourceId=(select id from dataSources where xid='Persistent Data Source XID');
paste the output into a text editor, and do some regex find and replace to
find: .*?(\d+)\t+(.*) replace: UPDATE dataPoints SET id=\1 WHERE xid='\2';
and there's the update statements for after the Modbus data source has been created. After running the statements, I would restart Mango (or at least the data source).
So do I run this and each time replace the 'Persistent Data Source XID' with the literal value for all xids in this ds? there are 2700 points in this data source so I could never do this step for 2700.
No... just the XID for the data source.