Le traduzioni sono generate tramite traduzione automatica. In caso di conflitto tra il contenuto di una traduzione e la versione originale in Inglese, quest'ultima prevarrà.
Esempi di MemoryDB che utilizzano AWS CLI
I seguenti esempi di codice mostrano come eseguire azioni e implementare scenari comuni utilizzando AWS Command Line Interface with MemoryDB.
Le azioni sono estratti di codice da programmi più grandi e devono essere eseguite nel contesto. Sebbene le azioni mostrino come richiamare le singole funzioni del servizio, è possibile visualizzarle contestualizzate negli scenari correlati.
Ogni esempio include un link al codice sorgente completo, in cui vengono fornite le istruzioni su come configurare ed eseguire il codice nel contesto.
Argomenti
Azioni
Il seguente esempio di codice mostra come utilizzare. copy-snapshot
- AWS CLI
-
Come copiare una snapshot
L’esempio
copy-snapshotseguente crea una copia di uno snapshot.aws memorydb copy-snapshot \ --source-snapshot-namemy-cluster-snapshot\ --target-snapshot-namemy-cluster-snapshot-copyOutput
{ "Snapshot": { "Name": "my-cluster-snapshot-copy", "Status": "creating", "Source": "manual", "ARN": "arn:aws:memorydb:us-east-1:491658xxxxxx:snapshot/my-cluster-snapshot-copy", "ClusterConfiguration": { "Name": "my-cluster", "Description": " ", "NodeType": "db.r6g.large", "EngineVersion": "6.2", "MaintenanceWindow": "wed:03:00-wed:04:00", "Port": 6379, "ParameterGroupName": "default.memorydb-redis6", "SubnetGroupName": "my-sg", "VpcId": "vpc-xx2574fc", "SnapshotRetentionLimit": 0, "SnapshotWindow": "04:30-05:30", "NumShards": 2 } } }Per ulteriori informazioni, consulta Copia di uno snapshot nella Guida per l’utente di MemoryDB.
-
Per i dettagli sull'API, consulta CopySnapshot AWS CLI
Command Reference.
-
Il seguente esempio di codice mostra come utilizzarecreate-acl.
- AWS CLI
-
Come creare una lista di controllo degli accessi (ACL)
L’esempio
create-aclseguente crea una nuova lista di controllo degli accessi (ACL).aws memorydb create-acl \ --acl-name"new-acl-1"\ --user-names"my-user"Output:
{ "ACL": { "Name": "new-acl-1", "Status": "creating", "UserNames": [ "my-user" ], "MinimumEngineVersion": "6.2", "Clusters": [], "ARN": "arn:aws:memorydb:us-east-1:491658xxxxxx:acl/new-acl-1" } }Per ulteriori informazioni, consulta Autenticazione degli utenti con le liste di controllo accessi nella Guida per l’utente di MemoryDB.
-
Per i dettagli sull'API, consulta CreateAcl AWS CLI
Command Reference.
-
Il seguente esempio di codice mostra come utilizzarecreate-cluster.
- AWS CLI
-
Come creare un cluster
L’esempio
create-clusterseguente crea un nuovo cluster.aws memorydb create-cluster \ --cluster-namemy-new-cluster\ --node-typedb.r6g.large\ --acl-namemy-acl\ --subnet-groupmy-sgOutput:
{ "Cluster": { "Name": "my-new-cluster", "Status": "creating", "NumberOfShards": 1, "AvailabilityMode": "MultiAZ", "ClusterEndpoint": { "Port": 6379 }, "NodeType": "db.r6g.large", "EngineVersion": "6.2", "EnginePatchVersion": "6.2.6", "ParameterGroupName": "default.memorydb-redis6", "ParameterGroupStatus": "in-sync", "SubnetGroupName": "my-sg", "TLSEnabled": true, "ARN": "arn:aws:memorydb:us-east-1:49165xxxxxx:cluster/my-new-cluster", "SnapshotRetentionLimit": 0, "MaintenanceWindow": "sat:10:00-sat:11:00", "SnapshotWindow": "07:30-08:30", "ACLName": "my-acl", "AutoMinorVersionUpgrade": true } }Per ulteriori informazioni, consulta Gestione dei cluster nella Guida per l’utente di MemoryDB.
-
Per i dettagli sull'API, consulta CreateCluster AWS CLI
Command Reference.
-
Il seguente esempio di codice mostra come utilizzarecreate-parameter-group.
- AWS CLI
-
Come creare un gruppo di parametri
L’esempio
create-parameter-groupseguente crea un gruppo di parametri.aws memorydb create-parameter-group \ --parameter-group-namemyRedis6x\ --familymemorydb_redis6\ --description"my-parameter-group"Output:
{ "ParameterGroup": { "Name": "myredis6x", "Family": "memorydb_redis6", "Description": "my-parameter-group", "ARN": "arn:aws:memorydb:us-east-1:49165xxxxxx:parametergroup/myredis6x" } }Per ulteriori informazioni, consulta Creazione di un gruppo di parametri nella Guida per l’utente di MemoryDB.
-
Per i dettagli sull'API, consulta CreateParameterGroup AWS CLI
Command Reference.
-
Il seguente esempio di codice mostra come utilizzarecreate-snapshot.
- AWS CLI
-
Come creare uno snapshot
L’esempio
create-snapshotseguente crea uno snapshot.aws memorydb create-snapshot \ --cluster-namemy-cluster\ --snapshot-namemy-cluster-snapshotOutput:
{ "Snapshot": { "Name": "my-cluster-snapshot1", "Status": "creating", "Source": "manual", "ARN": "arn:aws:memorydb:us-east-1:49165xxxxxx:snapshot/my-cluster-snapshot", "ClusterConfiguration": { "Name": "my-cluster", "Description": "", "NodeType": "db.r6g.large", "EngineVersion": "6.2", "MaintenanceWindow": "wed:03:00-wed:04:00", "Port": 6379, "ParameterGroupName": "default.memorydb-redis6", "SubnetGroupName": "my-sg", "VpcId": "vpc-862xxxxc", "SnapshotRetentionLimit": 0, "SnapshotWindow": "04:30-05:30", "NumShards": 2 } } }Per ulteriori informazioni, consulta Creazione manuale di snapshot nella Guida per l’utente di MemoryDB.
-
Per i dettagli sull'API, consulta CreateSnapshot AWS CLI
Command Reference.
-
Il seguente esempio di codice mostra come utilizzarecreate-subnet-group.
- AWS CLI
-
Come creare un gruppo di sottoreti
L’esempio
create-subnet-groupseguente crea un gruppo di sottoreti.aws memorydb create-subnet-group \ --subnet-group-namemysubnetgroup\ --description"my subnet group"\ --subnet-idssubnet-5623xxxxOutput:
{ "SubnetGroup": { "Name": "mysubnetgroup", "Description": "my subnet group", "VpcId": "vpc-86257xxx", "Subnets": [ { "Identifier": "subnet-5623xxxx", "AvailabilityZone": { "Name": "us-east-1a" } } ], "ARN": "arn:aws:memorydb:us-east-1:491658xxxxxx:subnetgroup/mysubnetgroup" } }Per ulteriori informazioni, consulta Creazione di un gruppo di sottoreti nella Guida per l’utente di MemoryDB.
-
Per i dettagli sull'API, consulta CreateSubnetGroup AWS CLI
Command Reference.
-
Il seguente esempio di codice mostra come utilizzarecreate-user.
- AWS CLI
-
Come creare un utente
L’esempio
create-userseguente crea un’attività di replica.aws memorydb create-user \ --user-nameuser-name-1\ --access-string"~objects:* ~items:* ~public:*"\ --authentication-mode \ Passwords="enterapasswordhere",Type=passwordOutput:
{ "User": { "Name": "user-name-1", "Status": "active", "AccessString": "off ~objects:* ~items:* ~public:* resetchannels -@all", "ACLNames": [], "MinimumEngineVersion": "6.2", "Authentication": { "Type": "password", "PasswordCount": 1 }, "ARN": "arn:aws:memorydb:us-west-2:491658xxxxxx:user/user-name-1" } }Per ulteriori informazioni, consulta Autenticazione degli utenti con le liste di controllo accessi nella Guida per l’utente di MemoryDB.
-
Per i dettagli sull'API, consulta CreateUser AWS CLI
Command Reference.
-
Il seguente esempio di codice mostra come utilizzaredelete-acl.
- AWS CLI
-
Come eliminare una lista di controllo degli accessi (ACL)
L’esempio
delete-aclseguente elimina una lista di controllo degli accessi (ACL).aws memorydb delete-acl \ --acl-name"new-acl-1"Output:
{ "ACL": { "Name": "new-acl-1", "Status": "deleting", "UserNames": [ "pat" ], "MinimumEngineVersion": "6.2", "Clusters": [], "ARN": "arn:aws:memorydb:us-east-1:491658xxxxxx:acl/new-acl-1" } }Per ulteriori informazioni, consulta Autenticazione degli utenti con le liste di controllo accessi nella Guida per l’utente di MemoryDB.
-
Per i dettagli sull'API, consulta DeleteAcl AWS CLI
Command Reference.
-
Il seguente esempio di codice mostra come utilizzaredelete-cluster.
- AWS CLI
-
Come eliminare un cluster
L’esempio
delete-clusterseguente elimina un cluster.aws memorydb delete-cluster \ --cluster-namemy-new-clusterOutput:
{ "Cluster": { "Name": "my-new-cluster", "Status": "deleting", "NumberOfShards": 1, "ClusterEndpoint": { "Address": "clustercfg.my-new-cluster.xxxxx.memorydb.us-east-1.amazonaws.com", "Port": 6379 }, "NodeType": "db.r6g.large", "EngineVersion": "6.2", "EnginePatchVersion": "6.2.6", "ParameterGroupName": "default.memorydb-redis6", "ParameterGroupStatus": "in-sync", "SubnetGroupName": "my-sg", "TLSEnabled": true, "ARN": "arn:aws:memorydb:us-east-1:491658xxxxxx:cluster/my-new-cluster", "SnapshotRetentionLimit": 0, "MaintenanceWindow": "sat:10:00-sat:11:00", "SnapshotWindow": "07:30-08:30", "AutoMinorVersionUpgrade": true } }Per ulteriori informazioni, consulta Eliminazione di un cluster nella Guida per l’utente di MemoryDB.
-
Per i dettagli sull'API, consulta DeleteCluster AWS CLI
Command Reference.
-
Il seguente esempio di codice mostra come utilizzaredelete-parameter-group.
- AWS CLI
-
Come eliminare un gruppo di parametri
L’esempio
delete-parameter-groupseguente elimina un gruppo di parametri.aws memorydb delete-parameter-group \ --parameter-group-namemyRedis6xOutput:
{ "ParameterGroup": { "Name": "myredis6x", "Family": "memorydb_redis6", "Description": "my-parameter-group", "ARN": "arn:aws:memorydb:us-east-1:491658xxxxxx:parametergroup/myredis6x" } }Per ulteriori informazioni, consulta Eliminazione di un gruppo di parametri nella Guida per l’utente di MemoryDB.
-
Per i dettagli sull'API, consulta DeleteParameterGroup AWS CLI
Command Reference.
-
Il seguente esempio di codice mostra come utilizzaredelete-snapshot.
- AWS CLI
-
Come eliminare uno snapshot
L’esempio
delete-snapshotseguente elimina uno snapshot.aws memorydb delete-snapshot \ --snapshot-namemy-cluster-snapshotOutput:
{ "Snapshot": { "Name": "my-cluster-snapshot", "Status": "deleting", "Source": "manual", "ARN": "arn:aws:memorydb:us-east-1:49165xxxxxx:snapshot/my-cluster-snapshot", "ClusterConfiguration": { "Name": "my-cluster", "Description": "", "NodeType": "db.r6g.large", "EngineVersion": "6.2", "MaintenanceWindow": "wed:03:00-wed:04:00", "Port": 6379, "ParameterGroupName": "default.memorydb-redis6", "SubnetGroupName": "my-sg", "VpcId": "vpc-862xxxxc", "SnapshotRetentionLimit": 0, "SnapshotWindow": "04:30-05:30", "NumShards": 2 } } }Per ulteriori informazioni, consulta Eliminazione di uno snapshot nella Guida per l’utente di MemoryDB.
-
Per i dettagli sull'API, consulta DeleteSnapshot AWS CLI
Command Reference.
-
Il seguente esempio di codice mostra come utilizzaredelete-subnet-group.
- AWS CLI
-
Come eliminare un gruppo di sottoreti
L’esempio
delete-subnet-groupseguente elimina una sottorete.aws memorydb delete-subnet-group \ --subnet-group-namemysubnetgroupOutput:
{ "SubnetGroup": { "Name": "mysubnetgroup", "Description": "my subnet group", "VpcId": "vpc-86xxxx4fc", "Subnets": [ { "Identifier": "subnet-56xxx61b", "AvailabilityZone": { "Name": "us-east-1a" } } ], "ARN": "arn:aws:memorydb:us-east-1:491658xxxxxx:subnetgroup/mysubnetgroup" } }Per ulteriori informazioni, consulta Eliminazione di un gruppo di sottoreti nella Guida per l’utente di MemoryDB.
-
Per i dettagli sull'API, consulta DeleteSubnetGroup AWS CLI
Command Reference.
-
Il seguente esempio di codice mostra come utilizzaredelete-user.
- AWS CLI
-
Come eliminare un utente
L’esempio
delete-userseguente elimina un sink.aws memorydb delete-user \ --user-namemy-userOutput:
{ "User": { "Name": "my-user", "Status": "deleting", "AccessString": "on ~app::* resetchannels -@all +@read", "ACLNames": [ "my-acl" ], "MinimumEngineVersion": "6.2", "Authentication": { "Type": "password", "PasswordCount": 1 }, "ARN": "arn:aws:memorydb:us-east-1:491658xxxxxx:user/my-user" } }Per ulteriori informazioni, consulta Autenticazione degli utenti con le liste di controllo accessi nella Guida per l’utente di MemoryDB.
-
Per i dettagli sull'API, consulta DeleteUser AWS CLI
Command Reference.
-
Il seguente esempio di codice mostra come utilizzaredescribe-acls.
- AWS CLI
-
Per restituire un elenco di ACLs
Il seguente describe-acls` restituisce un elenco di. ACLs
aws memorydb describe-aclsOutput:
{ "ACLs": [ { "Name": "open-access", "Status": "active", "UserNames": [ "default" ], "MinimumEngineVersion": "6.2", "Clusters": [], "ARN": "arn:aws:memorydb:us-east-1:491658xxxxxx:acl/open-access" }, { "Name": my-acl", "Status": "active", "UserNames": [], "MinimumEngineVersion": "6.2", "Clusters": [ "my-cluster" ], "ARN": "arn:aws:memorydb:us-east-1:49165xxxxxxx:acl/my-acl" } ] }Per ulteriori informazioni, consulta Autenticazione degli utenti con le liste di controllo accessi nella Guida per l’utente di MemoryDB.
-
Per i dettagli sull'API, vedere in Command Reference. DescribeAcls
AWS CLI
-
Il seguente esempio di codice mostra come utilizzaredescribe-clusters.
- AWS CLI
-
Come restituire un elenco di cluster
L’esempio describe-clusters seguente restituisce un elenco di cluster.
aws memorydb describe-clustersOutput:
{ "Clusters": [ { "Name": "my-cluster", "Status": "available", "NumberOfShards": 2, "ClusterEndpoint": { "Address": "clustercfg.my-cluster.llru6f.memorydb.us-east-1.amazonaws.com", "Port": 6379 }, "NodeType": "db.r6g.large", "EngineVersion": "6.2", "EnginePatchVersion": "6.2.6", "ParameterGroupName": "default.memorydb-redis6", "ParameterGroupStatus": "in-sync", "SecurityGroups": [ { "SecurityGroupId": "sg-0a1434xxxxxc9fae", "Status": "active" } ], "SubnetGroupName": "pat-sg", "TLSEnabled": true, "ARN": "arn:aws:memorydb:us-east-1:49165xxxxxx:cluster/my-cluster", "SnapshotRetentionLimit": 0, "MaintenanceWindow": "wed:03:00-wed:04:00", "SnapshotWindow": "04:30-05:30", "ACLName": "my-acl", "AutoMinorVersionUpgrade": true } ] }Per ulteriori informazioni, consulta Gestione dei cluster nella Guida per l’utente di MemoryDB.
-
Per i dettagli sull'API, consulta DescribeClusters AWS CLI
Command Reference.
-
Il seguente esempio di codice mostra come utilizzaredescribe-engine-versions.
- AWS CLI
-
Come restituire un elenco di versioni del motore
Il seguente describe-engine-versions `restituisce un elenco di versioni del motore.
aws memorydb describe-engine-versionsOutput:
{ "EngineVersions": [ { "EngineVersion": "6.2", "EnginePatchVersion": "6.2.6", "ParameterGroupFamily": "memorydb_redis6" } ] }Per ulteriori informazioni, consulta Versioni e aggiornamenti del motore nella Guida per l’utente di MemoryDB.
-
Per i dettagli sull'API, consulta DescribeEngineVersions AWS CLI
Command Reference.
-
Il seguente esempio di codice mostra come utilizzaredescribe-events.
- AWS CLI
-
Come restituire un elenco di eventi
L’esempio describe-events seguente restituisce un elenco di eventi.
aws memorydb describe-eventsOutput:
{ "Events": [ { "SourceName": "my-cluster", "SourceType": "cluster", "Message": "Increase replica count started for replication group my-cluster on 2022-07-22T14:09:01.440Z", "Date": "2022-07-22T07:09:01.443000-07:00" }, { "SourceName": "my-user", "SourceType": "user", "Message": "Create user my-user operation completed.", "Date": "2022-07-22T07:00:02.975000-07:00" } ] }Per ulteriori informazioni, consulta Monitoraggio degli eventi nella Guida per l’utente di MemoryDB.
-
Per i dettagli sull'API, consulta DescribeEvents AWS CLI
Command Reference.
-
Il seguente esempio di codice mostra come utilizzaredescribe-parameter-groups.
- AWS CLI
-
Come restituire un elenco di gruppi di parametri
Il seguente describe-parameter-groups `restituisce un elenco di gruppi di parametri.
aws memorydb describe-parameter-groupsOutput:
{ "ParameterGroups": [ { "Name": "default.memorydb-redis6", "Family": "memorydb_redis6", "Description": "Default parameter group for memorydb_redis6", "ARN": "arn:aws:memorydb:us-east-1:491658xxxxxx:parametergroup/default.memorydb-redis6" } ] }Per ulteriori informazioni, consulta Configurazione dei parametri di motore con i gruppi di parametri nella Guida per l’utente di MemoryDB.
-
Per i dettagli sull'API, vedere DescribeParameterGroups
in AWS CLI Command Reference.
-
Il seguente esempio di codice mostra come utilizzaredescribe-parameters.
- AWS CLI
-
Come restituire un elenco di parametri
L’esempio describe-parameters seguente restituisce un elenco di parametri.
aws memorydb describe-parametersOutput:
{ "Parameters": [ { "Name": "acllog-max-len", "Value": "128", "Description": "The maximum length of the ACL Log", "DataType": "integer", "AllowedValues": "1-10000", "MinimumEngineVersion": "6.2.4" }, { "Name": "activedefrag", "Value": "no", "Description": "Enabled active memory defragmentation", "DataType": "string", "AllowedValues": "yes,no", "MinimumEngineVersion": "6.2.4" }, { "Name": "active-defrag-cycle-max", "Value": "75", "Description": "Maximal effort for defrag in CPU percentage", "DataType": "integer", "AllowedValues": "1-75", "MinimumEngineVersion": "6.2.4" }, { "Name": "active-defrag-cycle-min", "Value": "5", "Description": "Minimal effort for defrag in CPU percentage", "DataType": "integer", "AllowedValues": "1-75", "MinimumEngineVersion": "6.2.4" }, { "Name": "active-defrag-ignore-bytes", "Value": "104857600", "Description": "Minimum amount of fragmentation waste to start active defrag", "DataType": "integer", "AllowedValues": "1048576-", "MinimumEngineVersion": "6.2.4" }, { "Name": "active-defrag-max-scan-fields", "Value": "1000", "Description": "Maximum number of set/hash/zset/list fields that will be processed from the main dictionary scan", "DataType": "integer", "AllowedValues": "1-1000000", "MinimumEngineVersion": "6.2.4" }, { "Name": "active-defrag-threshold-lower", "Value": "10", "Description": "Minimum percentage of fragmentation to start active defrag", "DataType": "integer", "AllowedValues": "1-100", "MinimumEngineVersion": "6.2.4" }, { "Name": "active-defrag-threshold-upper", "Value": "100", "Description": "Maximum percentage of fragmentation at which we use maximum effort", "DataType": "integer", "AllowedValues": "1-100", "MinimumEngineVersion": "6.2.4" }, { "Name": "active-expire-effort", "Value": "1", "Description": "The amount of effort that redis uses to expire items in the active expiration job", "DataType": "integer", "AllowedValues": "1-10", "MinimumEngineVersion": "6.2.4" }, { "Name": "activerehashing", "Value": "yes", "Description": "Apply rehashing or not", "DataType": "string", "AllowedValues": "yes,no", "MinimumEngineVersion": "6.2.4" }, { "Name": "client-output-buffer-limit-normal-hard-limit", "Value": "0", "Description": "Normal client output buffer hard limit in bytes", "DataType": "integer", "AllowedValues": "0-", "MinimumEngineVersion": "6.2.4" }, { "Name": "client-output-buffer-limit-normal-soft-limit", "Value": "0", "Description": "Normal client output buffer soft limit in bytes", "DataType": "integer", "AllowedValues": "0-", "MinimumEngineVersion": "6.2.4" }, { "Name": "client-output-buffer-limit-normal-soft-seconds", "Value": "0", "Description": "Normal client output buffer soft limit in seconds", "DataType": "integer", "AllowedValues": "0-", "MinimumEngineVersion": "6.2.4" }, { "Name": "client-output-buffer-limit-pubsub-hard-limit", "Value": "33554432", "Description": "Pubsub client output buffer hard limit in bytes", "DataType": "integer", "AllowedValues": "0-", "MinimumEngineVersion": "6.2.4" }, { "Name": "client-output-buffer-limit-pubsub-soft-limit", "Value": "8388608", "Description": "Pubsub client output buffer soft limit in bytes", "DataType": "integer", "AllowedValues": "0-", "MinimumEngineVersion": "6.2.4" }, { "Name": "client-output-buffer-limit-pubsub-soft-seconds", "Value": "60", "Description": "Pubsub client output buffer soft limit in seconds", "DataType": "integer", "AllowedValues": "0-", "MinimumEngineVersion": "6.2.4" }, { "Name": "hash-max-ziplist-entries", "Value": "512", "Description": "The maximum number of hash entries in order for the dataset to be compressed", "DataType": "integer", "AllowedValues": "0-", "MinimumEngineVersion": "6.2.4" }, { "Name": "hash-max-ziplist-value", "Value": "64", "Description": "The threshold of biggest hash entries in order for the dataset to be compressed", "DataType": "integer", "AllowedValues": "0-", "MinimumEngineVersion": "6.2.4" }, { "Name": "hll-sparse-max-bytes", "Value": "3000", "Description": "HyperLogLog sparse representation bytes limit", "DataType": "integer", "AllowedValues": "1-16000", "MinimumEngineVersion": "6.2.4" }, { "Name": "lazyfree-lazy-eviction", "Value": "no", "Description": "Perform an asynchronous delete on evictions", "DataType": "string", "AllowedValues": "yes,no", "MinimumEngineVersion": "6.2.4" }, { "Name": "lazyfree-lazy-expire", "Value": "no", "Description": "Perform an asynchronous delete on expired keys", "DataType": "string", "AllowedValues": "yes,no", "MinimumEngineVersion": "6.2.4" }, { "Name": "lazyfree-lazy-server-del", "Value": "no", "Description": "Perform an asynchronous delete on key updates", "DataType": "string", "AllowedValues": "yes,no", "MinimumEngineVersion": "6.2.4" }, { "Name": "lazyfree-lazy-user-del", "Value": "no", "Description": "Specifies whether the default behavior of DEL command acts the same as UNLINK", "DataType": "string", "AllowedValues": "yes,no", "MinimumEngineVersion": "6.2.4" }, { "Name": "lfu-decay-time", "Value": "1", "Description": "The amount of time in minutes to decrement the key counter for LFU eviction policyd", "DataType": "integer", "AllowedValues": "0-", "MinimumEngineVersion": "6.2.4" }, { "Name": "lfu-log-factor", "Value": "10", "Description": "The log factor for incrementing key counter for LFU eviction policy", "DataType": "integer", "AllowedValues": "1-", "MinimumEngineVersion": "6.2.4" }, { "Name": "list-compress-depth", "Value": "0", "Description": "Number of quicklist ziplist nodes from each side of the list to exclude from compression. The head and tail of the list are always uncompressed for fast push/pop operations", "DataType": "integer", "AllowedValues": "0-", "MinimumEngineVersion": "6.2.4" }, { "Name": "maxmemory-policy", "Value": "noeviction", "Description": "Max memory policy", "DataType": "string", "AllowedValues": "volatile-lru,allkeys-lru,volatile-lfu,allkeys-lfu,volatile-random,allkeys-random,volatile-ttl,noeviction", "MinimumEngineVersion": "6.2.4" }, { "Name": "maxmemory-samples", "Value": "3", "Description": "Max memory samples", "DataType": "integer", "AllowedValues": "1-", "MinimumEngineVersion": "6.2.4" }, { "Name": "notify-keyspace-events", "Description": "The keyspace events for Redis to notify Pub/Sub clients about. By default all notifications are disabled", "DataType": "string", "MinimumEngineVersion": "6.2.4" }, { "Name": "set-max-intset-entries", "Value": "512", "Description": "The limit in the size of the set in order for the dataset to be compressed", "DataType": "integer", "AllowedValues": "0-", "MinimumEngineVersion": "6.2.4" }, { "Name": "slowlog-log-slower-than", "Value": "10000", "Description": "The execution time, in microseconds, to exceed in order for the command to get logged. Note that a negative number disables the slow log, while a value of zero forces the logging of every command", "DataType": "integer", "AllowedValues": "-", "MinimumEngineVersion": "6.2.4" }, { "Name": "slowlog-max-len", "Value": "128", "Description": "The length of the slow log. There is no limit to this length. Just be aware that it will consume memory. You can reclaim memory used by the slow log with SLOWLOG RESET.", "DataType": "integer", "AllowedValues": "0-", "MinimumEngineVersion": "6.2.4" }, { "Name": "stream-node-max-bytes", "Value": "4096", "Description": "The maximum size of a single node in a stream in bytes", "DataType": "integer", "AllowedValues": "0-", "MinimumEngineVersion": "6.2.4" }, { "Name": "stream-node-max-entries", "Value": "100", "Description": "The maximum number of items a single node in a stream can contain", "DataType": "integer", "AllowedValues": "0-", "MinimumEngineVersion": "6.2.4" }, { "Name": "tcp-keepalive", "Value": "300", "Description": "If non-zero, send ACKs every given number of seconds", "DataType": "integer", "AllowedValues": "0-", "MinimumEngineVersion": "6.2.4" }, { "Name": "timeout", "Value": "0", "Description": "Close connection if client is idle for a given number of seconds, or never if 0", "DataType": "integer", "AllowedValues": "0,20-", "MinimumEngineVersion": "6.2.4" }, { "Name": "tracking-table-max-keys", "Value": "1000000", "Description": "The maximum number of keys allowed for the tracking table for client side caching", "DataType": "integer", "AllowedValues": "1-100000000", "MinimumEngineVersion": "6.2.4" }, { "Name": "zset-max-ziplist-entries", "Value": "128", "Description": "The maximum number of sorted set entries in order for the dataset to be compressed", "DataType": "integer", "AllowedValues": "0-", "MinimumEngineVersion": "6.2.4" }, { "Name": "zset-max-ziplist-value", "Value": "64", "Description": "The threshold of biggest sorted set entries in order for the dataset to be compressed", "DataType": "integer", "AllowedValues": "0-", "MinimumEngineVersion": "6.2.4" } ] }Per ulteriori informazioni, consulta Configurazione dei parametri di motore con i gruppi di parametri nella Guida per l’utente di MemoryDB.
-
Per i dettagli sull'API, consulta DescribeParameters AWS CLI
Command Reference.
-
Il seguente esempio di codice mostra come utilizzaredescribe-snapshots.
- AWS CLI
-
Come restituire un elenco di snapshot
L’esempio comando describe-snapshots seguente restituisce un elenco di istantanee.
aws memorydb describe-snapshotsOutput:
{ "Snapshots": [ { "Name": "my-cluster-snapshot", "Status": "available", "Source": "manual", "ARN": "arn:aws:memorydb:us-east-1:491658xxxxxx2:snapshot/my-cluster-snapshot", "ClusterConfiguration": { "Name": "my-cluster", "Description": " ", "NodeType": "db.r6g.large", "EngineVersion": "6.2", "MaintenanceWindow": "wed:03:00-wed:04:00", "Port": 6379, "ParameterGroupName": "default.memorydb-redis6", "SubnetGroupName": "my-sg", "VpcId": "vpc-862574fc", "SnapshotRetentionLimit": 0, "SnapshotWindow": "04:30-05:30", "NumShards": 2 } } }Per ulteriori informazioni, consulta Snapshot e ripristino nella Guida per l’utente di MemoryDB.
-
Per i dettagli sull'API, consulta DescribeSnapshots AWS CLI
Command Reference.
-
Il seguente esempio di codice mostra come utilizzaredescribe-subnet-groups.
- AWS CLI
-
Come restituire un elenco di gruppi di sottoreti
Il seguente describe-subnet-groups `restituisce un elenco di gruppi di sottoreti.
aws memorydb describe-subnet-groupsOutput
{ "SubnetGroups": [ { "Name": "my-sg", "Description": "pat-sg", "VpcId": "vpc-86xxx4fc", "Subnets": [ { "Identifier": "subnet-faxx84a6", "AvailabilityZone": { "Name": "us-east-1b" } }, { "Identifier": "subnet-56xxf61b", "AvailabilityZone": { "Name": "us-east-1a" } } ], "ARN": "arn:aws:memorydb:us-east-1:49165xxxxxx:subnetgroup/my-sg" } ] }Per ulteriori informazioni, consulta Sottoreti e gruppi di sottoreti nella Guida per l’utente di MemoryDB.
-
Per i dettagli sull'API, vedere DescribeSubnetGroups
in AWS CLI Command Reference.
-
Il seguente esempio di codice mostra come utilizzaredescribe-users.
- AWS CLI
-
Come restituire un elenco di utenti
L’esempio describe-users seguente restituisce un elenco di utenti.
aws memorydb describe-usersOutput
{ "Users": [ { "Name": "default", "Status": "active", "AccessString": "on ~* &* +@all", "ACLNames": [ "open-access" ], "MinimumEngineVersion": "6.0", "Authentication": { "Type": "no-password" }, "ARN": "arn:aws:memorydb:us-east-1:491658xxxxxx:user/default" }, { "Name": "my-user", "Status": "active", "AccessString": "off ~objects:* ~items:* ~public:* resetchannels -@all", "ACLNames": [], "MinimumEngineVersion": "6.2", "Authentication": { "Type": "password", "PasswordCount": 2 }, "ARN": "arn:aws:memorydb:us-east-1:491658xxxxxx:user/my-user" } ] }Per ulteriori informazioni, consulta Autenticazione degli utenti con le liste di controllo accessi nella Guida per l’utente di MemoryDB.
-
Per i dettagli sull'API, consulta DescribeUsers AWS CLI
Command Reference.
-
Il seguente esempio di codice mostra come utilizzarefailover-shard.
- AWS CLI
-
Come eseguire il failover di uno shard
Il comando failover-shard seguente esegue il failover di uno shard.
aws memorydb failover-shard \ --cluster-namemy-cluster--shard-name0001Output:
{ "Cluster": { "Name": "my-cluster", "Status": "available", "NumberOfShards": 2, "ClusterEndpoint": { "Address": "clustercfg.my-cluster.xxxxxx.memorydb.us-east-1.amazonaws.com", "Port": 6379 }, "NodeType": "db.r6g.large", "EngineVersion": "6.2", "EnginePatchVersion": "6.2.6", "ParameterGroupName": "default.memorydb-redis6", "ParameterGroupStatus": "in-sync", "SecurityGroups": [ { "SecurityGroupId": "sg-0a143xxxx45c9fae", "Status": "active" } ], "SubnetGroupName": "my-sg", "TLSEnabled": true, "ARN": "arn:aws:memorydb:us-east-1:491658xxxxxx:cluster/my-cluster", "SnapshotRetentionLimit": 0, "MaintenanceWindow": "wed:03:00-wed:04:00", "SnapshotWindow": "04:30-05:30", "AutoMinorVersionUpgrade": true } }Per ulteriori informazioni, consulta Ridurre al minimo i tempi di inattività con la funzione Multi-AZ nella Guida per l’utente di MemoryDB.
-
Per i dettagli sull'API, consulta FailoverShard AWS CLI
Command Reference.
-
Il seguente esempio di codice mostra come utilizzarelist-allowed-node-type-updates.
- AWS CLI
-
Come restituire un elenco di aggiornamenti dei tipi di nodo consentiti
Il seguente list-allowed-node-type -updates restituisce un elenco di aggiornamenti disponibili per i tipi di nodo.
aws memorydb list-allowed-node-type-updatesOutput:
{ "Cluster": { "Name": "my-cluster", "Status": "available", "NumberOfShards": 2, "ClusterEndpoint": { "Address": "clustercfg.my-cluster.xxxxxx.memorydb.us-east-1.amazonaws.com", "Port": 6379 }, "NodeType": "db.r6g.large", "EngineVersion": "6.2", "EnginePatchVersion": "6.2.6", "ParameterGroupName": "default.memorydb-redis6", "ParameterGroupStatus": "in-sync", "SecurityGroups": [ { "SecurityGroupId": "sg-0a143xxxx45c9fae", "Status": "active" } ], "SubnetGroupName": "my-sg", "TLSEnabled": true, "ARN": "arn:aws:memorydb:us-east-1:491658xxxxxx:cluster/my-cluster", "SnapshotRetentionLimit": 0, "MaintenanceWindow": "wed:03:00-wed:04:00", "SnapshotWindow": "04:30-05:30", "AutoMinorVersionUpgrade": true } }Per ulteriori informazioni, consulta Dimensionamento nella Guida per l’utente di MemoryDB.
-
Per i dettagli sull'API, vedere ListAllowedNodeTypeUpdates
in AWS CLI Command Reference.
-
Il seguente esempio di codice mostra come utilizzarelist-tags.
- AWS CLI
-
Come restituire un elenco di tag
Il comando list-tags seguente restituisce un elenco di tag.
aws memorydb list-tags \ --resource-arnarn:aws:memorydb:us-east-1:491658xxxxxx:cluster/my-clusterOutput:
{ "TagList": [ { "Key": "mytag", "Value": "myvalue" } ] }Per ulteriori informazioni, consulta Tagging di risorse nella Guida per l’utente di MemoryDB.
-
Per i dettagli sull'API, consulta ListTags AWS CLI
Command Reference.
-
Il seguente esempio di codice mostra come utilizzarereset-parameter-group.
- AWS CLI
-
Come reimpostare un gruppo di parametri
Il seguente reset-parameter-group `reimposta un gruppo di parametri.
aws memorydb reset-parameter-group \ --parameter-group-namemy-parameter-group\ --all-parametersOutput:
{ "ParameterGroup": { "Name": "my-parameter-group", "Family": "memorydb_redis6", "Description": "my parameter group", "ARN": "arn:aws:memorydb:us-east-1:491658xxxxxx:parametergroup/my-parameter-group" } }Per ulteriori informazioni, consulta Configurazione dei parametri di motore con i gruppi di parametri nella Guida per l’utente di MemoryDB.
-
Per i dettagli sull'API, vedere ResetParameterGroup
in AWS CLI Command Reference.
-
Il seguente esempio di codice mostra come utilizzaretag-resource.
- AWS CLI
-
Come taggare a una risorsa
Il comando tag-resource seguente aggiunge un tag a una risorsa.
aws memorydb tag-resource \ --resource-arnarn:aws:memorydb:us-east-1:491658xxxxxx:cluster/my-cluster\ --tags Key="mykey",Value="myvalue"Output:
{ "TagList": [ { "Key": "mytag", "Value": "myvalue" }, { "Key": "mykey", "Value": "myvalue" } ] }Per ulteriori informazioni, consulta Tagging di risorse nella Guida per l’utente di MemoryDB.
-
Per i dettagli sull'API, consulta TagResource AWS CLI
Command Reference.
-
Il seguente esempio di codice mostra come utilizzareuntag-resource.
- AWS CLI
-
Come aggiornare una lista di controllo degli accessi (ACL)
Il comando update-acl seguente aggiorna un ACL aggiungendo un utente.
aws memorydb untag-resource \ --resource-arnarn:aws:memorydb:us-east-1:491658xxxxx:cluster/my-cluster\ --tag-keysmykeyOutput:
{ "TagList": [ { "Key": "mytag", "Value": "myvalue" } ] }Per ulteriori informazioni, consulta Tagging di risorse nella Guida per l’utente di MemoryDB.
-
Per i dettagli sull'API, consulta UntagResource AWS CLI
Command Reference.
-
Il seguente esempio di codice mostra come utilizzareupdate-cluster.
- AWS CLI
-
Come aggiornare un cluster
Il seguente update-cluster`` aggiorna il gruppo di parametri di un cluster a. my-parameter-group
aws memorydb update-cluster \ --cluster-namemy-cluster\ --parameter-group-namemy-parameter-groupOutput:
{ "Cluster": { "Name": "my-cluster", "Status": "available", "NumberOfShards": 2, "AvailabilityMode": "MultiAZ", "ClusterEndpoint": { "Address": "clustercfg.my-cluster.llru6f.memorydb.us-east-1.amazonaws.com", "Port": 6379 }, "NodeType": "db.r6g.large", "EngineVersion": "6.2", "EnginePatchVersion": "6.2.6", "ParameterGroupName": "my-parameter-group", "ParameterGroupStatus": "in-sync", "SecurityGroups": [ { "SecurityGroupId": "sg-0a143xxxxxc9fae", "Status": "active" } ], "SubnetGroupName": "pat-sg", "TLSEnabled": true, "ARN": "arn:aws:memorydb:us-east-1:491658xxxxxx:cluster/my-cluster", "SnapshotRetentionLimit": 0, "MaintenanceWindow": "wed:03:00-wed:04:00", "SnapshotWindow": "04:30-05:30", "ACLName": "my-acl", "AutoMinorVersionUpgrade": true } }Per ulteriori informazioni, consulta Modifica di un cluster nella Guida per l’utente di MemoryDB.
-
Per i dettagli sull'API, consulta Command Reference. UpdateCluster
AWS CLI
-
Il seguente esempio di codice mostra come utilizzareupdate-parameter-group.
- AWS CLI
-
Come aggiornare un gruppo di parametri
Il seguente update-parameter-group ``aggiorna un gruppo di parametri.
aws memorydb update-parameter-group \ --parameter-group-namemy-parameter-group\ --parameter-name-values"ParameterName=activedefrag, ParameterValue=no"Output:
{ "ParameterGroup": { "Name": "my-parameter-group", "Family": "memorydb_redis6", "Description": "my parameter group", "ARN": "arn:aws:memorydb:us-east-1:49165xxxxxx:parametergroup/my-parameter-group" } }Per ulteriori informazioni, consulta Modifica di un gruppo di parametri nella Guida per l’utente di MemoryDB.
-
Per i dettagli sull'API, consulta UpdateParameterGroup AWS CLI
Command Reference.
-
Il seguente esempio di codice mostra come utilizzareupdate-subnet-group.
- AWS CLI
-
Come aggiornare un gruppo di sottoreti
Il seguente update-subnet-group `aggiorna l'ID di sottorete di un gruppo di sottoreti.
aws memorydb update-subnet-group \ --subnet-group-namemy-sg\ --subnet-idssubnet-01f29d458f3xxxxxOutput:
{ "SubnetGroup": { "Name": "my-sg-1", "Description": "my-sg", "VpcId": "vpc-09d2cfc01xxxxxxx", "Subnets": [ { "Identifier": "subnet-01f29d458fxxxxxx", "AvailabilityZone": { "Name": "us-east-1a" } } ], "ARN": "arn:aws:memorydb:us-east-1:491658xxxxxx:subnetgroup/my-sg" } }Per ulteriori informazioni, consulta Sottoreti e gruppi di sottoreti nella Guida per l’utente di MemoryDB.
-
Per i dettagli sull'API, vedere UpdateSubnetGroup
in AWS CLI Command Reference.
-
Il seguente esempio di codice mostra come utilizzareupdate-user.
- AWS CLI
-
Come aggiornare un utente
Il comando
update-userseguente modifica la stringa di accesso di un utente.aws memorydb update-user \ --user-namemy-user\ --access-string"off ~objects:* ~items:* ~public:* resetchannels -@all"Output:
{ "User": { "Name": "my-user", "Status": "modifying", "AccessString": "off ~objects:* ~items:* ~public:* resetchannels -@all", "ACLNames": [ "myt-acl" ], "MinimumEngineVersion": "6.2", "Authentication": { "Type": "password", "PasswordCount": 2 }, "ARN": "arn:aws:memorydb:us-east-1:491658xxxxxx:user/my-user" } }Per ulteriori informazioni, consulta Autenticazione degli utenti con le liste di controllo accessi nella Guida per l’utente di MemoryDB.
-
Per i dettagli sull'API, consulta UpdateUser AWS CLI
Command Reference.
-