Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Apr 15, 2025. It is now read-only.
/vulcanizerPublic archive

Add more cmds to cli#99

Merged
hoenn merged 6 commits intomainfromadd-more-cmds-to-cli
Oct 17, 2022
Merged
Changes from1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
PrevPrevious commit
NextNext commit
Add recovery cmd to cli
  • Loading branch information
@hoenn
hoenn committedOct 14, 2022
commit2111da6a37b4df65bfdad84eb1e7cc1beeb1112c
51 changes: 51 additions & 0 deletionspkg/cli/recovery.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
package cli

import (
"fmt"
"os"

"github.com/spf13/cobra"
)

var nodesToCheckRecovery []string

func init() {
cmdShardRecovery.Flags().StringArrayVarP(&nodesToCheckRecovery, "nodes", "n", []string{}, "Elasticsearch nodes to view shard recovery progress (optional, omitted will include all nodes)")
rootCmd.AddCommand(cmdShardRecovery)
}

var cmdShardRecovery = &cobra.Command{
Use: "recovery",
Short: "Display the recovery progress of shards.",
Long: `Show the details regarding shard recovery operations across a set of cluster nodes.`,
Run: func(cmd *cobra.Command, args []string) {
v := getClient()

recovery, err := v.GetShardRecovery(nodesToCheckRecovery, true)

if err != nil {
fmt.Printf("Error getting shard recovery details: %s\n", err)
os.Exit(1)
}
header := []string{"Index", "Shard", "Time", "Source", "Target", "Bytes %", "Est Remaining"}
var rows [][]string

for _, shard := range recovery {
remaining, _ := shard.TimeRemaining()
row := []string{
shard.Index,
shard.Shard,
shard.Time,
shard.SourceNode,
shard.TargetNode,
shard.BytesPercent,
remaining.String(),
}
rows = append(rows, row)
}

table := renderTable(rows, header)

fmt.Println(table)
},
}

[8]ページ先頭

©2009-2025 Movatter.jp