Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(cmd/influxd): add nats-max-payload-bytes config option to influxd #20564

Merged
merged 2 commits into from
Jan 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ Replacement `tsi1` indexes will be automatically generated on startup for shards
1. [20473](https://github.com/influxdata/influxdb/pull/20473): Add `--overwrite-existing-v2` flag to `influxd upgrade` to overwrite existing files at output paths (instead of aborting).
1. [20524](https://github.com/influxdata/influxdb/pull/20524): Add `influxd print-config` command to support automated config inspection.
1. [20561](https://github.com/influxdata/influxdb/pull/20561): Add `nats-port` config option for `influxd` server.
1. [20564](https://github.com/influxdata/influxdb/pull/20564): Add `nats-max-payload-bytes` config option for `influxd` server.

### Bug Fixes

Expand Down
13 changes: 11 additions & 2 deletions cmd/influxd/launcher/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
"github.com/influxdata/influxdb/v2/storage"
"github.com/influxdata/influxdb/v2/v1/coordinator"
"github.com/influxdata/influxdb/v2/vault"
natsserver "github.com/nats-io/gnatsd/server"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

heads up that this is still v1 of the server for v2, this would be needed:

"github.com/nats-io/nats-server/v2/server"

(it is backwards compatible as well)

"github.com/spf13/cobra"
"github.com/spf13/viper"
"go.uber.org/zap/zapcore"
Expand Down Expand Up @@ -128,7 +129,8 @@ type InfluxdOpts struct {
SessionLength int // in minutes
SessionRenewDisabled bool

NatsPort int
NatsPort int
NatsMaxPayloadBytes int

NoTasks bool
FeatureFlags map[string]string
Expand Down Expand Up @@ -174,7 +176,8 @@ func newOpts(viper *viper.Viper) *InfluxdOpts {
StoreType: BoltStore,
SecretStore: BoltStore,

NatsPort: nats.RandomPort,
NatsPort: nats.RandomPort,
NatsMaxPayloadBytes: natsserver.MAX_PAYLOAD_SIZE,

NoTasks: false,

Expand Down Expand Up @@ -485,5 +488,11 @@ func (o *InfluxdOpts) bindCliOpts() []cli.Opt {
Desc: fmt.Sprintf("Port that should be bound by the NATS streaming server. A value of %d will cause a random port to be selected.", nats.RandomPort),
Default: o.NatsPort,
},
{
DestP: &o.NatsMaxPayloadBytes,
Flag: "nats-max-payload-bytes",
Desc: "The maximum number of bytes allowed in a NATS message payload.",
Default: o.NatsMaxPayloadBytes,
},
}
}
1 change: 1 addition & 0 deletions cmd/influxd/launcher/launcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -573,6 +573,7 @@ func (m *Launcher) run(ctx context.Context, opts *InfluxdOpts) (err error) {
// NATS streaming server
natsOpts := nats.NewDefaultServerOptions()
natsOpts.Port = opts.NatsPort
natsOpts.MaxPayload = opts.NatsMaxPayloadBytes
m.natsServer = nats.NewServer(&natsOpts)
if err := m.natsServer.Open(); err != nil {
m.log.Error("Failed to start nats streaming server", zap.Error(err))
Expand Down