elasticsearch: 安装es8.14.2
一,什么是es?
Elasticsearch 是一款近实时的搜索引擎,底层是基于 Lucene 做搜索,再此基础上加入了分布式的特性,以便支持海量数据的存储和搜索
官网:
https://www.elastic.co/cn/
二,下载
1,进入下载页面
在下载页面下载
得到链接地址后可以从服务端直接下载:
[lhdop@blog es]$ wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-8.14.2-linux-x86_64.tar.gz
2,查询各es版本所支持的java版本
https://www.elastic.co/cn/support/matrix#matrix_jvm
如图:
三,安装
1,解压缩:
[lhdop@blog es]$ tar -zxvf elasticsearch-8.14.2-linux-x86_64.tar.gz
2,移动到指定目录:
[lhdop@blog es]$ mv elasticsearch-8.14.2 /usr/local/soft/elasticsearch
4,相关命令:
启动:
[lhdop@blog es]$ /usr/local/soft/elasticsearch/bin/elasticsearch -d
停止:killes的进程id
[lhdop@blog es]$ kill -9 23934
五,报错
1,报错信息
[2024-07-10T12:10:18,927][ERROR][o.e.b.Elasticsearch ] [iZ2zejc9t0hf6pnw6sewrxZ]
fatal exception while booting Elasticsearchjava.lang.RuntimeException:
can not run elasticsearch as root
解决:
不要用root账户运行es,换一个普通账户启动
2,报错信息
[lhdop@iZ2zejc9t0hf6pnw6sewrxZ conf]$ /usr/local/soft/elasticsearch-8.14.2/bin/elasticsearch -d
warning: ignoring JAVA_HOME=/usr/local/soft/jdk-17.0.11; using bundled JDK
/usr/local/soft/elasticsearch-8.14.2/bin/elasticsearch-cli: line 14:
/usr/local/soft/elasticsearch-8.14.2/jdk/bin/java: Permission denied
解决:
在/etc/profile中增加ES_JAVA_HOME环境变量:
export ES_JAVA_HOME=/usr/local/soft/jdk-17.0.11
3,报错信息:
Caused by: java.nio.file.AccessDeniedException:
/usr/local/soft/elasticsearch-8.14.2/config/elasticsearch.yml
查看配置文件的权限:
[lhdop@iZ2zejc9t0hf6pnw6sewrxZ ~]$ ll /usr/local/soft/elasticsearch-8.14.2/config/elasticsearch.yml
-rw-rw---- 1 root root 4052 Jul 10 12:10 /usr/local/soft/elasticsearch-8.14.2/config/elasticsearch.yml
解决:
[root@blog ~]# ll /usr/local/soft/elasticsearch-8.14.2/config/elasticsearch.yml
-rw-rw---- 1 lhdop lhdop 4052 Jul 10 12:10 /usr/local/soft/elasticsearch-8.14.2/config/elasticsearch.yml
六,测试效果
访问9200端口的返回: