Elasticsearch生态圈
Elasticsearch安装与配置
- 本地部署 &水平扩展
- 安装部署
- 运行Elasticsearch,需要安装并配置JDK,设置JAVA_HOME
- Elasticsearch需要Java 8 以上版本,6.5版本支持JAVA 11,7.0内置了Java环境
- 解压直接运行
文件目录
bin : 脚本文件,包括启动elasticsearch,安装插件。运行统计数据等。
config : 集群配置文件,user,role based相关配置
JDK : Java运行环境
data : path.data 数据文件
lib : Java类库
logs : path.log 日志文件
modules : 包含所有es文件
plugins : 包含所有已安装插件JVM配置
- 修改JVM : config/jvm.options, 7.1 默认为1G
- 配置建议 : 1. Xms与Xmx设置成一眼,2. Xmx 不要超过机器内存50%,3. 不要超过30GB
- 启动运行
- 启动单节点
bin/elasticsearch -E node.name=node0 -E cluster.name=geektime -E path.data=node0_data - 安装插件
bin/elasticsearch-plugin install analysis-icu - 查看插件
bin/elasticsearch-plugin list - 查看安装的插件
GET http://localhost:9200/_cat/plugins?v - start multi-nodes Cluster
bin/elasticsearch -E node.name=node0 -E cluster.name=geektime -E path.data=node0_data
bin/elasticsearch -E node.name=node1 -E cluster.name=geektime -E path.data=node1_data
bin/elasticsearch -E node.name=node2 -E cluster.name=geektime -E path.data=node2_data
bin/elasticsearch -E node.name=node3 -E cluster.name=geektime -E path.data=node3_data - 查看集群
GET http://localhost:9200 - 查看nodes
GET _cat/nodes
GET _cluster/health
- Kibana
- https://www.elastic.co/downloads/kibana
1
2
3
4
5// 启动 kibana
bin/kibana
// 查看插件
bin/kibana-plugin list
Docker容器中部署
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74version: '2.2'
services:
cerebro:
image: lmenezes/cerebro:0.8.3
container_name: cerebro
ports:
- "9000:9000"
command:
- -Dhosts.0.host=http://elasticsearch:9200
networks:
- es72net
kibana:
image: docker.elastic.co/kibana/kibana:7.2.0
container_name: kibana72
environment:
#- I18N_LOCALE=zh-CN
- XPACK_GRAPH_ENABLED=true
- TIMELION_ENABLED=true
- XPACK_MONITORING_COLLECTION_ENABLED="true"
ports:
- "5601:5601"
networks:
- es72net
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:7.2.0
container_name: es72_01
environment:
- cluster.name=geektime
- node.name=es72_01
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
- discovery.seed_hosts=es72_01,es72_02
- network.publish_host=elasticsearch
- cluster.initial_master_nodes=es72_01,es72_02
ulimits:
memlock:
soft: -1
hard: -1
volumes:
- es72data1:/usr/share/elasticsearch/data
ports:
- 9200:9200
networks:
- es72net
elasticsearch2:
image: docker.elastic.co/elasticsearch/elasticsearch:7.2.0
container_name: es72_02
environment:
- cluster.name=geektime
- node.name=es72_02
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
- discovery.seed_hosts=es72_01,es72_02
- network.publish_host=elasticsearch
- cluster.initial_master_nodes=es72_01,es72_02
ulimits:
memlock:
soft: -1
hard: -1
volumes:
- es72data2:/usr/share/elasticsearch/data
networks:
- es72net
volumes:
es72data1:
driver: local
es72data2:
driver: local
networks:
es72net:
driver: bridgelogstash
1
2#启动Elasticsearch实例,然后启动 logstash,并制定配置文件导入数据
bin/logstash -f /YOUR_PATH_of_logstash.conf