Main Content

mps-cache

Control persistence service from command line on Windows, Linux, and macOS systems

Syntax

mps-cache [operation] [-C server_path] [--connection connection_name] [--all] [--configFile provider_config_file_path] [--key cache_access_key_string] [--timeout seconds] [--verbose | -v] [--help |-h]

Description

mps-cache [operation] [-C server_path] [--connection connection_name] [--all] [--configFile provider_config_file_path] [--key cache_access_key_string] [--timeout seconds] [--verbose | -v] [--help |-h] controls the persistence service based on the specified operation. The supported operations are start, stop, restart, ping, attach, and detach.

The option connection_name is obtained from the JSON file mps_cache_config. This file must be created by an administrator and placed in the config folder of the server instance. The JSON structure of the mps_cache_config file is:

{
  "Connections": {
    "<connection_name>": {
      "Provider": "Redis",
      "Host": "<hostname>",
      "Port": <port_number>
    }
  }
}
<connection_name>, <host_name> and <port_number> are the only fields that can be set by the administrator and <port_number> has to be a non-SSL port. Currently, Redis™ is the only supported persistence service provider. You can have multiple connections to the persistence provider.

Input Arguments

operation

start | stop | restart | ping | attach | detach

  • start — Start a persistence service.

  • stop — Stop a persistence service.

  • restart — Restart a persistence service.

  • ping — Test whether the persistence service is reachable.

  • attach — Connect persistence service to server instance process.

  • detach — Disconnect persistence service from server instance process.

Note

You cannot start, stop, or restart a remote persistence service.

-C server_path

Path to the server instance.

--connection connection_name

Name of connection to persistence service. Specify either --all or --connection connection_name, not both.

--all

Connect to all the persistence services specified in mps_cache_config file. Specify either --all or --connection connection_name, not both.

--configFile provider_config_file_path

Path to the persistence provider configuration file.

--key cache_access_key_string

Access key string to connect to an Azure® Redis Cache instance obtained from the Azure portal. For an example, see Ping Remote Persistence Service.

--timeout ss

Set a limit on how long mps-cache will run before returning either success or failure. The default duration is 30 seconds. For example, specifying --timeout 15 indicates that mps-cache should exit with an error status if it takes longer than 15 seconds to access the service.

--verbose | -v

Displays system messages relating to controlling the persistence service.

--help | -h

Displays options for using the mps-cache command.

Examples

Start Persistence Service

Start a persistence service on Windows® assuming a connection name myConnection has been defined in the file mps_cache_config.

Type the following at the system command line:

mps-cache start -C "h:\server\mps_instance" --connection myRedisConnection
mps-cache ping -C "h:\server\mps_instance" --connection myRedisConnection
Sending ping to Redis on localhost:9710.
Redis service running on localhost:9710.

The corresponding mps_cache_config file for the example follows:

{
  "Connections": {
    "myRedisConnection": {
      "Provider": "Redis",
      "Host": "localhost",
      "Port": 9710
    }
  }
}

Ping Remote Persistence Service

Assuming an Azure Redis Cache instance has been setup in the Azure portal and a connection name myRemoteAzureRedisCacheConnection has been defined in the file mps_cache_config.

mps-cache ping -C "h:\server\mps_instance" 
               --connection myRemoteAzureRedisCacheConnection 
               --key +WcI8pU0YodDMsw1LLC7gInkjtrjamLBRoq9rQQdMTU=
Sending ping to Redis on azure.redis.cache.windows.net:6379.
Redis service running on azure.redis.cache.windows.net:6379.

The corresponding mps_cache_config file for the example follows:

{
  "Connections": {
    "myRedisConnection": {
      "Provider": "Redis",
      "Host": "localhost",
      "Port": 9710
    },
    "myRemoteAzureRedisCacheConnection": {
      "Provider": "Redis",
      "Host": "azure.redis.cache.windows.net",
      "Port": 6379
    }
  }
}

Tips

  • To retrieve an access key to connect to an Azure Redis Cache instance:

    • Log in to your Azure portal and select your Azure Redis Cache instance.

    • Select Overview and under Keys click Show access keys.

    • In the resulting blade, copy the access key string listed under Primary.

    Overview of Azure Redis Cache resource in the Azure Portal. Access keys are displayed on the right.

Version History

Introduced in R2018b

See Also