一、windows上安装es6.3.2
1、 安装jdk1.8,版本必须JDK1.8.0_131版本以上
2、解压,启动es:%ES_HOME%\bin\elasticsearch.bat
3、启动报错:
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、浏览器访问http://ip:9200/?pretty
6、kibana解压,启动:%KIBANA_HOME%\bin\kibana.bat
7、kibana浏览器访问:http://ip:5601/
二、windows安装es6集群,两个节点
1、删除%ES_HOME%\data目录,否则报错:with the same id but is a different node instance
2、复制安装包elasticsearch-6.3.2并重命名,现在有两个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 #节点名称,必须不一样
network.host: localhost #必须为本机的ip地址
http.port: 9200 #服务端口号,在同一机器下必须不一样
transport.tcp.port: 9300 #集群间通信端口号,在同一机器下必须不一样
#设置集群自动发现机器ip集合
discovery.zen.ping.unicast.hosts: ["localhost:9300", "localhost:9301"]
xpack.ml.enabled: false
cluster.name: elasticsearch #集群名称,保证唯一
node.name: node02 #节点名称,必须不一样
network.host: localhost #必须为本机的ip地址
http.port: 9201 #服务端口号,在同一机器下必须不一样
transport.tcp.port: 9301 #集群间通信端口号,在同一机器下必须不一样
#设置集群自动发现机器ip集合
discovery.zen.ping.unicast.hosts: ["localhost:9300", "localhost:9301"]
4、先启动node01,成功后,启动node02
5、查看集群状态: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、查看健康状态: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:每个索引的primary shard和replica shard都是active的
yellow:每个索引的primary shard都是active的,但部分的replica shard不是active的
red:不是所有的索引都是primary shard都是active状态的。