Using the Memory Machine Command Line Tool
Memory Machine provides a command line tool, mvmcli, to show PMEM usage, set DRAM tier levels, manage snapshots, and manage data clusters.
See Using Snapshots in the Memory Machine CLI for more on managing snapshots from the command line.
Run mvmcli with the --help or -h option to see a usage message. For example:
$ mvmcli -h usage: mvmcli COMMAND [options] COMMAND list: -h|--help -v|--version print version cluster cluster management commands. container Container environment commands dram instance DramTier commands license license management commands show-usage show usage snapshot snapshot management commands stats show memory stats $
Run mvmcli with the --version or -v option to display the version and build number of Memory Machine. For example:
$ mvmcli -v v1.1.0-2236a43-release/1.1-release
Working with Clusters
The mvmcli cluster command has a number of subcommands. Using the cluster command without a subcommand lists the subcommands and options:
$ mvmcli cluster mvmcli cluster must have a subcommand mvmcli cluster SUBCOMMAND [options] SUBCOMMAND list: register register cluster configuration update update configuration of a registered cluster rm delete cluster configuration snapcreate create snapshots snaprestore restore snapshots snapdelete delete snapshots list list clusters options: -n|--name=name cluster name. -l|--label=label label of the snapshot. Must follow the POSIX file name standard. -p|--primary=primary primary coordinator. -t|--timeout=seconds timeout for the command. -P|--profile=profile cluster profile. valid profile: hazelcast -c|--contact_member=addr address of the cluster member that mvmcli should contact. -C|--coordinators=addr comma-separated list of node coordinator addresses. -m|--members list all members of cluster snapshots. |--list-coordinator list all coordinators of the cluster. -a|--all list all information about the cluster. |--co-config-path=path path to the YAML file containing a list of coordinator addresses. ('--co-config-path' and '-C' option can be used at the same time) -f|--force force delete snapshot; available for snapdelete subcommand only. |--nopause EXPERIMENTAL - Create a cluster snapshot without pausing the cluster. Hazelcast profile options, available when --profile=hazelcast |--hazelcast-cluster-name the name of the hazelcast cluster for Hazelcast API access |--hazelcast-cluster-password the password for accessing the Hazelcast cluster through its API |--hazelcast-tls if specified, the Memory Machine will attempt to access the Hazelcast cluster with TLS. |--hazelcast-cacert if TLS is enabled, specifies the path to a PEM formatted file for the list of trusted server root certificates. If this option is not specified, a default root cert bundle is used. |--hazelcast-key if TLS is enabled, specifies the path to a PEM formatted file for the private key used for client authentication if required. |--hazelcast-cert if TLS is enabled, specifies the path to a PEM formatted file for the certificate chain used for client authentication if required. $
See Working with Hazelcast Clusters for an explanation of how to capture a cluster snapshot.
Working with Containers
The mvmcli container command has one subcommand to list the snapshots in a container cluster. Using the container command without a subcommand lists the subcommand:
$ mvmcli container mvmcli container must have a subcommand mvmcli container SUBCOMMAND [options]: SUBCOMMAND list: list list snapshots $
Working with DRAM Tier
The mvmcli dram command has one subcommand to resize the DRAM tier. Using the dram command without a subcommand lists the subcommand and options:
$ mvmcli dram mvmcli dram must have a subcommand mvmcli dram SUBCOMMAND [options] SUBCOMMAND list: resize resize DramTier options: -p|--pid pid of the running instance -i|--id id of the running instance -s|--size the desired DramTier size, default MB -g|--huge if huge page will be used (true|false), default false -t|--timeout command timeout value in seconds default 10 seconds -l|--locktimeout timeout value in seconds for Dram flush lock conflict default is 2 seconds -u|--unit unit size [gb | mb], default MB -P|--port Process IPC port -S|--socket Daemon socket path -c|--config The configuration file name $
See Resizing Volatile Tier Memory for information about dynamically resizing DRAM tier.
Working with Licenses
The mvmcli license command has a two subcommands. Using the license command without a subcommand lists the subcommands and options:
$ mvmcli license mvmcli license must have a subcommand mvmcli license SUBCOMMAND [options] SUBCOMMAND list: update update license revoke revoke current license options: -f|--file_path license file to be uploaded -s|--socket_path mvmallocd domain socket path $
See Understanding the Memory Machine Software License to begin working with licenses using the CLI.
Showing PMEM Usage
To show persistent memory (PMEM) usage on the server use the show-usage subcommand. The options are:
mvmcli show-usage
[-u|--unit MB|GB unit]
[-s|--socket_path unix domain socket path of mvmallocd. Default: /tmp/dpme_daemon.0]
[-p|--pid process ID of the running application instance]
[-i|--id application instance ID]
[-v|--verbose print detailed PMEM usage for every instance and snapshot]
For example, to show total usage on the host:
$ mvmcli show-usage License capacity 459640.00MiB PMEM(MiB): Total 459640.00, Used 23638.00, Percent 5.14% DRAM(MiB): Total 507324.68, Used 512.00, Percent 0.10% $
To show usage for a running process (with several optional parameters):
$ mvmcli show-usage -p 316266 This instance is using 263.72 GiB DRAM, 852.00 GiB PMEM for current execution and 10.00 GiB PMEM for snapshots $ $ mvmcli show-usage -p 316266 -u MB -s /tmp/dpme_daemon.0 This instance is using 263720.0 MiB DRAM, 852000.0 MiB PMEM for current execution and 10000.0 MiB PMEM for snapshots $ $ mvmcli show-usage -p 4464 -v This instance is using 263.72 MiB DRAM, 852.00 MiB PMEM for current execution and 0.00 MiB PMEM for snapshots HugePage: True, Max DRAM Tier size: 600.00 MiB, Allocated DRAM size: 256.00 MiB, Mapped DRAM size: 0.00 MiB $
Working with Snapshots
The mvmcli snapshot command has a number of subcommands. Using the snapshot command without a subcommand lists the subcommands and options:
$ mvmcli snapshot mvmcli snapshot must have a subcommand mvmcli snapshot SUBCOMMAND [options] SUBCOMMAND list: create create a snapshot restore restore a snapshot list list snapshots rm remove a snapshot flush flush a snapshot export export a snapshot import import a snapshot replicate replicate a snapshot to a remote host rename rename a snapshot options: -p|--pid=pid target application pid -l|--label=label label of snapshot. Must follow POSIX file name standard. If no label is specified when creating snapshot, a default label will be generated as ProcessName_PID_RandomNumber -z|--new-label=label new label of snapshot being renamed. Must follow POSIX file name standard. -s|--socket_path=socket unix domain socket path of mvmallocd. Default: /tmp/dpme_daemon.0 -P|--port=port udp broadcast port monitored by malloc.so. Default: 5678 -d|--detached detach after restore. Default: do not detach, terminal will be owned by restored application -m|--max_snapshots=max_snapshot maximum number of snapshots this instance can take -f|--force automatically delete oldest snapshots when limit is reached. When used with rm, delete without prompting for confirmation -t|--threads_num=thread_num number of threads to use to flush PMEM data -F|--savefile=file_regex save file(s) while dumping, additional file(s) basename to be saved when taking a snapshot where filename(s) can be described using regular expressions (POSIX ERE) -i|--incomplete delete snapshots with incomplete status -a|--all delete all snapshots -n|--application_name=app_name application name of instances -T|--snap-time sort snapshots by snapshot creation time, newest to oldest -U|--used-pmem sort snapshots by amount of PMEM used, largest to smallest -R|--recoverable-pmem sort snapshots by amount of recoverable PMEM, largest to smallest -r|--reverse use with a sort parameter -T, -U or -R. Reverse the display order -c|--clone[=name] clone an instance from a snapshot. Clone to the network namespace if its name is provided -e|--redirect <source_file_path>:<target_file_path> ... redirect the access of a file owned by the restoring process to a new empty file -E|--redirect-copy <source_file_path>:<target_file_path> ... redirect the access of a file owned by the restoring process to a new copy of the file -x|--extern The destination directory when exporting a snapshot, or the source file when importing a snapshot |--remote The hostname of a remote coordinator to accept the snapshot in a replication process |--prepare-restore-to-namespace When using this option, the restoration of current snapshot will NOT create a new mvmalloc instance. $
See Using Snapshots in Memory Machine for more on managing snapshots from the command line.
Viewing Statistics
To show persistent memory (PMEM) usage on the server use the show-usage subcommand. The options are:
$ mvmcli container mvmcli stats options: -i|--id application instance ID -n|--interval seconds to wait between updates -p|--pid PID of the running application instance -P|--port Mvmalloc socket port -s|--socket_path unix domain socket path of mvmallocd. Default: /tmp/dpme_daemon.0 -u|--unit M|m (MiB) | G|g (GiB) unit. Default: MiB $