run - ActiveState ActiveGo 1.8
...

Package run

import "github.com/influxdata/influxdb/cmd/influxd/run"
Overview
Index

Overview ▾

Package run is the run (default) subcommand for the influxd command.

Constants

const (
    // DefaultBindAddress is the default address for various RPC services.
    DefaultBindAddress = ":8088"
)

type BuildInfo

BuildInfo represents the build details for the server code.

type BuildInfo struct {
    Version string
    Commit  string
    Branch  string
    Time    string
}

type Command

Command represents the command executed by "influxd run".

type Command struct {
    Version   string
    Branch    string
    Commit    string
    BuildTime string

    Closed chan struct{}

    Stdin  io.Reader
    Stdout io.Writer
    Stderr io.Writer
    Logger zap.Logger

    Server *Server
    // contains filtered or unexported fields
}

func NewCommand

func NewCommand() *Command

NewCommand return a new instance of Command.

func (*Command) Close

func (cmd *Command) Close() error

Close shuts down the server.

func (*Command) ParseConfig

func (cmd *Command) ParseConfig(path string) (*Config, error)

ParseConfig parses the config at path. It returns a demo configuration if path is blank.

func (*Command) ParseFlags

func (cmd *Command) ParseFlags(args ...string) (Options, error)

ParseFlags parses the command line flags from args and returns an options set.

func (*Command) Run

func (cmd *Command) Run(args ...string) error

Run parses the config from args and runs the server.

type Config

Config represents the configuration format for the influxd binary.

type Config struct {
    Meta        *meta.Config       `toml:"meta"`
    Data        tsdb.Config        `toml:"data"`
    Coordinator coordinator.Config `toml:"coordinator"`
    Retention   retention.Config   `toml:"retention"`
    Precreator  precreator.Config  `toml:"shard-precreation"`

    Admin          admin.Config      `toml:"admin"`
    Monitor        monitor.Config    `toml:"monitor"`
    Subscriber     subscriber.Config `toml:"subscriber"`
    HTTPD          httpd.Config      `toml:"http"`
    GraphiteInputs []graphite.Config `toml:"graphite"`
    CollectdInputs []collectd.Config `toml:"collectd"`
    OpenTSDBInputs []opentsdb.Config `toml:"opentsdb"`
    UDPInputs      []udp.Config      `toml:"udp"`

    ContinuousQuery continuous_querier.Config `toml:"continuous_queries"`

    // Server reporting
    ReportingDisabled bool `toml:"reporting-disabled"`

    // BindAddress is the address that all TCP services use (Raft, Snapshot, Cluster, etc.)
    BindAddress string `toml:"bind-address"`
}

func NewConfig

func NewConfig() *Config

NewConfig returns an instance of Config with reasonable defaults.

func NewDemoConfig

func NewDemoConfig() (*Config, error)

NewDemoConfig returns the config that runs when no config is specified.

func (*Config) ApplyEnvOverrides

func (c *Config) ApplyEnvOverrides() error

ApplyEnvOverrides apply the environment configuration on top of the config.

func (*Config) FromToml

func (c *Config) FromToml(input string) error

FromToml loads the config from TOML.

func (*Config) FromTomlFile

func (c *Config) FromTomlFile(fpath string) error

FromTomlFile loads the config from a TOML file.

func (*Config) Validate

func (c *Config) Validate() error

Validate returns an error if the config is invalid.

type Options

Options represents the command line options that can be parsed.

type Options struct {
    ConfigPath string
    PIDFile    string
    CPUProfile string
    MemProfile string
}

func (*Options) GetConfigPath

func (opt *Options) GetConfigPath() string

GetConfigPath returns the config path from the options. It will return a path by searching in this order:

1. The CLI option in ConfigPath
2. The environment variable INFLUXDB_CONFIG_PATH
3. The first influxdb.conf file on the path:
     - ~/.influxdb
     - /etc/influxdb

type PrintConfigCommand

PrintConfigCommand represents the command executed by "influxd config".

type PrintConfigCommand struct {
    Stdin  io.Reader
    Stdout io.Writer
    Stderr io.Writer
}

func NewPrintConfigCommand

func NewPrintConfigCommand() *PrintConfigCommand

NewPrintConfigCommand return a new instance of PrintConfigCommand.

func (*PrintConfigCommand) Run

func (cmd *PrintConfigCommand) Run(args ...string) error

Run parses and prints the current config loaded.

type Server

Server represents a container for the metadata and storage data and services. It is built using a Config and it manages the startup and shutdown of all services in the proper order.

type Server struct {
    BindAddress string
    Listener    net.Listener

    Logger zap.Logger

    MetaClient *meta.Client

    TSDBStore     *tsdb.Store
    QueryExecutor *influxql.QueryExecutor
    PointsWriter  *coordinator.PointsWriter
    Subscriber    *subscriber.Service

    Services []Service

    // These references are required for the tcp muxer.
    SnapshotterService *snapshotter.Service

    Monitor *monitor.Monitor

    // Profiling
    CPUProfile string
    MemProfile string
    // contains filtered or unexported fields
}

func NewServer

func NewServer(c *Config, buildInfo *BuildInfo) (*Server, error)

NewServer returns a new instance of Server built from a config.

func (*Server) Close

func (s *Server) Close() error

Close shuts down the meta and data stores and all services.

func (*Server) Err

func (s *Server) Err() <-chan error

Err returns an error channel that multiplexes all out of band errors received from all services.

func (*Server) Open

func (s *Server) Open() error

Open opens the meta and data store and all services.

func (*Server) SetLogOutput

func (s *Server) SetLogOutput(w io.Writer)

SetLogOutput sets the logger used for all messages. It must not be called after the Open method has been called.

func (*Server) Statistics

func (s *Server) Statistics(tags map[string]string) []models.Statistic

Statistics returns statistics for the services running in the Server.

type Service

Service represents a service attached to the server.

type Service interface {
    WithLogger(log zap.Logger)
    Open() error
    Close() error
}