SAS Viya provides import and export functionality for user-created content like reports and data plans. Often, in addition to content, an administrator will want to save configuration so that it can be reloaded or updated and applied to a different system. SAS Viya provides the capability to save and reload configuration using the SAS Viya command-line interfaces that are previous blog post.
It is possible to save a set of configuration settings and reload them to the same or a different system. This can be useful when you have your configuration established and you wish to keep a backup, or make a selective backup of configuration prior to making a change.
The connection to LDAP is a key early step in a SAS Viya implementation. With the configuration CLI, once you have the SAS Viya LDAP configuration established, you can export it to a file, and then use that file (with any necessary modifications) to stage additional systems, or as a backup prior to making changes to your existing systems configuration.
How to save and reload configuration
./sas-admin configuration configurations list --definition-name sas.identities.providers.ldap.user --service identities
Next, using the id from the previous step you can list the configuration properties.
./sas-admin configuration configurations show -id b313a5a7-1c73-4f4a-9d3d-bba05b626939
Save LDAP Configuration
The save process creates json files. The following steps use the download command to save to json files the connection, user and group configuration instances for the SAS Viya connection to LDAP.
./sas-admin configuration configurations download --target /tmp/ldapconnection.json --definition-name sas.identities.providers.ldap.connection --service identities ./sas-admin configuration configurations download --target /tmp/user.json --definition-name sas.identities.providers.ldap.user --service identities ./sas-admin configuration configurations download --target /tmp/group.json --definition-name sas.identities.providers.ldap.group --service identities
You should open the json files and check that the correct configuration has been saved. It is possible for the process to complete without errors and return json that is not what you are expecting. This would cause problems with your reload, so checking the saved json is important.
You can keep the JSON file as is, or make changes to key attributes. You may want to do this if you are importing to a different system.
Load the SAS Viya LDAP Configuration
To load you simply use the update command and pass the json file.
./sas-admin configuration configurations update --file /tmp/ldapconnection.json ./sas-admin configuration configurations update --file /tmp/user.json ./sas-admin configuration configurations update --file /tmp/group.json
The impact of isDefault
There is a value, isDefault, stored within the configuration which has an impact on the persistence of changes made to configuration.
isDefault impacts how services treat existing configuration when a service starts. When a service starts a setting of:
- isDefault=true in the existing configuration means the service will overwrite the configuration object with new defaults.
- isDefault=false in the existing configuration means the service will NOT overwrite the existing configuration object.
In other words, if the configuration is flagged as “default” then the service is permitted to update or add to the default values.
Objects created by the services at startup always have isDefault set to true. Objects created in Environment Manager always have isDefault set to false. This means changes in Environment Manager are always respected by services on restart, they will not be overwritten. But services are allowed to overwrite their own defaults at startup.
When using the CLI, the administrator needs to decide what is the appropriate value for isDefault. If you require the configuration change to persist across service restarts then set isDefault=false.
Saving and Reloading Micro-Service Logging Levels
Let’s look at another use case for save and reload of configuration. Updating micro-service logging configuration levels in batch can be very useful. You may want to save your current logging configuration and modify it to raise logging levels. You may create multiple json files with different logging configurations for different scenarios. When debugging an issue in the environment you could load a verbose logging configuration. If you wish to keep the new configuration you would edit the json and set IsDefault=false.
The step below saves all configuration instances created from the logging.level configuration definition. These configuration instances control the logging level for the SAS Viya microservices and servers.
./sas-admin configuration configurations download --definition-name logging.level -target /tmp/default_logging.level.txt
If you wish to persist your new logging configuration, edit the file to set metadata.isDefault=false, save the new file and then and update the logging configuration using the update command:
./sas-admin configuration configurations update --file /tmp/new_logging.level.txt
When you are done, you can use the original file to reset the logging level back to default values.
In most cases a server restart is not required after a configuration update, find details in the administration guide.