Skip to main content
Announcements
UPGRADE ADVISORY for Qlik Replicate 2024.5: Read More
cancel
Showing results for 
Search instead for 
Did you mean: 
qlik_admin_lm
Contributor III
Contributor III

Changing Server Settings in QlikReplicate via script

Trying to understand how you would change a QlikReplicate server setting through script.  It seems like you would need to run a "repctl exportrepository", modify the json that is produced and then run a "repctl importrepository".  Can someone verify if is the way to do this?  Are there other options to modify server settings from a scripting perspective?

Labels (1)
1 Solution

Accepted Solutions
SwathiPulagam
Support
Support

Hi @qlik_admin_lm ,

 

You are correct.  You have to run a "repctl exportrepository", modify the json that is produced and then run a "repctl importrepository".

 

Thanks,

Swathi

View solution in original post

6 Replies
SwathiPulagam
Support
Support

Hi @qlik_admin_lm ,

 

You are correct.  You have to run a "repctl exportrepository", modify the json that is produced and then run a "repctl importrepository".

 

Thanks,

Swathi

qlik_admin_lm
Contributor III
Contributor III
Author

Question: Can we export all the tasks in separate JSON files using the repctl export command? What is the option?

Dana_Baldwin
Support
Support

Hi @qlik_admin_lm 

You can specify the task you want to export using "task=":

repctl exportrepository task=MyTaskName

You will need to run the command once per task.

For your information, if you use  Windows and your data directory is not in the default location, you need to use a -d with the full path to the data directory location:

repctl -d "YOUR_DATA_DIRECTORY_PATH" exportrepository

Hope this helps,

Dana

Heinvandenheuvel
Specialist III
Specialist III

Just some clarifications

- you mention "Changing Server Settings" but then you ask about tasks. Which is it? If it is indeed about the server then you can export 1 task, any task and use the repctl option include_server_settings &  task (check out: repctl -d \Replicate\data exportrepository ? ) or you omit the task= option exporting all which always has server settings.  Next I would recommend parsing the JSON and removing the 'tasks' and 'databases' sections, just leaving the various server settings. Modify what you need and import just the server settings and not replacing all tasks and databases.

- "export all the tasks in separate JSON files" - not directly. You'll need to either requests a a gettasklist first, and then request exportrepository task= for each of them, or you must parse the overall export. when parsing the overall export, you may want to decide whether to separate in just the bare-bones tasks and separate barebones end-points or tasks with their endpoints. Extracting tasks with their endpoint is handy, but if an endpoint is in use by multiple tasks and that endpoint needs changed then you risk importing a tasks with a stale endpoint definition at some point in time. In that sense a full export with all tasks and endpoint and serversettings is safer.  Parsing the complete export is not too hard to script either just simply looking for strings or properly decoding the json using tools provided by languages like java/perl/powershell/python

-  Are there other options to modify server settings from a scripting perspective?  Yes. The officially recommended method it to use the Enterprise Manager API. Using that, no files are needed, it can all be fetched, modified, and pushed back out from memory structures.

Hein.

 

qlik_admin_lm
Contributor III
Contributor III
Author

@SwathiPulagam  Hi Swathi,

I am doing a test by exporting the JSON "Replication_Definition.json" from another server, trying to import in an empty server. When trying to do "repctl importrepository" getting an error that it can not recognize the file. 

Error message:

D:\Program Files\Attunity\Replicate\bin>repctl importrepository
[importrepository command] Failed
Cannot open json file 'D:\Program Files\Attunity\Replicate\data\imports\' (exit status 720003)

But Import of the same JSON from the GUI works fine.

 

Regards,

Sandip.

 

Heinvandenheuvel
Specialist III
Specialist III

>>  Cannot open json file 'D:\Program Files\Attunity\Replicate\data\imports\' (exit status 720003)

You have to use:  repctl importrepository json_file=<full-path-to-repository.json>

Hein