elasticsearch7.8.0部署
elasticsearch7.8.0部署
复制下载链接地址,并使用 wget 命令下载对应的压缩包。例如:
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.8.0-linux-x86_64.tar.gz
下载完成后,解压压缩包:
tar -xzvf elasticsearch-7.8.0-linux-x86_64.tar.gz
进入解压后的目录:
cd elasticsearch-7.8.0/
启动 Elasticsearch:
bin/elasticsearch
问题一:
future versions of Elasticsearch will require Java 11; your Java version from
[/usr/local/java/jdk1.8.0_371/jre] does not meet this requirement
在不想安装JDK11的情况下,可以使用ElasticSearch 内置的JDK
在/usr/local/elasticsearch/bin目录下vim elasticsearch-env:大约39至50行定义了jdk的选择方法
删除勾选内容
或者指定export JAVA_HOMEjdk11安装位置
问题二:使用root启动会报错:can not run elasticsearch as root
1、创建用户:elasticsearch
adduser elasticsearch
2、创建用户密码,需要输入两次
passwd elasticsearch
3、将对应的文件夹权限赋给该用户
chown -R elasticsearch elasticsearch-7.8.0
4、切换至elasticsearch用户
su elasticsearch
5、使用后台启动方式:
./elasticsearch -d
6、启动后测试
输入curl ip:9200,如果返回一个json数据说明启动成功
问题三:只能本地访问
修改config下的elasticsearch.yml
node.name: node-1
network.host: 0.0.0.0
cluster.initial_master_nodes: ["node-1"]
http.cors.enabled: true
http.cors.allow-origin: "*"
问题四:
[1]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65535]
ulimit -n 65535
[2]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
sysctl -w vm.max_map_count=262144