一、windows上安裝es6.3.2
1、 安裝jdk1.8,版本必須JDK1.8.0_131版本以上
2、解壓,啟動(dòng)es:%ES_HOME%\bin\elasticsearch.bat
3、啟動(dòng)報(bào)錯(cuò):
ElasticsearchException[X-Pack is not supported and Machine Learning is not available for [windows-x86]; you can use the other X-Pack features (unsupported) by setting xpack.ml.enabled: false in elasticsearch.yml]
4、修改%ES_HOME%\config\elasticsearch.yml,文件最后增加一行
xpack.ml.enabled: false
5、瀏覽器訪問(wèn)http://ip:9200/?pretty
6、kibana解壓,啟動(dòng):%KIBANA_HOME%\bin\kibana.bat
7、kibana瀏覽器訪問(wèn):http://ip:5601/
二、windows安裝es6集群,兩個(gè)節(jié)點(diǎn)
1、刪除%ES_HOME%\data目錄,否則報(bào)錯(cuò):with the same id but is a different node instance
2、復(fù)制安裝包elasticsearch-6.3.2并重命名,現(xiàn)在有兩個(gè)elasticsearch-6.3.2-01和elasticsearch-6.3.2-02
3、elasticsearch-6.3.2-01\config\elasticsearch.yml 和 elasticsearch-6.3.2-02\config\elasticsearch.yml
xpack.ml.enabled: false
cluster.name: elasticsearch #集群名稱,保證唯一
node.name: node01 #節(jié)點(diǎn)名稱,必須不一樣
network.host: localhost #必須為本機(jī)的ip地址
http.port: 9200 #服務(wù)端口號(hào),在同一機(jī)器下必須不一樣
transport.tcp.port: 9300 #集群間通信端口號(hào),在同一機(jī)器下必須不一樣
#設(shè)置集群自動(dòng)發(fā)現(xiàn)機(jī)器ip集合
discovery.zen.ping.unicast.hosts: ["localhost:9300", "localhost:9301"]
xpack.ml.enabled: false
cluster.name: elasticsearch #集群名稱,保證唯一
node.name: node02 #節(jié)點(diǎn)名稱,必須不一樣
network.host: localhost #必須為本機(jī)的ip地址
http.port: 9201 #服務(wù)端口號(hào),在同一機(jī)器下必須不一樣
transport.tcp.port: 9301 #集群間通信端口號(hào),在同一機(jī)器下必須不一樣
#設(shè)置集群自動(dòng)發(fā)現(xiàn)機(jī)器ip集合
discovery.zen.ping.unicast.hosts: ["localhost:9300", "localhost:9301"]
4、先啟動(dòng)node01,成功后,啟動(dòng)node02
5、查看集群狀態(tài):GET _cluster/health
{
"cluster_name": "elasticsearch",
"status": "green",
"timed_out": false,
"number_of_nodes": 2,
"number_of_data_nodes": 2,
"active_primary_shards": 0,
"active_shards": 0,
"relocating_shards": 0,
"initializing_shards": 0,
"unassigned_shards": 0,
"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": 100
}
6、查看健康狀態(tài):GET _cat/health?v
epoch timestamp cluster status node.total node.data shards pri relo init unassign pending_tasks max_task_wait_time active_shards_percent
1534990228 10:10:28 elasticsearch green 2 2 0 0 0 0 0 0 - 100.0%
status:green、yellow、red
green:每個(gè)索引的primary shard和replica shard都是active的
yellow:每個(gè)索引的primary shard都是active的,但部分的replica shard不是active的
red:不是所有的索引都是primary shard都是active狀態(tài)的。