vitessio/vitess · error

cannot perform backup without my.cnf, please restart vttable

Error message

cannot perform backup without my.cnf, please restart vttablet with a my.cnf file specified

What it means

The Backup RPC on TabletManager requires a parsed my.cnf file (tm.Cnf) to locate mysql directories and run mysqlbackup-compatible backups. This tablet was started without a my.cnf file, so backups cannot be performed.

Source

Thrown at go/vt/vttablet/tabletmanager/rpc_backup.go:48

	"vitess.io/vitess/go/vt/logutil"
	"vitess.io/vitess/go/vt/mysqlctl"
	"vitess.io/vitess/go/vt/mysqlctl/backupstats"
	"vitess.io/vitess/go/vt/topo/topoproto"
	"vitess.io/vitess/go/vt/vterrors"

	tabletmanagerdatapb "vitess.io/vitess/go/vt/proto/tabletmanagerdata"
	topodatapb "vitess.io/vitess/go/vt/proto/topodata"
)

const (
	backupModeOnline  = "online"
	backupModeOffline = "offline"
)

// Backup takes a db backup and sends it to the BackupStorage.
func (tm *TabletManager) Backup(ctx context.Context, logger logutil.Logger, req *tabletmanagerdatapb.BackupRequest) error {
	if tm.Cnf == nil {
		return errors.New("cannot perform backup without my.cnf, please restart vttablet with a my.cnf file specified")
	}

	// Check tablet type current process has.
	// During a network partition it is possible that from the topology perspective this is no longer the primary,
	// but the process didn't find out about this.
	// It is not safe to take backups from tablet in this state
	currentTablet := tm.Tablet()
	if !req.AllowPrimary && currentTablet.Type == topodatapb.TabletType_PRIMARY {
		return errors.New("type PRIMARY cannot take backup. if you really need to do this, rerun the backup command with --allow-primary")
	}

	backupEngine := ""
	if req.BackupEngine != nil {
		backupEngine = *req.BackupEngine
	}

	engine, err := mysqlctl.GetBackupEngine(backupEngine)
	if err != nil {

View on GitHub (pinned to 01a25a7d17)

Solutions

  1. Restart vttablet with --mycnf-file pointing to a valid my.cnf
  2. Verify the my.cnf path is accessible in the container/VM and parses successfully
  3. Use a backup method that does not require my.cnf only if your backup engine supports it

Example fix

// before
vttablet -port=15001 ...   # no my.cnf
// after
vttablet -port=15001 -mycnf-file=/vt/vtctld/my.cnf ...
Defensive patterns

Strategy: validation

Validate before calling

if tabletProcessStartedWithoutMycnf() { // e.g. no -mycnf-file
    skipBackup(tabletAlias) // backups impossible on this tablet
}

Try / catch

err := tm.Backup(ctx, logger, req)
if err != nil && strings.Contains(err.Error(), "without my.cnf") {
    return fmt.Errorf("tablet %s not configured for backups; set --mycnf-file", alias)
}

Prevention

When it happens

Trigger: Calling Backup (via vtctldclient Backup or an automated backup job) against a vttablet process launched without --mycnf-file or with a path that failed to load, leaving tm.Cnf nil.

Common situations: Tablets started for pure query serving without backup configuration; missing or misconfigured --mycnf-server-variables/--mycnf-file paths; containers running vttablet without the mysql config mounted.

Related errors


AI-assisted analysis of vitessio/vitess@01a25a7d17 (2026-09-01). Data as JSON: /api/errors/931988c9fbd58f0f. Report an issue: GitHub.