mps-cache
在 Windows、Linux 和 macOS 系统上通过命令行控制持久性服务
语法
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]
描述
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]operation
控制持久性服务。支持的操作是 start
、stop
、restart
、ping
、attach
和 detach
。
选项 connection_name
是从 JSON 文件 mps_cache_config
中获取的。该文件必须由管理员创建并放置在服务器实例的 config
文件夹中。mps_cache_config
文件的 JSON 结构体为:
{ "Connections": { "<connection_name>": { "Provider": "Redis", "Host": "<hostname>", "Port": <port_number> } } }
<connection_name>
、<host_name>
和 <port_number>
是唯一可由管理员设置的字段,并且 <port_number>
必须是非 SSL 端口。目前,Redis™ 是唯一受支持的持久性服务提供程序。您可以与持久性提供程序建立多个连接。输入参量
|
注意 您无法启动、停止或重新启动远程持久性服务。 |
| 服务器实例的路径。 |
| 与持久性服务的连接的名称。指定 |
| 连接到 |
| 持久性提供程序配置文件的路径。 |
| 用于连接从 Azure® 门户获取的 Azure RedisCache 实例的访问密钥字符串。有关示例,请参阅Ping 远程持久性服务。 |
| 设置 |
| 显示与控制持久性服务相关的系统消息。 |
| 显示使用 |
示例
启动持久服务
假设在文件 mps_cache_config
中已定义了连接名称 myConnection
,则在 Windows® 上启动持久性服务。
在系统命令行中输入以下内容:
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.
该示例对应的 mps_cache_config
文件如下:
{ "Connections": { "myRedisConnection": { "Provider": "Redis", "Host": "localhost", "Port": 9710 } } }
Ping 远程持久性服务
假设已在 Azure 门户中设置了 Azure Redis 缓存实例,并且已在文件 mps_cache_config
中定义了连接名称 myRemoteAzureRedisCacheConnection
。
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.
该示例对应的 mps_cache_config
文件如下:
{ "Connections": { "myRedisConnection": { "Provider": "Redis", "Host": "localhost", "Port": 9710 }, "myRemoteAzureRedisCacheConnection": { "Provider": "Redis", "Host": "azure.redis.cache.windows.net", "Port": 6379 } } }
提示
要检索访问密钥以连接到 Azure Redis Cache 实例:
登录您的 Azure 门户并选择您的 Azure Redis 缓存实例。
选择 Overview,然后在 Keys 下点击 Show access keys。
在出现的页面中,复制 Primary 下列出的访问密钥字符串。
版本历史记录
在 R2018b 中推出