溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

ubuntu16.04中怎么安裝ElasticSearch

發(fā)布時間:2021-06-18 15:30:24 來源:億速云 閱讀:189 作者:Leah 欄目:大數(shù)據(jù)

本篇文章給大家分享的是有關(guān)ubuntu16.04中怎么安裝ElasticSearch,小編覺得挺實用的,因此分享給大家學(xué)習(xí),希望大家閱讀完這篇文章后可以有所收獲,話不多說,跟著小編一起來看看吧。

初始配置

配置時間同步

關(guān)閉防火墻

ufw disable

設(shè)置ulimit

見 https://my.oschina.net/u/914655/blog/3067520

修改max_map_count值
在linux系統(tǒng)上,elasticsearch默認(rèn)使用hybrid mmapfs / niofs來存儲索引文件,因此操作系統(tǒng)主要會通過mmap來限制存儲的空間,因此如果存儲空間滿了,那么會拋出異常,我們可以使用如下命令來更改設(shè)置。

臨時設(shè)置:
sysctl -w vm.max_map_count=655360
vm.max_map_count = 655360

永久設(shè)置:
echo 'vm.max_map_count=655360' >> /etc/sysctl.conf
sysctl -p
vm.max_map_count = 655360

安裝 

cd /app
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.3.1-linux-x86_64.tar.gz
tar zxvf elasticsearch-7.3.1-linux-x86_64.tar.gz
cd elasticsearch-7.3.1/

# es不能以root用戶運行
useradd elasticsearch

cd /data
mkdir elastic
cd elastic
mkdir data
mkdir logs

chown -R elasticsearch.elasticsearch /app/elasticsearch-7.3.1
chown -R elasticsearch.elasticsearch /data/elastic

配置文件

# 根據(jù)機器配置修改jvm參數(shù)
vim config/jvm.options
-Xms12g
-Xmx12g

# vim config/elasticsearch.yml
# 集群名稱,要一樣
cluster.name: jp-es
# 集群里節(jié)點名稱,要唯一,一般以數(shù)字自增
node.name: ES-node1
# 指定節(jié)點的部落屬性,這是一個比集群更大的范圍
node.attr.rack: r1
# 是否可稱為master節(jié)點
node.master: true
# 是否存儲數(shù)據(jù)
node.data: true
# 數(shù)據(jù)路徑
path.data: /data/elastic/data
# 日志路徑
path.logs: /data/elastic/logs
# 允許外部訪問
network.host: 0.0.0.0
# 訪問端口
http.port: 9200

#
discovery.seed_hosts: ["10.13.6.9","10.13.6.10","10.13.6.11","10.13.6.12","10.13.6.13"]
# 啟動集群時,參與master選舉的節(jié)點
cluster.initial_master_nodes: ["ES-node1", "ES-node2", "ES-node3"]

其他節(jié)點注意node.name,node.master即可

啟動

su elasticsearch

bin/elasticsearch -d

測試
 

curl http://localhost:9200
{
  "name" : "ES-node1",
  "cluster_name" : "jp-es",
  "cluster_uuid" : "KiRH05UbTTC25NPOr2zDRQ",
  "version" : {
    "number" : "7.3.1",
    "build_flavor" : "default",
    "build_type" : "tar",
    "build_hash" : "4749ba6",
    "build_date" : "2019-08-19T20:19:25.651794Z",
    "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"
}


curl http://localhost:9200/_cluster/health
{
    "cluster_name":"jp-es",
    "status":"green",
    "timed_out":false,
    "number_of_nodes":5,
    "number_of_data_nodes":5,
    "active_primary_shards":0,
    "active_shards":0,
    "relocating_shards":0,
    "initializing_shards":0,
    "unassigned_shards":0,
    "delayed_unassigned_shards":0,
    "number_of_pending_tasks":0,
    "number_of_in_flight_fetch":0,
    "task_max_waiting_in_queue_millis":0,
    "active_shards_percent_as_number":100
}

以上就是ubuntu16.04中怎么安裝ElasticSearch,小編相信有部分知識點可能是我們?nèi)粘9ぷ鲿姷交蛴玫降?。希望你能通過這篇文章學(xué)到更多知識。更多詳情敬請關(guān)注億速云行業(yè)資訊頻道。

向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI