MCPcopy
hub / github.com/dgraph-io/dgraph / init

Function init

dgraph/cmd/alpha/run.go:69–280  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

67)
68
69func init() {
70 Alpha.Cmd = &cobra.Command{
71 Use: "alpha",
72 Short: "Run Dgraph Alpha database server",
73 Long: `
74A Dgraph Alpha instance stores the data. Each Dgraph Alpha is responsible for
75storing and serving one data group. If multiple Alphas serve the same group,
76they form a Raft group and provide synchronous replication.
77`,
78 Run: func(cmd *cobra.Command, args []string) {
79 defer x.StartProfile(Alpha.Conf).Stop()
80 run()
81 },
82 Annotations: map[string]string{"group": "core"},
83 }
84 Alpha.EnvPrefix = "DGRAPH_ALPHA"
85 Alpha.Cmd.SetHelpTemplate(x.NonRootTemplate)
86
87 // If you change any of the flags below, you must also update run() to call Alpha.Conf.Get
88 // with the flag name so that the values are picked up by Cobra/Viper's various config inputs
89 // (e.g, config file, env vars, cli flags, etc.)
90 flag := Alpha.Cmd.Flags()
91
92 // common
93 x.FillCommonFlags(flag)
94 // --tls SuperFlag
95 x.RegisterServerTLSFlags(flag)
96 // --encryption and --vault Superflag
97 x.RegisterAclAndEncFlags(flag)
98
99 flag.StringP("postings", "p", "p", "Directory to store posting lists.")
100 flag.String("tmp", "t", "Directory to store temporary buffers.")
101
102 flag.StringP("wal", "w", "w", "Directory to store raft write-ahead logs.")
103 flag.String("export", "export", "Folder in which to store exports.")
104 flag.StringP("zero", "z", fmt.Sprintf("localhost:%d", x.PortZeroGrpc),
105 "Comma separated list of Dgraph Zero addresses of the form IP_ADDRESS:PORT.")
106
107 // Useful for running multiple servers on the same machine.
108 flag.IntP("port_offset", "o", 0,
109 "Value added to all listening port numbers. [Internal=7080, HTTP=8080, Grpc=9080]")
110
111 // Custom plugins.
112 flag.String("custom_tokenizers", "",
113 "Comma separated list of tokenizer plugins for custom indices.")
114
115 flag.Bool("mcp", false, "run MCP server along with alpha.")
116
117 // By default Go GRPC traces all requests.
118 grpc.EnableTracing = false
119
120 flag.String("badger", worker.BadgerDefaults, z.NewSuperFlagHelp(worker.BadgerDefaults).
121 Head("Badger options (Refer to badger documentation for all possible options)").
122 Flag("compression",
123 `[none, zstd:level, snappy] Specifies the compression algorithm and
124 compression level (if applicable) for the postings directory."none" would disable
125 compression, while "zstd:1" would set zstd compression at level 1.`).
126 Flag("numgoroutines",

Callers

nothing calls this directly

Calls 7

StartProfileFunction · 0.92
FillCommonFlagsFunction · 0.92
RegisterServerTLSFlagsFunction · 0.92
RegisterAclAndEncFlagsFunction · 0.92
runFunction · 0.70
StopMethod · 0.65
StringMethod · 0.45

Tested by

no test coverage detected