elasticsearch學習筆記二:相關軟體安裝

aliyeye發表於2020-12-14

Linux安裝Elasticsearch

wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.x.x-linux-x86_64.tar.gz
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.x.x-linux-x86_64.tar.gz.sha512
shasum -a 512 -c elasticsearch-7.x.x-linux-x86_64.tar.gz.sha512 
tar -xzf elasticsearch-7.x.x-linux-x86_64.tar.gz
cd elasticsearch-7.x.x/ 

注意:

1 建立 elasticsearch 使用者組(可省略)

root@localhost ~]# groupadd elasticsearch

2 建立使用者 es 並設定密碼為es

[root@localhost ~]# useradd es
[root@localhost ~]# passwd es

3 使用者es 新增到 elasticsearch 使用者組(可省略)

[root@localhost ~]# usermod -G elasticsearch es

4 設定sudo許可權(可省略)

[root@localhost ~]# visudo

在root ALL=(ALL) ALL 一行下面
新增es使用者 如下:

es ALL=(ALL) ALL

5 新增成功儲存後切換到es使用者操作

[root@localhost ~]# su es
[es@localhost root]# cd /xx/xx/es/bin #對於的es目錄下
[es@localhost bin]# ./elasticsearch -d #啟動
ERROR: [1] bootstrap checks failed
[1]: the default discovery settings are unsuitable for production use; at least one of [discovery.seed_hosts, discovery.seed_providers, cluster.initial_master_nodes] must be configured
[2019-06-03T07:05:44,761][INFO ][o.e.n.Node               ] [hz] stopping ...
[2019-06-03T07:05:44,788][INFO ][o.e.n.Node               ] [hz] stopped
[2019-06-03T07:05:44,788][INFO ][o.e.n.Node               ] [hz] closing ...
[2019-06-03T07:05:44,801][INFO ][o.e.n.Node               ] [hz] closed
[2019-06-03T07:05:44,804][INFO ][o.e.x.m.p.NativeController] [hz] Native controller process has stopped - no new native processes can be started

解決辦法

修改config/elasticsearch.yml下,放開node.name註釋,可更改名稱
node.name: node-1

ERROR: [1] bootstrap checks failed
[1]: the default discovery settings are unsuitable for production use; at least one of [discovery.seed_hosts, discovery.seed_providers, cluster.initial_master_nodes] must be configured

解決辦法

#ip替換host1等,多節點請新增多個ip地址,單節點可寫按預設來
#配置以下三者,最少其一
#[discovery.seed_hosts, discovery.seed_providers, cluster.initial_master_nodes]
cluster.initial_master_nodes: ["node-1"] #這裡的node-1為node-name配置的值

解決辦法

#修改config/elasticsearch.yml,修改為當前es地址或0.0.0.0
network.host: 0.0.0.0

Failed to clear cache for realms [[]]

暫無解決辦法,官方github上已經有人提issue了


[status][plugin:spaces@7.1.1] Status changed from yellow to green - Ready

max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]

解決辦法:

臨時解決辦法:切換root使用者執行如下命令

sysctl -w vm.max_map_count=262144

永久解決辦法:在 /etc/sysctl.conf檔案最後新增一行

vm.max_map_count=262144
sysctl -p  #使修改立即生效

檢視修改結果:

sysctl -a|grep vm.max_map_count

顯示:

vm.max_map_count = 262144

ERROR: bootstrap checks failed
memory locking requested for elasticsearch process but memory is not locked

這是因為設定了鎖定記憶體引數bootstrap.memory_lock=true

在/config/jvm.options 檔案內 堆大小設定的預設

 -Xms1g
 -Xmx1g

調小即可(記憶體夠大,就調大。建議是伺服器記憶體的一半)

 -Xms108m
 -Xmx108m
本作品採用《CC 協議》,轉載必須註明作者和本文連結

相關文章