Elasticsearch 安裝報錯

下載內容
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.6.2-linux-x86_64.tar.gz

安裝最新版es報錯

報錯內容如下:

01 解析地址錯誤centos8

wget: 無法解析主機地址 “artifacts.elastic.co

解決辦法,添加解析的,修改resolv.conf

[root@localhost etc]# cat resolv.conf
# Generated by NetworkManager
[root@localhost etc]# vi resolv.conf 

# Generated by NetworkManager
nameserver 8.8.8.8
nameserver 8.8.4.4

02  權限報錯,不能使用root用戶

org.elasticsearch.bootstrap.StartupException: java.lang.RuntimeException: can not run elasticsearch as root

創建用戶,賦權限,並切換用戶

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

授權

[root@localhost bin]# chmod -R 777 /usr/local/apps/elasticsearch-7.6.2

輸入自己的密碼,切換用戶

[root@localhost bin]# su es

啓動報錯,權限問題(jdk版本,問題可以看要求的jdk版本:https://www.elastic.co/cn/support/matrix#matrix_jvm  )product and jvm 說明部分

[es@localhost bin]$ ./elasticsearch
future versions of Elasticsearch will require Java 11; your Java version from [/usr/local/apps/jdk1.8.0_231/jre] does not meet this requirement
Exception in thread "main" java.nio.file.AccessDeniedException: /usr/local/apps/elasticsearch-7.6.2/config/jvm.options

 

xpack.ml.enabled: false 未設置【報錯內容告訴你了】

[2020-04-03T11:46:40,903][ERROR][o.e.b.ElasticsearchUncaughtExceptionHandler] [localhost.localdomain] uncaught exception in thread [main]
org.elasticsearch.bootstrap.StartupException: ElasticsearchException[Failure running machine learning native code. This could be due to running on an unsupported OS or distribution, missing OS libraries, or a problem with the temp directory. To bypass this problem by running Elasticsearch without machine learning functionality set [xpack.ml.enabled: false].]

編輯config 下的文件

[es@localhost bin]$ cd ../config

[es@localhost config]$ vi elasticsearch.yml

xpack.ml.enabled: false

順便修改一下端口,網絡主機,服務發現地址,服務名稱什麼的

http.port: 9200 

network.host: 192.168.23.13

discovery.seed_hosts: ["192.168.23.13"]

cluster.name: es_search

如果沒注意,把空格去掉了就會報錯 cluster.name:es_search 【報錯】  cluster.name: es_search 【正確】

意思是說沒找到value (空格bug哈)

SettingsException[Failed to load settings from [elasticsearch.yml]]; nested: ParsingException[Failed to parse object: expecting token of type [START_OBJECT] but found [VALUE_STRING]];

 

沒完,接着報錯,按照推薦的數據修改配置文件

[2020-04-03T12:11:53,705][INFO ][o.e.b.BootstrapChecks    ] [localhost.localdomain] bound or publishing to a non-loopback address, enforcing bootstrap checks
ERROR: [3] bootstrap checks failed
[1]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65535]
[2]: max number of threads [3069] for user [es] is too low, increase to at least [4096]
[3]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]

參考博文:https://www.cnblogs.com/zhi-leaf/p/8484337.html

 

切回到root用戶 

[es@localhost bin]$ su root

修改配置文件(/etc/security/limits.conf  和 /etc/sysctl.conf)

添加limits.conf【是有星號的】

[root@localhost bin]# vi /etc/security/limits.conf

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

[root@localhost bin]# vi /etc/sysctl.conf

vm.max_map_count=262144

生效

[root@localhost bin]# sysctl -p

切回新增加的用戶啓動

[root@localhost bin]# su es
[es@localhost bin]$ ./elasticsearch

訪問是否成功

 

集羣版修改一下 discovery.seed_hosts,列出其他虛擬機上的ip地址

 discovery.seed_hosts: ["192.168.23.12","192.168.23.13","192.168.23.14"]
#discovery.seed_hosts: ["192.168.23.12"]

 

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章