options.go (nsq-1.2.0) | : | options.go (nsq-1.2.1) | ||
---|---|---|---|---|
package main | package main | |||
import ( | import ( | |||
"crypto/tls" | "crypto/tls" | |||
"flag" | "flag" | |||
"fmt" | "fmt" | |||
"strconv" | "strconv" | |||
"strings" | "strings" | |||
"github.com/nsqio/nsq/internal/app" | "github.com/nsqio/nsq/internal/app" | |||
"github.com/nsqio/nsq/internal/lg" | ||||
"github.com/nsqio/nsq/nsqd" | "github.com/nsqio/nsq/nsqd" | |||
) | ) | |||
type tlsRequiredOption int | type tlsRequiredOption int | |||
func (t *tlsRequiredOption) Set(s string) error { | func (t *tlsRequiredOption) Set(s string) error { | |||
s = strings.ToLower(s) | s = strings.ToLower(s) | |||
if s == "tcp-https" { | if s == "tcp-https" { | |||
*t = nsqd.TLSRequiredExceptHTTP | *t = nsqd.TLSRequiredExceptHTTP | |||
return nil | return nil | |||
skipping to change at line 94 | skipping to change at line 95 | |||
newVal := fmt.Sprintf("%v", t.Get()) | newVal := fmt.Sprintf("%v", t.Get()) | |||
if newVal != "0" { | if newVal != "0" { | |||
cfg["tls_min_version"] = newVal | cfg["tls_min_version"] = newVal | |||
} else { | } else { | |||
delete(cfg, "tls_min_version") | delete(cfg, "tls_min_version") | |||
} | } | |||
} else { | } else { | |||
logFatal("failed parsing tls_min_version %+v", v) | logFatal("failed parsing tls_min_version %+v", v) | |||
} | } | |||
} | } | |||
if v, exists := cfg["log_level"]; exists { | ||||
var t lg.LogLevel | ||||
err := t.Set(fmt.Sprintf("%v", v)) | ||||
if err == nil { | ||||
cfg["log_level"] = t | ||||
} else { | ||||
logFatal("failed parsing log_level %+v", v) | ||||
} | ||||
} | ||||
} | } | |||
func nsqdFlagSet(opts *nsqd.Options) *flag.FlagSet { | func nsqdFlagSet(opts *nsqd.Options) *flag.FlagSet { | |||
flagSet := flag.NewFlagSet("nsqd", flag.ExitOnError) | flagSet := flag.NewFlagSet("nsqd", flag.ExitOnError) | |||
// basic options | // basic options | |||
flagSet.Bool("version", false, "print version string") | flagSet.Bool("version", false, "print version string") | |||
flagSet.String("config", "", "path to config file") | flagSet.String("config", "", "path to config file") | |||
logLevel := opts.LogLevel | logLevel := opts.LogLevel | |||
skipping to change at line 115 | skipping to change at line 125 | |||
flagSet.String("log-prefix", "[nsqd] ", "log message prefix") | flagSet.String("log-prefix", "[nsqd] ", "log message prefix") | |||
flagSet.Bool("verbose", false, "[deprecated] has no effect, use --log-lev el") | flagSet.Bool("verbose", false, "[deprecated] has no effect, use --log-lev el") | |||
flagSet.Int64("node-id", opts.ID, "unique part for message IDs, (int) in range [0,1024) (default is hash of hostname)") | flagSet.Int64("node-id", opts.ID, "unique part for message IDs, (int) in range [0,1024) (default is hash of hostname)") | |||
flagSet.Bool("worker-id", false, "[deprecated] use --node-id") | flagSet.Bool("worker-id", false, "[deprecated] use --node-id") | |||
flagSet.String("https-address", opts.HTTPSAddress, "<addr>:<port> to list en on for HTTPS clients") | flagSet.String("https-address", opts.HTTPSAddress, "<addr>:<port> to list en on for HTTPS clients") | |||
flagSet.String("http-address", opts.HTTPAddress, "<addr>:<port> to listen on for HTTP clients") | flagSet.String("http-address", opts.HTTPAddress, "<addr>:<port> to listen on for HTTP clients") | |||
flagSet.String("tcp-address", opts.TCPAddress, "<addr>:<port> to listen o n for TCP clients") | flagSet.String("tcp-address", opts.TCPAddress, "<addr>:<port> to listen o n for TCP clients") | |||
authHTTPAddresses := app.StringArray{} | authHTTPAddresses := app.StringArray{} | |||
flagSet.Var(&authHTTPAddresses, "auth-http-address", "<addr>:<port> to qu ery auth server (may be given multiple times)") | flagSet.Var(&authHTTPAddresses, "auth-http-address", "<addr>:<port> or a full url to query auth server (may be given multiple times)") | |||
flagSet.String("broadcast-address", opts.BroadcastAddress, "address that will be registered with lookupd (defaults to the OS hostname)") | flagSet.String("broadcast-address", opts.BroadcastAddress, "address that will be registered with lookupd (defaults to the OS hostname)") | |||
flagSet.Int("broadcast-tcp-port", opts.BroadcastTCPPort, "TCP port that w | ||||
ill be registered with lookupd (defaults to the TCP port that this nsqd is liste | ||||
ning on)") | ||||
flagSet.Int("broadcast-http-port", opts.BroadcastHTTPPort, "HTTP port tha | ||||
t will be registered with lookupd (defaults to the HTTP port that this nsqd is l | ||||
istening on)") | ||||
lookupdTCPAddrs := app.StringArray{} | lookupdTCPAddrs := app.StringArray{} | |||
flagSet.Var(&lookupdTCPAddrs, "lookupd-tcp-address", "lookupd TCP address (may be given multiple times)") | flagSet.Var(&lookupdTCPAddrs, "lookupd-tcp-address", "lookupd TCP address (may be given multiple times)") | |||
flagSet.Duration("http-client-connect-timeout", opts.HTTPClientConnectTim eout, "timeout for HTTP connect") | flagSet.Duration("http-client-connect-timeout", opts.HTTPClientConnectTim eout, "timeout for HTTP connect") | |||
flagSet.Duration("http-client-request-timeout", opts.HTTPClientRequestTim eout, "timeout for HTTP request") | flagSet.Duration("http-client-request-timeout", opts.HTTPClientRequestTim eout, "timeout for HTTP request") | |||
// diskqueue options | // diskqueue options | |||
flagSet.String("data-path", opts.DataPath, "path to store disk-backed mes sages") | flagSet.String("data-path", opts.DataPath, "path to store disk-backed mes sages") | |||
flagSet.Int64("mem-queue-size", opts.MemQueueSize, "number of messages to keep in memory (per topic/channel)") | flagSet.Int64("mem-queue-size", opts.MemQueueSize, "number of messages to keep in memory (per topic/channel)") | |||
flagSet.Int64("max-bytes-per-file", opts.MaxBytesPerFile, "number of byte s per diskqueue file before rolling") | flagSet.Int64("max-bytes-per-file", opts.MaxBytesPerFile, "number of byte s per diskqueue file before rolling") | |||
flagSet.Int64("sync-every", opts.SyncEvery, "number of messages per diskq ueue fsync") | flagSet.Int64("sync-every", opts.SyncEvery, "number of messages per diskq ueue fsync") | |||
flagSet.Duration("sync-timeout", opts.SyncTimeout, "duration of time per diskqueue fsync") | flagSet.Duration("sync-timeout", opts.SyncTimeout, "duration of time per diskqueue fsync") | |||
flagSet.Int("queue-scan-worker-pool-max", opts.QueueScanWorkerPoolMax, "m | ||||
ax concurrency for checking in-flight and deferred message timeouts") | ||||
flagSet.Int("queue-scan-selection-count", opts.QueueScanSelectionCount, " | ||||
number of channels to check per cycle (every 100ms) for in-flight and deferred t | ||||
imeouts") | ||||
// msg and command options | // msg and command options | |||
flagSet.Duration("msg-timeout", opts.MsgTimeout, "default duration to wai t before auto-requeing a message") | flagSet.Duration("msg-timeout", opts.MsgTimeout, "default duration to wai t before auto-requeing a message") | |||
flagSet.Duration("max-msg-timeout", opts.MaxMsgTimeout, "maximum duration before a message will timeout") | flagSet.Duration("max-msg-timeout", opts.MaxMsgTimeout, "maximum duration before a message will timeout") | |||
flagSet.Int64("max-msg-size", opts.MaxMsgSize, "maximum size of a single message in bytes") | flagSet.Int64("max-msg-size", opts.MaxMsgSize, "maximum size of a single message in bytes") | |||
flagSet.Duration("max-req-timeout", opts.MaxReqTimeout, "maximum requeuin g timeout for a message") | flagSet.Duration("max-req-timeout", opts.MaxReqTimeout, "maximum requeuin g timeout for a message") | |||
flagSet.Int64("max-body-size", opts.MaxBodySize, "maximum size of a singl e command body") | flagSet.Int64("max-body-size", opts.MaxBodySize, "maximum size of a singl e command body") | |||
// client overridable configuration options | // client overridable configuration options | |||
flagSet.Duration("max-heartbeat-interval", opts.MaxHeartbeatInterval, "ma ximum client configurable duration of time between client heartbeats") | flagSet.Duration("max-heartbeat-interval", opts.MaxHeartbeatInterval, "ma ximum client configurable duration of time between client heartbeats") | |||
flagSet.Int64("max-rdy-count", opts.MaxRdyCount, "maximum RDY count for a client") | flagSet.Int64("max-rdy-count", opts.MaxRdyCount, "maximum RDY count for a client") | |||
skipping to change at line 151 | skipping to change at line 166 | |||
flagSet.Duration("min-output-buffer-timeout", opts.MinOutputBufferTimeout , "minimum client configurable duration of time between flushing to a client") | flagSet.Duration("min-output-buffer-timeout", opts.MinOutputBufferTimeout , "minimum client configurable duration of time between flushing to a client") | |||
flagSet.Duration("output-buffer-timeout", opts.OutputBufferTimeout, "defa ult duration of time between flushing data to clients") | flagSet.Duration("output-buffer-timeout", opts.OutputBufferTimeout, "defa ult duration of time between flushing data to clients") | |||
flagSet.Int("max-channel-consumers", opts.MaxChannelConsumers, "maximum c hannel consumer connection count per nsqd instance (default 0, i.e., unlimited)" ) | flagSet.Int("max-channel-consumers", opts.MaxChannelConsumers, "maximum c hannel consumer connection count per nsqd instance (default 0, i.e., unlimited)" ) | |||
// statsd integration options | // statsd integration options | |||
flagSet.String("statsd-address", opts.StatsdAddress, "UDP <addr>:<port> o f a statsd daemon for pushing stats") | flagSet.String("statsd-address", opts.StatsdAddress, "UDP <addr>:<port> o f a statsd daemon for pushing stats") | |||
flagSet.Duration("statsd-interval", opts.StatsdInterval, "duration betwee n pushing to statsd") | flagSet.Duration("statsd-interval", opts.StatsdInterval, "duration betwee n pushing to statsd") | |||
flagSet.Bool("statsd-mem-stats", opts.StatsdMemStats, "toggle sending mem ory and GC stats to statsd") | flagSet.Bool("statsd-mem-stats", opts.StatsdMemStats, "toggle sending mem ory and GC stats to statsd") | |||
flagSet.String("statsd-prefix", opts.StatsdPrefix, "prefix used for keys sent to statsd (%s for host replacement)") | flagSet.String("statsd-prefix", opts.StatsdPrefix, "prefix used for keys sent to statsd (%s for host replacement)") | |||
flagSet.Int("statsd-udp-packet-size", opts.StatsdUDPPacketSize, "the size in bytes of statsd UDP packets") | flagSet.Int("statsd-udp-packet-size", opts.StatsdUDPPacketSize, "the size in bytes of statsd UDP packets") | |||
flagSet.Bool("statsd-exclude-ephemeral", opts.StatsdExcludeEphemeral, "Sk ip ephemeral topics and channels when sending stats to statsd") | ||||
// End to end percentile flags | // End to end percentile flags | |||
e2eProcessingLatencyPercentiles := app.FloatArray{} | e2eProcessingLatencyPercentiles := app.FloatArray{} | |||
flagSet.Var(&e2eProcessingLatencyPercentiles, "e2e-processing-latency-per centile", "message processing time percentiles (as float (0, 1.0]) to track (can be specified multiple times or comma separated '1.0,0.99,0.95', default none)") | flagSet.Var(&e2eProcessingLatencyPercentiles, "e2e-processing-latency-per centile", "message processing time percentiles (as float (0, 1.0]) to track (can be specified multiple times or comma separated '1.0,0.99,0.95', default none)") | |||
flagSet.Duration("e2e-processing-latency-window-time", opts.E2EProcessing LatencyWindowTime, "calculate end to end latency quantiles for this duration of time (ie: 60s would only show quantile calculations from the past 60 seconds)") | flagSet.Duration("e2e-processing-latency-window-time", opts.E2EProcessing LatencyWindowTime, "calculate end to end latency quantiles for this duration of time (ie: 60s would only show quantile calculations from the past 60 seconds)") | |||
// TLS config | // TLS config | |||
flagSet.String("tls-cert", opts.TLSCert, "path to certificate file") | flagSet.String("tls-cert", opts.TLSCert, "path to certificate file") | |||
flagSet.String("tls-key", opts.TLSKey, "path to key file") | flagSet.String("tls-key", opts.TLSKey, "path to key file") | |||
flagSet.String("tls-client-auth-policy", opts.TLSClientAuthPolicy, "clien t certificate auth policy ('require' or 'require-verify')") | flagSet.String("tls-client-auth-policy", opts.TLSClientAuthPolicy, "clien t certificate auth policy ('require' or 'require-verify')") | |||
End of changes. 6 change blocks. | ||||
1 lines changed or deleted | 24 lines changed or added |