[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["難以理解","hardToUnderstand","thumb-down"],["資訊或程式碼範例有誤","incorrectInformationOrSampleCode","thumb-down"],["缺少我需要的資訊/範例","missingTheInformationSamplesINeed","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-09-05 (世界標準時間)。"],[],[],null,["# Configure an instance\n\nMemorystore for Valkey supports a subset of the [OSS Valkey configuration\nparameters](https://github.com/valkey-io/valkey/blob/7.2/valkey.conf) that you can modify to customize the\nbehavior of your instance.\n\nConfiguration changes don't require a restart of the nodes, and are saved if a\nnode restarts. After creating an instance, you can update the modifiable\nconfiguration parameters.\n\nFor more information about the modifiable configuration parameters, see\n[Supported instance configurations](/memorystore/docs/valkey/supported-instance-configurations).\n\nBefore you begin\n----------------\n\nEnsure that you have installed the latest version of the Google Cloud CLI\nby running `gcloud components update`.\n\nView configuration parameters\n-----------------------------\n\nTo view configuration parameters using the Google Cloud CLI, run the\n`gcloud memorystore instances describe` command, replacing \u003cvar translate=\"no\"\u003evariables\u003c/var\u003e with\nappropriate values.\n\nYou can't see configuration parameters when running the\n`gcloud memorystore instances describe` command unless you change a configuration\nparameter from its default value. \n\n```\ngcloud memorystore instances describe instance-id --location=region-id\n```\n\nExample: \n\n```\ngcloud memorystore instances describe my-instance --location=us-central1\n```\n\nSet a configuration parameter during instance creation\n------------------------------------------------------\n\nTo set a configuration parameter while creating an instance, run the\n`gcloud memorystore instances create` command with `--engine-configs` flag, replacing\n\u003cvar translate=\"no\"\u003evariables\u003c/var\u003e with appropriate values. \n\n```\ngcloud memorystore instances create instance-id \\\n--location=region-id \\\n--project=project-id \\\n--node-type=node-type \\\n--shard-count=shard-count \\\n--mode=MODE\n--engine-configs=config-name=config-value \\\n```\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003einstance-id\u003c/var\u003e is the ID of the Memorystore for Valkey instance you're creating.\n- \u003cvar translate=\"no\"\u003eregion-id\u003c/var\u003e is the region where you want the instance placed.\n- \u003cvar translate=\"no\"\u003eproject-id\u003c/var\u003e is your project ID.\n- \u003cvar translate=\"no\"\u003enode-type\u003c/var\u003e is your chosen node type. Accepted values are:\n\n - `shared-core-nano`\n - `standard-small`\n - `highmem-medium`\n - `highmem-xlarge`\n\n | **Caution** : We recommend that you use the `shared-core-nano` node type for development or testing purposes only. If you run Memorystore for Valkey in a production environment, then we recommend using the `standard-small`, `highmem-medium`, or `highmem-xlarge` node types. For more information about these node types, see [Choose a node type](/memorystore/docs/valkey/instance-node-specification#choose-node-type).\n- \u003cvar translate=\"no\"\u003eshard-count\u003c/var\u003e determines the number of shards in your instance. Shard count determines the total memory capacity for storing instance data. If the mode that you select is Cluster Mode Disabled, then you can specify only one shard for your instance. For more information, see [Instance and node specification](/memorystore/docs/valkey/instance-node-specification).\n\n- \u003cvar translate=\"no\"\u003emode\u003c/var\u003e determines if the instance is Cluster Mode Enabled or Cluster Mode Disabled. If this field is omitted,\n then the instance defaults to Cluster Mode Enabled. For more information, see [Enable and disable Cluster Mode](/memorystore/docs/valkey/cluster-mode-enabled-and-disabled).\n\n- \u003cvar translate=\"no\"\u003econfig-name\u003c/var\u003e is the configuration parameter to modify.\n\n- \u003cvar translate=\"no\"\u003econfig-value\u003c/var\u003e is your chosen setting corresponding to the parameter you're configuring.\n\nFor example: \n\n### Cluster Mode Enabled example\n\n\u003cbr /\u003e\n\n```\n gcloud memorystore instances create foo --location=us-east1 --project=test-proj --node-type=highmem-medium --shard-count=3 --engine-configs=maxmemory-policy=allkeys-lru\n \n```\n\n\u003cbr /\u003e\n\n### Cluster Mode Disabled example\n\n\u003cbr /\u003e\n\n```\n gcloud memorystore instances create foo --location=us-east1 --project=test-proj --node-type=highmem-medium --shard-count=1 --mode=cluster-disabled --engine-configs=maxmemory-policy=allkeys-lru\n \n```\n\n\u003cbr /\u003e\n\nUpdate a configuration parameter\n--------------------------------\n\nTo update a configuration parameter for an existing instance, run the\n`gcloud memorystore instances update` command with the `--update-engine-configs` flag,\nreplacing \u003cvar translate=\"no\"\u003evariables\u003c/var\u003e with appropriate values. \n\n```\ngcloud memorystore instances update instance-id \\\n--location=region-id \\\n--project=project-id \\\n--update-engine-configs=config-name=config-value\n```\n\nExample: \n\n```\ngcloud memorystore instances update foo --location=us-east1 --project=test-proj --update-engine-configs=maxmemory-policy=allkeys-lru\n```\n| **Note** : For more information about which configuration parameters you can update, see [Modifiable configuration\n| parameters](/memorystore/docs/valkey/supported-instance-configurations#modifiable_configuration_parameters).\n\nReset a configuration parameter\n-------------------------------\n\nTo reset a configuration parameter to its default value, run the\n`gcloud memorystore instances update` command with the `--remove-engine-configs` flag,\nreplacing \u003cvar translate=\"no\"\u003evariables\u003c/var\u003e with appropriate values. \n\n```\ngcloud memorystore instances update instance-id \\\n--location=region-id \\\n--project=project-id \\\n--remove-engine-configs=config-name\n```\n\nExample: \n\n```\ngcloud memorystore instances update foo --location=us-east1 --project=test-proj --remove-engine-configs=maxmemory-policy\n```\n\nClear configuration parameters\n------------------------------\n\nTo clear all configuration parameters to their default values, run the\n`gcloud memorystore instances update` command with the `--clear-engine-configs` flag,\nreplacing \u003cvar translate=\"no\"\u003evariables\u003c/var\u003e with appropriate values. \n\n```\ngcloud memorystore instances update instance-id \\\n--location=region-id \\\n--project=project-id \\\n--clear-engine-configs\n```\n\nExample: \n\n```\ngcloud memorystore instances update foo --location=us-east1 --project=test-proj --clear-engine-configs\n```"]]