Installation
参考文档:
https://www.elastic.co/guide/index.html
https://www.elastic.co/guide/en/elasticsearch/reference/current/index.html
https://www.elastic.co/guide/en/elasticsearch/reference/current/_installation.html#_installation
https://www.elastic.co/guide/en/elasticsearch/reference/6.1/zip-targz.html
准备:
Elasticsearch requires at least Java 8. Specifically as of this writing, it is recommended that you use the Oracle JDK version 1.8.0_131.
java -version
echo $JAVA_HOME
部署系统:Linux(CentOS)
去官方网站下载 https://www.elastic.co
例如:https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.1.2.tar.gz
解压:
tar -xvf elasticsearch-6.1.2.tar.gz
前台启动:./bin/elasticsearch
后台启动:./bin/elasticsearch -d -p ./bin/pid
启动报错:
[2018-01-30T03:51:53,031][ERROR][o.e.b.Bootstrap ] [esnode03] node validation exception
[1] bootstrap checks failed
[1]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
解决方案:进行系统参数优化
这可以临时设置:sysctl -w vm.max_map_count=655350
或者在/etc/sysctl.conf下永久设置vm.max_map_count。
vm.max_map_count=655350直接写到/etc/sysctl.conf中,然后执行sysctl -p
查看设置
cat /proc/sys/vm/max_map_count
或者执行下面的脚本:
|
关于系统参数设置,官方文档有详细说明:
https://www.elastic.co/guide/en/elasticsearch/reference/6.1/setting-system-settings.html
https://www.elastic.co/guide/en/elasticsearch/reference/6.1/max-number-of-threads.html
集群配置
配置示例如下:
|
不懂的配置,比如minimum_master_nodes,可以参考官方说明,或者百度:
https://www.elastic.co/guide/en/elasticsearch/reference/6.1/important-settings.html
测试
查看节点状态:
curl -XGET 'http://192.168.11.242:9200/_cat/nodes?pretty'
|
查询更多支持的命令:
curl -XGET 'http://192.168.11.242:9200/_cat?pretty'
|
查看集群状态;
curl -XGET http://192.168.11.242:9200/_cluster/health?pretty
API文档参见:
https://www.elastic.co/guide/en/elasticsearch/reference/6.1/cat-health.html
https://www.elastic.co/guide/en/elasticsearch/reference/6.1/cluster-health.html
关闭
jps获取进程pid,然后kill -SIGTERM pid
性能测试
官方提供了测试工具和测试方法:
https://www.elastic.co/guide/en/elasticsearch/reference/6.1/testing-framework.html
生产部署,优化建议
参见:http://blog.csdn.net/thomas0yang/article/details/55518105
集群原理:http://blog.csdn.net/zwgdft/article/details/54585644
安装 elasticsearch Head 插件,方便查看es里面的数据
参见:https://www.cnblogs.com/aubin/p/8018081.html
官方地址:https://github.com/mobz/elasticsearch-head
注意配置:
vim elasticsearch.yml
|