cluster

package
v0.0.0-...-054c023 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 20, 2014 License: Apache-2.0 Imports: 7 Imported by: 1

Documentation

Overview

Copyright 2013 Matthew Baird Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2013 Matthew Baird Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClusterState

func ClusterState(filter ClusterStateFilter) (api.ClusterStateResponse, error)

func Health

func Health(indices ...string) (api.ClusterHealthResponse, error)

The cluster health API allows to get a very simple status on the health of the cluster. see http://www.elasticsearch.org/guide/reference/api/admin-cluster-health.html TODO: implement wait_for_status, timeout, wait_for_relocating_shards, wait_for_nodes TODO: implement level (Can be one of cluster, indices or shards. Controls the details level of the health information returned. Defaults to cluster.)

func NodesShutdown

func NodesShutdown(delay int, nodes ...string) error

NodesShutdown allows the caller to shutdown between one and all nodes in the cluster delay is a integer representing number of seconds passing "" or "_all" for the nodes parameter will shut down all nodes see http://www.elasticsearch.org/guide/reference/api/admin-cluster-nodes-shutdown/

func Reroute

func Reroute(dryRun bool, commands Commands) (api.ClusterHealthResponse, error)

The cluster health API allows to get a very simple status on the health of the cluster. see http://www.elasticsearch.org/guide/reference/api/admin-cluster-health.html information returned. Defaults to cluster.)

Types

type AllocateCommand

type AllocateCommand struct {
	Index        string `json:"index"`
	Shard        string `json:"shard"`
	Node         string `json:"node"`
	AllowPrimary bool   `json:"allow_primary,omitempty"`
}

type CPU

type CPU struct {
	Vendor           string `json:"vendor,omitempty"`
	Model            string `json:"model,omitempty"`
	Mhz              int    `json:"mhz,omitempty"`
	TotalCores       int    `json:"total_cores,omitempty"`
	TotalSockets     int    `json:"total_sockets,omitempty"`
	CoresPerSocket   int    `json:"cores_per_socket,omitempty"`
	CacheSizeInBytes int    `json:"cache_size_in_bytes,omitempty"`
}

type CancelCommand

type CancelCommand struct {
	Index        string `json:"index"`
	Shard        string `json:"shard"`
	Node         string `json:"node"`
	AllowPrimary bool   `json:"allow_primary,omitempty"`
}

type Cluster

type Cluster struct {
	Name string `json:"name"`
}

type ClusterSettingsResponse

type ClusterSettingsResponse struct {
	Transient  map[string]int `json:"transient"`
	Persistent map[string]int `json:"persistent"`
}

func UpdateSettings

func UpdateSettings(settingType string, key string, value int) (ClusterSettingsResponse, error)

UpdateSettings allows to update cluster wide specific settings. Defaults to Transient setting Settings updated can either be persistent (applied cross restarts) or transient (will not survive a full cluster restart). http://www.elasticsearch.org/guide/reference/api/admin-cluster-update-settings.html

type ClusterStateFilter

type ClusterStateFilter struct {
	FilterNodes        bool
	FilterRoutingTable bool
	FilterMetadata     bool
	FilterBlocks       bool
	FilterIndices      []string
}

func (ClusterStateFilter) Parameterize

func (f ClusterStateFilter) Parameterize() []string

type ClusterStateResponse

type ClusterStateResponse struct {
}

func UpdateSetting

func UpdateSetting(args map[string]interface{}, filter_indices ...string) (ClusterStateResponse, error)

State gets the comprehensive state information for the whole cluster see http://www.elasticsearch.org/guide/reference/api/admin-cluster-state/

type Commands

type Commands struct {
	Commands []interface{} `json:"commands"`
}

type Http

type Http struct {
	BoundAddress   string `json:"bound_address,omitempty"`
	PublishAddress string `json:"publish_address,omitempty"`
}

type Interface

type Interface struct {
	Address    string `json:"address,omitempty"`
	Name       string `json:"name,omitempty"`
	MacAddress string `json:"mac_address,omitempty"`
}

type JVM

type JVM struct {
	Pid          int      `json:"pid,omitempty"`
	Version      string   `json:"version,omitempty"`
	VMName       string   `json:"vm_name,omitempty"`
	VMVersion    string   `json:"vm_version,omitempty"`
	VMVendor     string   `json:"vm_vendor,omitempty"`
	StartTime    int      `json:"start_time,omitempty"`
	Mem          *JvmMem  `json:"mem,omitempty"`
	GcCollectors []string `json:"gc_collectors,omitempty"`
	MemoryPools  []string `json:"memory_pools,omitempty"`
}

type JvmMem

type JvmMem struct {
	HeapInitInBytes    int `json:"heap_init_in_bytes,omitempty"`
	HeapMaxInBytes     int `json:"heap_max_in_bytes,omitempty"`
	NonHeapInitInBytes int `json:"non_heap_init_in_bytes,omitempty"`
	NonHeapMaxInBytes  int `json:"non_heap_max_in_bytes,omitempty"`
	DirectMaxInBytes   int `json:"direct_max_in_bytes,omitempty"`
}

type MEM

type MEM struct {
	TotalInBytes int `json:"total_in_bytes,omitempty"`
}

type MoveCommand

type MoveCommand struct {
	Index    string `json:"index"`
	Shard    string `json:"shard"`
	FromNode string `json:"from_node"`
	ToNode   string `json:"to_node"`
}

type Network

type Network struct {
	RefreshInterval  int        `json:"refresh_interval,omitempty"`
	PrimaryInterface *Interface `json:"primary_interface,omitempty"`
}

type Node

type Node struct {
	Name             string      `json:"name,omitempty"`
	TransportAddress string      `json:"transport_address,omitempty"`
	Host             string      `json:"host,omitempty"`
	Ip               string      `json:"ip,omitempty"`
	Version          string      `json:"version,omitempty"`
	Build            string      `json:"build,omitempty"`
	Hostname         string      `json:"hostname,omitempty"`
	HttpAddress      string      `json:"http_address,omitempty"`
	Settings         *Settings   `json:"settings,omitempty"`
	OS               *OS         `json:"os,omitempty"`
	Process          *Process    `json:"process,omitempty"`
	JVM              *JVM        `json:"jvm,omitempty"`
	ThreadPool       *ThreadPool `json:"thread_pool,omitempty"`
	Network          *Network    `json:"network,omitempty"`
	Transport        *Transport  `json:"transport,omitempty"`
	Http             *Http       `json:"http,omitempty"`
	Plugins          []*Plugin   `json:"plugins,omitempty"`
}

type NodeInfo

type NodeInfo struct {
	ClusterName string          `json:"cluster_name"`
	Nodes       map[string]Node `json:"nodes"` // node name is random string
}

func AllNodesInfo

func AllNodesInfo() (NodeInfo, error)

The cluster nodes info API allows to retrieve one or more (or all) of the cluster nodes information. informatino can be one of jvm, process

func NodesInfo

func NodesInfo(information []string, nodes ...string) (NodeInfo, error)

type NodeStatsFSDataResponse

type NodeStatsFSDataResponse struct {
	Path          string `json:"path"`
	Mount         string `json:"mount"`
	Device        string `json:"dev"`
	Total         int64  `json:"total_in_bytes"`
	Free          int64  `json:"free_in_bytes"`
	Available     int64  `json:"available_in_bytes"`
	DiskReads     int64  `json:"disk_reads"`
	DiskWrites    int64  `json:"disk_writes"`
	DiskReadSize  int64  `json:"disk_read_size_in_bytes"`
	DiskWriteSize int64  `json:"disk_write_size_in_bytes"`
}

type NodeStatsFSResponse

type NodeStatsFSResponse struct {
	Timestamp int64                              `json:"timestamp"`
	Data      map[string]NodeStatsFSDataResponse `json:"data"`
}

type NodeStatsHTTPResponse

type NodeStatsHTTPResponse struct {
	CurrentOpen int64 `json:"current_open"`
	TotalOpen   int64 `json:"total_open"`
}

type NodeStatsIndicesDocsResponse

type NodeStatsIndicesDocsResponse struct {
	Count   int64 `json:"count"`
	Deleted int64 `json:"deleted"`
}

type NodeStatsIndicesGetResponse

type NodeStatsIndicesGetResponse struct {
	Total        int64 `json:"total"`
	Time         int64 `json:"time_in_millis"`
	ExistsTotal  int64 `json:"exists_total"`
	ExistsTime   int64 `json:"exists_time_in_millis"`
	MissingTotal int64 `json:"missing_total"`
	MissingTime  int64 `json:"missing_time_in_millis"`
	Current      int64 `json:"current"`
}

type NodeStatsIndicesIndexingResponse

type NodeStatsIndicesIndexingResponse struct {
	IndexTotal    int64 `json:"index_total"`
	IndexTime     int64 `json:"index_time_in_millis"`
	IndexCurrent  int64 `json:"index_current"`
	DeleteTotal   int64 `json:"delete_total"`
	DeleteTime    int64 `json:"delete_time_in_millis"`
	DeleteCurrent int64 `json:"delete_current"`
}

type NodeStatsIndicesSearchResponse

type NodeStatsIndicesSearchResponse struct {
	OpenContext  int64 `json:"open_contexts"`
	QueryTotal   int64 `json:"query_total"`
	QueryTime    int64 `json:"query_time_in_millis"`
	QueryCurrent int64 `json:"query_current"`
	FetchTotal   int64 `json:"fetch_total"`
	FetchTime    int64 `json:"fetch_time_in_millis"`
	FetchCurrent int64 `json:"fetch_current"`
}

type NodeStatsIndicesStoreResponse

type NodeStatsIndicesStoreResponse struct {
	Size         int64 `json:"size_in_bytes"`
	ThrottleTime int64 `json:"throttle_time_in_millis"`
}

type NodeStatsNetworkResponse

type NodeStatsNetworkResponse struct {
	TCP NodeStatsTCPResponse `json:"tcp"`
}

type NodeStatsNodeResponse

type NodeStatsNodeResponse struct {
	Name             string                                     `json:"name"`
	Timestamp        int64                                      `json:"timestamp"`
	TransportAddress string                                     `json:"transport_address"`
	Hostname         string                                     `json:"hostname"`
	Indices          NodeStatsIndicesResponse                   `json:"indices"`
	OS               NodeStatsOSResponse                        `json:"os"`
	Network          NodeStatsNetworkResponse                   `json:"network"`
	ThreadPool       map[string]NodeStatsThreadPoolPoolResponse `json:"thread_pool"`
}

type NodeStatsOSCPUResponse

type NodeStatsOSCPUResponse struct {
	Sys   int64 `json:"sys"`
	User  int64 `json:"user"`
	Idle  int64 `json:"idle"`
	Steal int64 `json:"stolen"`
}

type NodeStatsOSMemResponse

type NodeStatsOSMemResponse struct {
	Free       int64 `json:"free_in_bytes"`
	Used       int64 `json:"used_in_bytes"`
	ActualFree int64 `json:"actual_free_in_bytes"`
	ActualUsed int64 `json:"actual_used_in_bytes"`
}

type NodeStatsOSResponse

type NodeStatsOSResponse struct {
	Timestamp int64                   `json:"timestamp"`
	Uptime    int64                   `json:"uptime_in_millis"`
	LoadAvg   []float64               `json:"load_average"`
	CPU       NodeStatsOSCPUResponse  `json:"cpu"`
	Mem       NodeStatsOSMemResponse  `json:"mem"`
	Swap      NodeStatsOSSwapResponse `json:"swap"`
}

type NodeStatsOSSwapResponse

type NodeStatsOSSwapResponse struct {
	Used int64 `json:"used_in_bytes"`
	Free int64 `json:"free_in_bytes"`
}

type NodeStatsProcessCPUResponse

type NodeStatsProcessCPUResponse struct {
	Percent int64 `json:"percent"`
	Sys     int64 `json:"sys_in_millis"`
	User    int64 `json:"user_in_millis"`
	Total   int64 `json:"total_in_millis"`
}

type NodeStatsProcessMemResponse

type NodeStatsProcessMemResponse struct {
	Resident     int64 `json:"resident_in_bytes"`
	Share        int64 `json:"share_in_bytes"`
	TotalVirtual int64 `json:"total_virtual_in_bytes"`
}

type NodeStatsProcessResponse

type NodeStatsProcessResponse struct {
	Timestamp int64                       `json:"timestamp"`
	OpenFD    int64                       `json:"open_file_descriptors"`
	CPU       NodeStatsProcessCPUResponse `json:"cpu"`
	Memory    NodeStatsProcessMemResponse `json:"mem"`
}

type NodeStatsReponse

type NodeStatsReponse struct {
	ClusterName string `json:"cluster_name"`
	Nodes       map[string]NodeStatsNodeResponse
}

type NodeStatsTCPResponse

type NodeStatsTCPResponse struct {
	ActiveOpens  int64 `json:"active_opens"`
	PassiveOpens int64 `json:"passive_opens"`
	CurrEstab    int64 `json:"curr_estab"`
	InSegs       int64 `json:"in_segs"`
	OutSegs      int64 `json:"out_segs"`
	RetransSegs  int64 `json:"retrans_segs"`
	EstabResets  int64 `json:"estab_resets"`
	AttemptFails int64 `json:"attempt_fails"`
	InErrs       int64 `json:"in_errs"`
	OutRsts      int64 `json:"out_rsts"`
}

type NodeStatsThreadPoolPoolResponse

type NodeStatsThreadPoolPoolResponse struct {
	Threads   int64 `json:"threads"`
	Queue     int64 `json:"queue"`
	Active    int64 `json:"active"`
	Rejected  int64 `json:"rejected"`
	Largest   int64 `json:"largest"`
	Completed int64 `json:"completed"`
}

type NodeStatsTransportResponse

type NodeStatsTransportResponse struct {
	ServerOpen int64 `json:"server_open"`
	RxCount    int64 `json:"rx_count"`
	RxSize     int64 `json:"rx_size_in_bytes"`
	TxCount    int64 `json:"tx_count"`
	TxSize     int64 `json:"tx_size_in_bytes"`
}

type OS

type OS struct {
	RefreshInterval     int `json:"refresh_interval,omitempty"`
	AvailableProcessors int `json:"available_processors,omitempty"`
}

type Path

type Path struct {
	Logs string `json:"logs,omitempty"`
	// contains filtered or unexported fields
}

type Plugin

type Plugin struct {
	Name        string `json:"name,omitempty"`
	Description string `json:"description,omitempty"`
	Site        bool   `json:"site,omitempty"`
	Jvm         bool   `json:"jvm,omitempty"`
	Url         string `json:"url,omitempty"`
}

type Process

type Process struct {
	RefreshInterval    int  `json:"refresh_interval,omitempty"`
	Id                 int  `json:"id,omitempty"`
	MaxFileDescriptors int  `json:"max_file_descriptors,omitempty"`
	Mlockall           bool `json:"mlockall,omitempty"`
}

type SWAP

type SWAP struct {
	TotalInBytes int `json:"total_in_bytes,omitempty"`
}

type Settings

type Settings struct {
	Path       *Path  `json:"path,omitempty"`
	Foreground string `json:"foreground,omitempty"`
	Name       string `json:"name,omitempty"`
}

type ThreadPool

type ThreadPool struct {
	Generic    *ThreadPoolConfig `json:"generic,omitempty"`
	Index      *ThreadPoolConfig `json:"index,omitempty"`
	Get        *ThreadPoolConfig `json:"get,omitempty"`
	Snapshot   *ThreadPoolConfig `json:"snapshot,omitempty"`
	Merge      *ThreadPoolConfig `json:"merge,omitempty"`
	Suggest    *ThreadPoolConfig `json:"suggest,omitempty"`
	Bulk       *ThreadPoolConfig `json:"bulk,omitempty"`
	Optimize   *ThreadPoolConfig `json:"optimize,omitempty"`
	Warmer     *ThreadPoolConfig `json:"warmer,omitempty"`
	Flush      *ThreadPoolConfig `json:"flush,omitempty"`
	Search     *ThreadPoolConfig `json:"search,omitempty"`
	Percolate  *ThreadPoolConfig `json:"percolate,omitempty"`
	Management *ThreadPoolConfig `json:"management,omitempty"`
	Refresh    *ThreadPoolConfig `json:"refresh,omitempty"`
}

type ThreadPoolConfig

type ThreadPoolConfig struct {
	Type      string `json:"type,omitempty"`
	Min       int    `json:"min,omitempty"`
	Max       int    `json:"max,omitempty"`
	QueueSize string `json:"queue_size,omitempty"`
	KeepAlive string `json:"keep_alive,omitempty"`
}

type Transport

type Transport struct {
	BoundAddress   string `json:"bound_address,omitempty"`
	PublishAddress string `json:"publish_address,omitempty"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL