elasticsearch其实就是一个分布式系统,须要知足分布式系统具有的高可用性和可扩展性html
-E cluster.name=geektime
进行设定-E node.name=node1
指定不一样的节点承担了不一样的角色java
节点类型 | 配置参数 | 默认值 |
---|---|---|
master eligible | node.master | true |
data | node.data | true |
ingest | node.ingest | true |
coordinating only | 无 | 每一个节点默认都是coordinate节点。设置其余类型为false |
machine learning | node.ml | true(需设置 enable x-pack) |
主分片,用以解决数据水平扩展的问题。经过主分片,能够将数据分布到集群内的全部节点之上node
副本,用以解决数据高可用的问题,分片是主分片的拷贝git
一个三节点的集群中,blogs
索引的分片分布状况github
一个主分片分散到三个节点上,每一个节点存在一个副本分片json
GET _cluster/health
bash
{
"cluster_name" : "elasticsearch",
"status" : "yellow",
"timed_out" : false,
"number_of_nodes" : 1,
"number_of_data_nodes" : 1,
"active_primary_shards" : 6,
"active_shards" : 6,
"relocating_shards" : 0,
"initializing_shards" : 0,
"unassigned_shards" : 1,
"delayed_unassigned_shards" : 0,
"number_of_pending_tasks" : 0,
"number_of_in_flight_fetch" : 0,
"task_max_waiting_in_queue_millis" : 0,
"active_shards_percent_as_number" : 85.71428571428571
}
复制代码
建议经过github先下载文件(下载地址:github.com/lmenezes/ce…),而后进行安装服务器
tar zxvf cerebro-0.8.4.tgz
cd cerebro-0.8.4
复制代码
启动架构
bin/cerebro
app
访问网址:http://ip:9000
集群中目前只有一个工做节点
get _cat/nodes?v
GET /_nodes/es7_01,es7_02
GET /_cat/nodes?v
GET /_cat/nodes?v&h=id,ip,port,v,m
GET _cluster/health
GET _cluster/health?level=shards
GET /_cluster/health/kibana_sample_data_ecommerce,kibana_sample_data_flights
GET /_cluster/health/kibana_sample_data_flights?level=shards
#### cluster state
The cluster state API allows access to metadata representing the state of the whole cluster. This includes information such as
GET /_cluster/state
#cluster get settings
GET /_cluster/settings
GET /_cluster/settings?include_defaults=true
GET _cat/shards
GET _cat/shards?h=index,shard,prirep,state,unassigned.reason
复制代码