Elastic Search 安裝和配置

目標

部署一個單節點的ElasticSearch集羣java

依賴

java環境node

$java -version
java version "1.8.0_161"
Java(TM) SE Runtime Environment (build 1.8.0_161-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.161-b12, mixed mode)

安裝

下載、解壓bootstrap

wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.1.1.tar.gz
tar -zxvf elasticsearch-6.1.1.tar.gz
mv elasticsearch-6.1.1 /usr/local/

配置

config/elasticsearch.ymlbash

cluster.name: my_cluster
node.name: master
path.data: /usr/local/elasticsearch-6.1.1/data
path.logs: /usr/local/elasticsearch-6.1.1/logs
network.host: 0.0.0.0
http.port: 9200

參數含義app

  • cluster.name 用來指定集羣的名稱。若是不指定,則默認是 elasticsearch。
  • node.name 用來指定當前節點的名稱,若是不指定,則會啓動的時候自動生成一個隨機惟一標識符做爲節點的名稱。
  • path.data 指定 ES 數據存儲路徑。
  • path.logs 指定 ES 日誌文件存儲路徑。
  • network.host 用來指定服務端口綁定的 IP 地址,默認綁定 127.0.0.1 ,也就是隻能本機訪問。
  • http.port 用來指定提供 http 服務的端口。

啓動

/usr/local/elasticsearch-6.1.1/bin/elasticsearch 

可能存在的問題

1. system call filters failed to install; check the logs and fix your configuration or disable system call filters at your own riskelasticsearch

緣由:這是在由於Centos6不支持SecComp,而ES5.2.0默認bootstrap.system_call_filter爲true進行檢測,因此致使檢測失敗,失敗後直接致使ES不能啓動j解決:在elasticsearch.yml中配置bootstrap.system_call_filter爲false,注意要在Memory下面:ui

bootstrap.memory_lock: false
bootstrap.system_call_filter: false

驗證

1.集羣的基本信息:http://ip:9200/spa

{
name: "master",
cluster_name: "jihite-application",
cluster_uuid: "aT8N1FljTqK5QZrxUDaVuw",
version: {
number: "6.1.1",
build_hash: "bd92e7f",
build_date: "2017-12-17T20:23:25.338Z",
build_snapshot: false,
lucene_version: "7.1.0",
minimum_wire_compatibility_version: "5.6.0",
minimum_index_compatibility_version: "5.0.0"
},
tagline: "You Know, for Search"
}

2.健康信息:http://ip:9200/_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
1552701815 10:03:35  jihite-application green           1         1      0   0    0    0        0             0                  -                100.0%
  • timestamp:表明狀態時間
  • cluster:表示集羣名稱
  • status:表示集羣狀態。green 表明健康;yellow 表明數據完整,可是副本不完整;red 表明數據不完整
  • node.total:表示集羣節點總數
  • node.data:表示集羣數據節點總數
  • shards:表示集羣分片的總數
  • active_shards_percent:表示集羣活動的分片百分比
3.查看狀態列表: http://ip:9200/_cat
=^.^=
/_cat/allocation
/_cat/shards
/_cat/shards/{index}
/_cat/master
/_cat/nodes
/_cat/tasks
/_cat/indices
/_cat/indices/{index}
/_cat/segments
/_cat/segments/{index}
/_cat/count
/_cat/count/{index}
/_cat/recovery
/_cat/recovery/{index}
/_cat/health
/_cat/pending_tasks
/_cat/aliases
/_cat/aliases/{alias}
/_cat/thread_pool
/_cat/thread_pool/{thread_pools}
/_cat/plugins
/_cat/fielddata
/_cat/fielddata/{fields}
/_cat/nodeattrs
/_cat/repositories
/_cat/snapshots/{repository}
/_cat/templates

參考

相關文章
相關標籤/搜索