cockroach: github.com/cockroachdb/cockroach/pkg/cmd/roachprod/install Index | Files

package install

import "github.com/cockroachdb/cockroach/pkg/cmd/roachprod/install"

Index

Package Files

cassandra.go cassandra_yaml.go cluster_synced.go cockroach.go expander.go install.go iterm2.go nodes.go session.go staging.go

Variables

var Clusters = map[string]*SyncedCluster{}

Clusters memoizes cluster info for install operations

var StartOpts struct {
    Encrypt    bool
    Sequential bool
}

StartOpts TODO(peter): document

func GetAdminUIPort Uses

func GetAdminUIPort(connPort int) int

GetAdminUIPort returns the admin UI port for ths specified RPC port.

func Install Uses

func Install(c *SyncedCluster, args []string) error

Install TODO(peter): document

func ListNodes Uses

func ListNodes(s string, total int) ([]int, error)

ListNodes TODO(peter): document

func SortedCmds Uses

func SortedCmds() []string

SortedCmds TODO(peter): document

func StageCockroachRelease Uses

func StageCockroachRelease(c *SyncedCluster, version, arch string) error

StageCockroachRelease downloads an official CockroachDB release binary with the specified version.

func StageRemoteBinary Uses

func StageRemoteBinary(c *SyncedCluster, applicationName, binaryPath, SHA, arch string) error

StageRemoteBinary downloads a cockroach edge binary with the provided application path to each specified by the cluster. If no SHA is specified, the latest build of the binary is used instead.

type Cassandra Uses

type Cassandra struct{}

Cassandra TODO(peter): document

func (Cassandra) CertsDir Uses

func (Cassandra) CertsDir(c *SyncedCluster, index int) string

CertsDir implements the ClusterImpl.NodeDir interface.

func (Cassandra) LogDir Uses

func (Cassandra) LogDir(c *SyncedCluster, index int) string

LogDir implements the ClusterImpl.NodeDir interface.

func (Cassandra) NodeDir Uses

func (Cassandra) NodeDir(c *SyncedCluster, index int) string

NodeDir implements the ClusterImpl.NodeDir interface.

func (Cassandra) NodePort Uses

func (Cassandra) NodePort(c *SyncedCluster, index int) int

NodePort implements the ClusterImpl.NodeDir interface.

func (Cassandra) NodeUIPort Uses

func (Cassandra) NodeUIPort(c *SyncedCluster, index int) int

NodeUIPort implements the ClusterImpl.NodeDir interface.

func (Cassandra) NodeURL Uses

func (Cassandra) NodeURL(_ *SyncedCluster, host string, port int) string

NodeURL implements the ClusterImpl.NodeDir interface.

func (Cassandra) Start Uses

func (Cassandra) Start(c *SyncedCluster, extraArgs []string)

Start implements the ClusterImpl.NodeDir interface.

type ClusterImpl Uses

type ClusterImpl interface {
    Start(c *SyncedCluster, extraArgs []string)
    CertsDir(c *SyncedCluster, index int) string
    NodeDir(c *SyncedCluster, index int) string
    LogDir(c *SyncedCluster, index int) string
    NodeURL(c *SyncedCluster, host string, port int) string
    NodePort(c *SyncedCluster, index int) int
    NodeUIPort(c *SyncedCluster, index int) int
}

ClusterImpl TODO(peter): document

type Cockroach Uses

type Cockroach struct{}

Cockroach TODO(peter): document

func (Cockroach) CertsDir Uses

func (Cockroach) CertsDir(c *SyncedCluster, index int) string

CertsDir implements the ClusterImpl.NodeDir interface.

func (Cockroach) LogDir Uses

func (Cockroach) LogDir(c *SyncedCluster, index int) string

LogDir implements the ClusterImpl.NodeDir interface.

func (Cockroach) NodeDir Uses

func (Cockroach) NodeDir(c *SyncedCluster, index int) string

NodeDir implements the ClusterImpl.NodeDir interface.

func (Cockroach) NodePort Uses

func (Cockroach) NodePort(c *SyncedCluster, index int) int

NodePort implements the ClusterImpl.NodeDir interface.

func (Cockroach) NodeUIPort Uses

func (r Cockroach) NodeUIPort(c *SyncedCluster, index int) int

NodeUIPort implements the ClusterImpl.NodeDir interface.

func (Cockroach) NodeURL Uses

func (Cockroach) NodeURL(c *SyncedCluster, host string, port int) string

NodeURL implements the ClusterImpl.NodeDir interface.

func (Cockroach) SQL Uses

func (r Cockroach) SQL(c *SyncedCluster, args []string) error

SQL implements the ClusterImpl.NodeDir interface.

func (Cockroach) Start Uses

func (r Cockroach) Start(c *SyncedCluster, extraArgs []string)

Start implements the ClusterImpl.NodeDir interface.

type NodeMonitorInfo Uses

type NodeMonitorInfo struct {
    // The index of the node (in a SyncedCluster) at which the message originated.
    Index int
    // A message about the node. This is either a PID, "dead", "nc exited", or
    // "skipped".
    // Anything but a PID or "skipped" is an indication that there is some
    // problem with the node and that the process is not running.
    Msg string
    // Err is an error that may occur when trying to probe the status of the node.
    // If Err is non-nil, Msg is empty. After an error is returned, the node with
    // the given index will no longer be probed. Errors typically indicate networking
    // issues or nodes that have (physically) shut down.
    Err error
}

NodeMonitorInfo is a message describing a cockroach process' status.

type SyncedCluster Uses

type SyncedCluster struct {
    // name, vms, users, localities are populated at init time.
    Name       string
    VMs        []string
    Users      []string
    Localities []string
    VPCs       []string
    // all other fields are populated in newCluster.
    Nodes       []int
    Secure      bool
    Env         string
    Args        []string
    Tag         string
    Impl        ClusterImpl
    UseTreeDist bool
    Quiet       bool
    // AuthorizedKeys is used by SetupSSH to add additional authorized keys.
    AuthorizedKeys []byte

    // Used to stash debug information.
    DebugDir string
}

A SyncedCluster is created from the information in the synced hosts file and is used as the target for installing and managing various software components.

TODO(benesch): unify with CloudCluster.

func (*SyncedCluster) DistributeCerts Uses

func (c *SyncedCluster) DistributeCerts()

DistributeCerts will generate and distribute certificates to all of the nodes.

func (*SyncedCluster) Get Uses

func (c *SyncedCluster) Get(src, dest string)

Get TODO(peter): document

func (*SyncedCluster) GetInternalIP Uses

func (c *SyncedCluster) GetInternalIP(index int) (string, error)

GetInternalIP returns the internal IP address of the specified node.

func (*SyncedCluster) IsLocal Uses

func (c *SyncedCluster) IsLocal() bool

IsLocal TODO(peter): document

TODO(tschottdorf): roachprod should cleanly encapsulate the home directory which is currently the biggest culprit for awkward one-offs.

func (*SyncedCluster) Logs Uses

func (c *SyncedCluster) Logs(
    src, dest, user, filter string, interval time.Duration, from, to time.Time, out io.Writer,
) error

Logs will sync the logs from c to dest with each nodes logs under dest in directories per node and stream the merged logs to out. For example, if dest is "tpcc-test.logs" then the logs for each node will be stored like:

tpcc-test.logs/1.logs/...
tpcc-test.logs/2.logs/...
...

Log file syncing uses rsync which attempts to be efficient when deciding which files to update. The logs are merged by calling `cockroach debug merge-logs <dest>/*/*` with the optional flag for filter. The syncing and merging happens in a loop which pauses <interval> between iterations and takes some care with the from/to flags in merge-logs to make new logs appear to be streamed. If <from> is zero streaming begins from now. If to is non-zero, when the stream of logs passes to, the function returns. <user> allows retrieval of logs from a roachprod cluster being run by another user and assumes that the current user used to create c has the ability to sudo into <user>.

func (*SyncedCluster) Monitor Uses

func (c *SyncedCluster) Monitor(ignoreEmptyNodes bool, oneShot bool) chan NodeMonitorInfo

Monitor writes NodeMonitorInfo for the cluster nodes to the returned channel. Infos sent to the channel always have the Index and exactly one of Msg or Err set.

If oneShot is true, infos are retrieved only once for each node and the channel is subsequently closed; otherwise the process continues indefinitely (emitting new information as the status of the cockroach process changes).

If ignoreEmptyNodes is true, nodes on which no CockroachDB data is found (in {store-dir}) will not be probed and single message, "skipped", will be emitted for them.

func (*SyncedCluster) Parallel Uses

func (c *SyncedCluster) Parallel(
    display string, count, concurrency int, fn func(i int) ([]byte, error),
)

Parallel TODO(peter): document

func (*SyncedCluster) Put Uses

func (c *SyncedCluster) Put(src, dest string)

Put TODO(peter): document

func (*SyncedCluster) Run Uses

func (c *SyncedCluster) Run(stdout, stderr io.Writer, nodes []int, title, cmd string) error

Run TODO(peter): document

func (*SyncedCluster) SSH Uses

func (c *SyncedCluster) SSH(sshArgs, args []string) error

SSH TODO(peter): document

func (*SyncedCluster) ServerNodes Uses

func (c *SyncedCluster) ServerNodes() []int

ServerNodes TODO(peter): document

func (*SyncedCluster) SetupSSH Uses

func (c *SyncedCluster) SetupSSH() error

SetupSSH configures the cluster for use with SSH. This is generally run after the cloud.Cluster has been synced which resets the SSH credentials on the machines and sets them up for the current user. This method enables the hosts to talk to eachother and optionally confiures additional keys to be added to the hosts via the c.AuthorizedKeys field. It does so in the following steps:

1. Creates an ssh key pair on the first host to be used on all hosts if
   none exists.
2. Distributes the public key, private key, and authorized_keys file from
   the first host to the others.
3. Merges the data in c.AuthorizedKeys with the existing authorized_keys
   files on all hosts.

This call strives to be idempotent.

func (*SyncedCluster) Start Uses

func (c *SyncedCluster) Start()

Start TODO(peter): document

func (*SyncedCluster) Status Uses

func (c *SyncedCluster) Status()

Status TODO(peter): document

func (*SyncedCluster) Stop Uses

func (c *SyncedCluster) Stop(sig int, wait bool)

Stop TODO(peter): document

func (*SyncedCluster) Wait Uses

func (c *SyncedCluster) Wait() error

Wait TODO(peter): document

func (*SyncedCluster) Wipe Uses

func (c *SyncedCluster) Wipe(preserveCerts bool)

Wipe TODO(peter): document

Package install imports 33 packages (graph) and is imported by 2 packages. Updated 2019-09-14. Refresh now. Tools for package owners.