合集-ElasticSearch
摘要:参照Installing Elasticsearch,完成验证集群的部署。 操作步骤 下载软件包和摘要文件。 wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-8.11.1-linux-x86_64.tar
阅读全文
摘要:参考Cluster get settings API。 命令样例,不指定参数,如下: curl -X GET "https://localhost:9200/_cluster/settings?pretty" --cacert $ES_HOME/config/certs/http_ca.crt -u
阅读全文
摘要:参考Cluster health API。 命令样例,如下: curl -X GET "https://localhost:9200/_cluster/health?wait_for_status=yellow&timeout=50s&pretty" --cacert $ES_HOME/config
阅读全文
摘要:ElasticSearch默认情况下使用Log4j2来记录日志,日志配置文件的路径为$ES_HOME/config/log4j2.properties,配置方法见Log4j2的官方文档。 参考path-settings,通过指定path.logs,可以指定日志文件的保存路径。 在日志配置文件$ES_
阅读全文
摘要:执行aliases命令,如下: curl -X GET "https://localhost:9200/_cat/aliases?pretty&v=true" --cacert $ES_HOME/config/certs/http_ca.crt -u "elastic:ohCxPH=QBE+s5=*
阅读全文
摘要:查看当前集群全部健康指标的信息,执行如下命令: curl -X GET "https://localhost:9200/_health_report?pretty" --cacert $ES_HOME/config/certs/http_ca.crt -u "elastic:ohCxPH=QBE+s
阅读全文
摘要:查看当前集群中各节点的信息,执行如下命令: curl -X GET "https://localhost:9200/_nodes?pretty" --cacert $ES_HOME/config/certs/http_ca.crt -u "elastic:ohCxPH=QBE+s5=*lo7F9"
阅读全文
摘要:ElasticSearch之系统关键配置 集群名称 在配置文件$ES_HOME/config/elasticsearch.yml中指定,样例如下: cluster: name: logging-prod 或者 cluster.name: logging-prod 节点的名称 在配置文件$ES_HOM
阅读全文
摘要:查看各节点上各个shard的硬件使用情况,命令样例如下: curl -X GET "https://localhost:9200/_cat/allocation?v=true&pretty" --cacert $ES_HOME/config/certs/http_ca.crt -u "elastic
阅读全文
摘要:curl -X GET "https://localhost:9200/_cat/ml/anomaly_detectors?v=true&pretty" --cacert $ES_HOME/config/certs/http_ca.crt -u "elastic:ohCxPH=QBE+s5=*lo7
阅读全文
摘要:命令样例如下: curl -X GET "https://localhost:9200/_cat/component_templates?v=true&pretty" --cacert $ES_HOME/config/certs/http_ca.crt -u "elastic:ohCxPH=QBE+
阅读全文
摘要:ElasticSearch主要的配置文件,如下: elasticsearch.yml,ElasticSearch的相关参数。 jvm.options,JVM的相关参数。 log4j2.properties,日志的相关参数。 默认情况下,ElasticSearch从$ES_HOME/config目录下
阅读全文
摘要:读取当前存储的记录的数量。 命令样例如下: curl -X GET "https://localhost:9200/_cat/count?v=true&pretty" --cacert $ES_HOME/config/certs/http_ca.crt -u "elastic:ohCxPH=QBE+
阅读全文
摘要:命令样例如下: curl -X GET "https://localhost:9200/_cat/ml/data_frame/analytics?v=true&pretty" --cacert $ES_HOME/config/certs/http_ca.crt -u "elastic:ohCxPH=
阅读全文
摘要:操作系统将进程加载至内存中执行时,对于当前未使用到的内存页,可能会将相关内存页交换至硬盘上,即swap。 对于性能敏感、时延敏感的应用程序比如ElasticSearch,swap特性会明显影响性能和稳定性,因此最好禁用swap特性。 对于Linux环境,目前有如下手段可以禁用swap特性。 临时关闭
阅读全文
摘要:查看当前Linux系统中vm.max_map_count变量的值,命令如下: sysctl vm.max_map_count 执行结果的样例,如下: vm.max_map_count = 65530 修改参数vm.max_map_count的值,命令如下 sysctl -w vm.max_map_c
阅读全文
摘要:ElasticSearch在运行过程中,涉及大量文件的打开、关闭、读、写等操作。因此当ElasticSearch进程的文件描述符数量不足时可能导致丢失数据等故障现象。 因此为保障ElasticSearch正常运行,需保证ElasticSearch可以使用至少65535个文件描述符。 查看Linux系
阅读全文
摘要:ElasticSearch在运行过程中,涉及多种线程池、线程的使用,因此而需要给予足够的线程资源,保证ElasticSearch在需要时可以正常创建出线程。 查看Linux系统当前用户允许创建的线程的数量,命令如下: ulimit -a 执行结果的样例,如下: core file size (blo
阅读全文
摘要:命令样例如下: curl -X GET "https://localhost:9200/_cat/ml/datafeeds?v=true&pretty" --cacert $ES_HOME/config/certs/http_ca.crt -u "elastic:ohCxPH=QBE+s5=*lo7
阅读全文
摘要:命令样例如下: curl -X GET "https://localhost:9200/_cat/fielddata?v=true&pretty" --cacert $ES_HOME/config/certs/http_ca.crt -u "elastic:ohCxPH=QBE+s5=*lo7F9"
阅读全文
摘要:命令样例如下: curl -X GET "https://localhost:9200/_cat/health?v=true&pretty" --cacert $ES_HOME/config/certs/http_ca.crt -u "elastic:ohCxPH=QBE+s5=*lo7F9" 执行
阅读全文
摘要:命令样例如下: curl -X GET "https://localhost:9200/_cat/indices?v=true&pretty" --cacert $ES_HOME/config/certs/http_ca.crt -u "elastic:ohCxPH=QBE+s5=*lo7F9" 执
阅读全文
摘要:命令样例如下: curl -X GET "https://localhost:9200/_cat/master?v=true&pretty" --cacert $ES_HOME/config/certs/http_ca.crt -u "elastic:ohCxPH=QBE+s5=*lo7F9" 执行
阅读全文
摘要:命令样例如下: curl -X GET "https://localhost:9200/_cat/nodeattrs?v=true&pretty" --cacert $ES_HOME/config/certs/http_ca.crt -u "elastic:ohCxPH=QBE+s5=*lo7F9"
阅读全文
摘要:ElasticSearch节点可用的CPU核的数量,通常可以交给ElasticSearch来自行检测和判定,另外可以在``elasticsearch.yml`中显式指定。样例如下: node.processors: 2 如下表格中的processors即CPU核的数量。 线程池的列表 线程池名称 类
阅读全文
摘要:命令样例如下: curl -X GET "https://localhost:9200/_cat/nodes?v=true&pretty" --cacert $ES_HOME/config/certs/http_ca.crt -u "elastic:ohCxPH=QBE+s5=*lo7F9" 执行结
阅读全文
摘要:命令样例如下: curl -X GET "https://localhost:9200/_cat/pending_tasks?v=true&pretty" --cacert $ES_HOME/config/certs/http_ca.crt -u "elastic:ohCxPH=QBE+s5=*lo
阅读全文
摘要:命令样例如下: curl -X GET "https://localhost:9200/_cat/plugins?v=true&pretty" --cacert $ES_HOME/config/certs/http_ca.crt -u "elastic:ohCxPH=QBE+s5=*lo7F9" 执
阅读全文
摘要:命令样例如下: curl -X GET "https://localhost:9200/_cat/recovery?v=true&pretty" --cacert $ES_HOME/config/certs/http_ca.crt -u "elastic:ohCxPH=QBE+s5=*lo7F9"
阅读全文
摘要:命令样例如下: curl -X GET "https://localhost:9200/_cat/repositories?v=true&pretty" --cacert $ES_HOME/config/certs/http_ca.crt -u "elastic:ohCxPH=QBE+s5=*lo7
阅读全文
摘要:命令样例如下: curl -X GET "https://localhost:9200/_cat/segments?v=true&pretty" --cacert $ES_HOME/config/certs/http_ca.crt -u "elastic:ohCxPH=QBE+s5=*lo7F9"
阅读全文
摘要:命令样例如下: curl -X GET "https://localhost:9200/_cat/shards?v=true&pretty" --cacert $ES_HOME/config/certs/http_ca.crt -u "elastic:ohCxPH=QBE+s5=*lo7F9" 执行
阅读全文
摘要:命令样例如下: curl -X GET "https://localhost:9200/_cat/tasks?v=true&pretty" --cacert $ES_HOME/config/certs/http_ca.crt -u "elastic:ohCxPH=QBE+s5=*lo7F9" 执行结
阅读全文
摘要:命令样例如下: curl -X GET "https://localhost:9200/_cat/templates?v=true&pretty" --cacert $ES_HOME/config/certs/http_ca.crt -u "elastic:ohCxPH=QBE+s5=*lo7F9"
阅读全文
摘要:命令样例如下: curl -X GET "https://localhost:9200/_cat/thread_pool?v=true&pretty" --cacert $ES_HOME/config/certs/http_ca.crt -u "elastic:ohCxPH=QBE+s5=*lo7F
阅读全文
摘要:相关参数 indices.query.bool.max_clause_count 本参数当前已失效。 search.max_buckets 本参数用于控制在单个响应中返回的聚合的桶的数量。 默认值为65536。 本参数允许在elasticsearch.yml中配置,配置样例如下: search.ma
阅读全文
摘要:命令样例如下: curl -X GET "https://localhost:9200/_cat/ml/trained_models?v=true&pretty" --cacert $ES_HOME/config/certs/http_ca.crt -u "elastic:ohCxPH=QBE+s5
阅读全文
摘要:命令样例如下: curl -X GET "https://localhost:9200/_cat/transforms?v=true&format=json" --cacert $ES_HOME/config/certs/http_ca.crt -u "elastic:ohCxPH=QBE+s5=*
阅读全文
摘要:Elasticsearch的shard,即对应Lucene的index。 Lucene的index由多个segment组成。 segment是index保存数据的最小单位,不支持修改。 Elasticsearch在运行过程中,启动后台任务,周期性检测并将占用空间小的segment自动合并至大一些的s
阅读全文
摘要:使用本方法,可以触发强制合并操作。 默认情况下,ElasticSearch会在后台周期性触发合并操作,因此不需要用户刻意使用本方法。 使用强制合并的弊端: 可能会产生大于5G的segment对象,而ElasticSearch后台自动触发的合并操作会跳过此类大型segment对象。 假如定期执行强制合
阅读全文
摘要:命令样例如下: curl -X GET "https://localhost:9200/_tasks?pretty" --cacert $ES_HOME/config/certs/http_ca.crt -u "elastic:ohCxPH=QBE+s5=*lo7F9" 执行结果的样例,如下: {
阅读全文
摘要:ElasticSearch的慢日志,相关的参数及配置方法。 在log4j2.properties中配置慢日志的输出文件名。 Search Slow Log 相关参数 index.search.slowlog.threshold.query.warn index.search.slowlog.thre
阅读全文
摘要:本API用于分析、统计指定index当前占用的存储空间。 考虑到本特性目前仍然处于预览状态,因此使用方法、参数等可能会发生变化,或者未来也许会被删除。 本API暂时不建议在生产系统中使用。 命令样例如下: curl -X POST "https://localhost:9200/testindex_
阅读全文
摘要:本方法用于清理缓存。 命令样例如下: curl -X POST "https://localhost:9200/testindex_001/_cache/clear?pretty" --cacert $ES_HOME/config/certs/http_ca.crt -u "elastic:ohCx
阅读全文
摘要:创建指定名称的index。 命令样例如下: curl -X PUT "https://localhost:9200/testindex_002?pretty" -H 'Content-Type: application/json' -d' { "settings": { "index": { "nu
阅读全文
摘要:使用已有的索引,复制得到一个索引。 关闭testindex_001的写入操作,命令样例如下: curl -X PUT "https://localhost:9200/testindex_001/_settings?pretty" -H 'Content-Type: application/json'
阅读全文
摘要:关闭指定的索引。 索引关闭之后: 停止对读、写操作的响应。 停止检索操作的响应。 在索引关闭前,允许执行的操作,关闭之后均不允许执行。 ElasticSearch取消对索引的相关维护操作,包含内存中的数据结构,以及保存在存储中的数据。 占用的存储空间,并不会主动释放。ElasticSearch不会删
阅读全文
摘要:打开指定的索引。 命令样例如下: curl -X POST "https://localhost:9200/testindex_003/_open?pretty" --cacert $ES_HOME/config/certs/http_ca.crt -u "elastic:ohCxPH=QBE+s5
阅读全文
摘要:删除指定的索引。 同时删除索引关联的数据、分片、元数据等相关的资源,因此执行前需要慎重。 命令样例如下: curl -X DELETE "https://localhost:9200/testindex_003?pretty" --cacert $ES_HOME/config/certs/http_
阅读全文
摘要:检查指定名称的索引是否存在。 命令样例如下: curl -I "https://localhost:9200/testindex_002?pretty" --cacert $ES_HOME/config/certs/http_ca.crt -u "elastic:ohCxPH=QBE+s5=*lo7
阅读全文
摘要:获取指定索引的基本信息。 命令样例如下: curl -X GET "https://localhost:9200/testindex_001?pretty" --cacert $ES_HOME/config/certs/http_ca.crt -u "elastic:ohCxPH=QBE+s5=*l
阅读全文
摘要:获取指定索引的参数的值。 获取指定索引的全部参数,命令样例如下: curl -X GET "https://localhost:9200/testindex_002/_settings?pretty" --cacert $ES_HOME/config/certs/http_ca.crt -u "el
阅读全文
摘要:获取指定索引的统计数据。 获取指定索引的全部统计数据,命令样例如下: curl -X GET "https://localhost:9200/testindex_001/_stats?pretty" --cacert $ES_HOME/config/certs/http_ca.crt -u "ela
阅读全文
摘要:使用本方法,显式的执行refresh操作。 默认情况下,ElasticSearch启动后台任务,周期性执行refresh操作,周期使用参数index.refresh_interval控制。 本方法触发的refresh为同步操作,运行完毕之后才会返回任务的执行结果。 指定索引,执行refresh操作。
阅读全文
摘要:对于查询操作,Elasticsearch提供了缓存特性来暂存结果。 对于相同条件的查询请求,在缓存中的数据失效前,响应后续的查询操作时可以直接从缓存中提取结果,有效降低检索操作的时延,提升检索数据时的体验。 提到缓存相关的特性,即要关注如下几点: 缓存的开关 缓存中的数据哪里来 缓存占用的空间 缓存
阅读全文
摘要:对于filter查询,ElasticSearch提供了缓存查询结果的特性,当缓存中存在满足查询条件要求的数据时,直接从缓存中提取查询结果。 对于ElasticSearch节点,该节点上的所有shard共享同一个缓存区域。 ElasticSearch基于LRU算法来管理缓存中的数据,当空间不足以承载最
阅读全文
摘要:索引的参数,分为两类: 静态参数,仅支持在创建索引时指定,或者关闭索引后指定。 动态参数,允许在索引工作期间指定或者修改。 静态参数 index.number_of_shards 默认值为1。 本参数用于控制主分片的数量,仅支持在创建时指定,对于已关闭的索引,修改本参数不会生效。 es.index.
阅读全文
摘要:对官方文档Node的阅读笔记。 ES集群由一个或者多个ES节点组成。 ES集群中的节点,支持处理两类通信平面,见文档 集群内节点之间的通信,官方文档称之为transport layer。 集群外的通信,处理客户端下发的请求,比如数据的CRUD,检索等,官方文档称之为HTTP layer。 通过集群内
阅读全文
摘要:对官方文档Networking的阅读笔记。 ES集群中的节点,支持处理两类通信平面 集群内节点之间的通信,官方文档称之为transport layer。 集群外的通信,处理客户端下发的请求,比如数据的CRUD,检索等,官方文档称之为HTTP layer。 对于这两个平面公共的配置,配置参数可以使用n
阅读全文

浙公网安备 33010602011771号