大數據Elasticsearch之linux系統安裝Elasticsearch


三個步驟(linux系統皆可)

  1. 安裝Java環境
  2. 安裝並配置elasticsearch
  3. 啓動elasticsearch

1. 安裝JDK1.8+

安裝1.8版本或以上的jdk


2. 安裝並配置elasticsearch

下載壓縮包(文章中用的是7.3.2版本)

$ wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.3.2-linux-x86_64.tar.gz
$ tar -zxvf elasticsearch-7.3.2-linux-x86_64.tar.gz

使用或新建普通用戶

要以普通用戶來運行纔可以

useradd es
passwd es
chown -R es elasticsearch-7.3.2

配置

開啓步驟 - 在配置文件elasticsearch.yml中配置好初始化參數

$ vim /config/elasticsearch.yml

在文件中添加以下配置

#配置節點名
node.name: node-1
#配置遠程訪問
network.host: 0.0.0.0
#配置端口
http.port: 9200
#配置跨域訪問
http.cors.enabled: true
http.cors.allow-origin: "*"
#配置集羣主節點
cluster.initial_master_nodes: ["node-1"]
#關閉機器學習
xpack.ml.enabled: false

配置資源使用限制

#提高可用資源限制(重新登錄用戶後才生效)

vim /etc/security/limits.conf

在文件最後的表格中添加以下配置

* soft nofile 65536
* hard nofile 65536
* soft nproc 4096
* hard nproc 4096

提高可用資源限制

$ vim /etc/sysctl.conf

在文件最後添加以下內容

vm.max_map_count=262144

查看配置

$ sysctl -p

3. 啓動elasticsearch

啓動elasticsearch(如果需要以後臺守護進程模式運行,則添加參數 -d)

$ ./bin/elasticsearch

基於HTTP協議,以JSON爲數據交互格式的RESTful API,通過9200端口的與Elasticsearch進行通信。
如訪問http://ipaddress:9200/
得到以下返回

{
  "name" : "master1",
  "cluster_name" : "cluster1",
  "cluster_uuid" : "Fo9Qwp_FS8i-8lbZu0A6tA",
  "version" : {
    "number" : "7.3.2",
    "build_flavor" : "default",
    "build_type" : "tar",
    "build_hash" : "1c1faf1",
    "build_date" : "2019-09-06T14:40:30.409026Z",
    "build_snapshot" : false,
    "lucene_version" : "8.1.0",
    "minimum_wire_compatibility_version" : "6.8.0",
    "minimum_index_compatibility_version" : "6.0.0-beta1"
  },
  "tagline" : "You Know, for Search"
}
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章