Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var RootCmd = &cobra.Command{
Use: "farmer",
Short: "farmer enables faster elasticsearch queries for farmer reports",
Long: `farmer enables faster elasticsearch queries for farmer reports.
Initially, you'll grab all past hits from real elasticsearch and store them in
a local database for fast queries later:
farmer backfill -c config.yml
Then you'll set up a cronjob to update the local database with the last day's
hits:
farmer update -c config.yml
Finally, you'll start a server that pretends to be like elasticsearch, and
configure the farmers report R to query this server instead of the real one:
farmer serve -c config.yml
All sub-commands take a config.yml file, which should be in this format:
elastic:
host: "elasticsearch.domain.com"
username: "public"
password: "public"
scheme: "http"
port: 19200
index: "elasticsearchindex-*"
farmer:
host: "localhost"
port: 19201
database_dir: "/path/to/local/database_dir"
file_size: 33554432
buffer_size: 4194304
cache_entries: 128
pool_size: 0
Where file and buffer size are in bytes. file_size determines the desired size
of local database files within database_dir, and buffer_size is the write and
read buffer size when creating/parsing those files. The default values for these
are given in the example above (32MB and 4MB respectively).
cache_entries is the number of query results that will be stored in an in-memory
LRU cache. Defaults to 128.
pool_size is the initial size of a buffer pool used for processing hit data
stored on disk. If you set this higher than the expected number of hits in your
largest query, you'll use a lot of memory, but the first time you run that query
it will be fast.
index will be the index supplied to the real elasticsearch when doing search and
scroll queries.
`,
}
RootCmd represents the base command when called without any subcommands.
Functions ¶
Types ¶
type YAMLConfig ¶
type YAMLConfig struct { Elastic struct { Host string Username string Password string Scheme string Port int Index string } Farmer struct { Host string Port int DatabaseDir string `yaml:"database_dir"` FileSize int `yaml:"file_size"` BufferSize int `yaml:"buffer_size"` CacheEntries int `yaml:"cache_entries"` PoolSize int `yaml:"pool_size"` } }
func ParseConfig ¶
func ParseConfig() *YAMLConfig
func (*YAMLConfig) CacheEntries ¶
func (c *YAMLConfig) CacheEntries() int
func (*YAMLConfig) ElasticURL ¶
func (c *YAMLConfig) ElasticURL() *url.URL
func (*YAMLConfig) FarmerHostPort ¶
func (c *YAMLConfig) FarmerHostPort() string
func (*YAMLConfig) ToDBConfig ¶
func (c *YAMLConfig) ToDBConfig() db.Config
func (*YAMLConfig) ToESConfig ¶
func (c *YAMLConfig) ToESConfig() es.Config
Click to show internal directories.
Click to hide internal directories.