AGENT-SSH

On this page

Allows connecting to other hosts via SSH to run shell commands.

Specifying a list of agent-id’s, this command allows users to SSH into remote MemSQL Ops agent hosts to run commands. The SSH credentials used in this command are the same credentials used to deploy the MemSQL Ops agent into that host, or the credential

memsql-ops agent-ssh --multi --agent-ids $(memsql-ops agent-list -q) -- 'ls -lathr'

This command will connect via SSH into each of the hosts that have an agent deployed (including the local host), and list the files in the home directory.

If MemSQL Ops does not have stored credentials for the local host, it will attempt to use one of the defined SSH access credentials of its follower agent hosts. SingleStore recommends to set the SSH credential for the primary agent host manually first.

Usage

usage: memsql-ops agent-ssh [--settings-file SETTINGS_FILE]
                            [--agent-ids AGENT_IDS [AGENT_IDS ...]]
                            [--memsql-role {leaf,aggregator,master} [{leaf,aggregator,master} ...]]
                            [--no-prompt] [-u USER] [-P PORT] [-i PRIVATE_KEY]
                            [-p [PASSWORD]] [--multi]
                            [--num-parallel NUM_PARALLEL]
                            [command]

Open SSH connections to agents.

positional arguments:
  command               An optional command to run. If specified, run the
                        command instead of a shell and exit on completion.

optional arguments:
  --settings-file SETTINGS_FILE
                        A path to a MemSQL Ops settings.conf file. If not set,
                        we will use the file in the same directory as the
                        MemSQL Ops binary.
  --agent-ids AGENT_IDS [AGENT_IDS ...]
                        Filter the nodes by the specified agent IDs.
  --memsql-role {leaf,aggregator,master} [{leaf,aggregator,master} ...]
                        Filter the nodes by the specified SingleStore roles.
  --no-prompt           Skip interactive prompts if a single agent is
                        selected.
  -u USER, --user USER  Use this user for all SSH connections.
  -P PORT, --port PORT  Use this port for all SSH connections.
  -i PRIVATE_KEY, --private-key-file PRIVATE_KEY
                        Use this SSH key for all SSH connections.
  -p [PASSWORD], --password [PASSWORD]
                        Use this password for all SSH connections. Leave blank
                        to read the MEMSQL_PASSWORD environment variable, or
                        have a password prompt if MEMSQL_PASSWORD is not set.
  --multi               Run commands on multiple nodes in parallel.
  --num-parallel NUM_PARALLEL
                        The number of machines to run commands on in parallel
                        if --multi is specified. We will run commands on all
                        machines, but we will only run commands on this many
                        machines at the same time.

Last modified: March 8, 2024

Was this article helpful?