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.

Restriction: Managing snapshots and data clusters is available in Advanced Edition only.

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.
   dram             instance DRAM tier commands
   license          license management commands
   show-usage       show usage
   snapshot         snapshot management commands
Note: The snapshot subcommand can only be used with Memory Machine Advanced Edition.

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

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]
           [-v|--verbose print detailed PMEM usage for every instance and snapshot]

For example:

$ mvmcli show-usage
Managed DRAM(MiB): Total 0.00, Used 0.00 (0.00)
Managed PMEM(MiB): Total 129016.00, Used 4.00 (0.00)
$ mvmcli show-usage -p 316266
This instance used 8.00MB for the current execution and 10.00MB for snapshots.
$ mvmcli show-usage -p 316266 -u GB -s /tmp/dpme_daemon.0
This instance used 10.00GB for the current execution and 10.00GB for snapshots.

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
  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
    -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_regax        save file(s) while dumping, additional file(s) 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
#

See Using Snapshots in Memory Machine for more on managing snapshots from the command line.

Working with Licenses

The mvmcli license command has a number of 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 Software License to begin working with licenses using the CLI.

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
    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.
#

See Working with Hazelcast Clusters for an explanation of how to capture a cluster snapshot.

Working with DRAM Tier

The mvmcli dram command has a number of subcommands. Using the dram command without a subcommand lists the subcommands and options:

# mvmcli dram
mvmcli dram must have a subcommand
mvmcli dram SUBCOMMAND [options]
  SUBCOMMAND  list:
    resize    resize dram tier
  options:
    -p|--pid     pid of the running instance
    -i|--id      id of the running instance
    -s|--size    the desired DRAM tier 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
    -u|--unit    unit size [gb | mb], default MB
    -P|--port    Process IPC port
    -S|--socket  Daemon socket path
#

See Resizing Volatile Tier Memory for information about dynamically resizing DRAM tier.