在Linux环境下部署elastic search
1、下载好相关es包,一般es 5以上自带JDK,建议使用es自带jdk
比如es 7.17.3包对于的jdk目录
/home/elastic/elasticsearch-7.17.3/jdk
2、配置java运行环境JDK
编辑 vi /etc/profile
末尾添加
export JAVA_HOME=/home/elastic/elasticsearch-7.17.3/jdk
export CLASSPATH=$:CLASSPATH:$JAVA_HOME/lib/
export PATH=$PATH:$JAVA_HOME/bin
修改完毕,启用配置:source /etc/profile
测试,查看java环境:java -version
显示(正常):
OpenJDK Runtime Environment Temurin-18+36 (build 18+36)
OpenJDK 64-Bit Server VM Temurin-18+36 (build 18+36, mixed mode, sharing)
修改es相关参数(设置固定IP访问)
改es的config的配置文件elasticsearch.yml
1、vi elasticsearch.yml
设置:
network.host: 192.168.70.128
http.port: 9200
bootstrap.memory_lock: false
bootstrap.system_call_filter: false
#配置以下三者,最少其一
#[discovery.seed_hosts, discovery.seed_providers, cluster.initial_master_nodes]
cluster.initial_master_nodes: ["node-1"] #这里的node-1为node-name配置的值
2、
使用root身份,设置启动es 用户参数(elastic 为启动用户名字,自拟)
vi /etc/security/limits.conf
elastic soft nofile 65536
elastic hard nofile 131072
elastic soft nproc 4096
elastic hard nproc 4096
3、继续配置
输入指令:sysctl -w vm.max_map_count=262144
vi /etc/sysctl.conf
末尾添加
vm.max_map_count=262144
3、启动
./elasticsearch
后访问
curl 192.168.100.130:9200
显示(正常):
{
"name" : "192.168.70.128",
"cluster_name" : "elasticsearch",
"cluster_uuid" : "eVW7f5YoQGa74AEp_cJVOw",
"version" : {
"number" : "7.17.3",
"build_flavor" : "default",
"build_type" : "tar",
"build_hash" : "5ad023604c8d7416c9eb6c0eadb62b14e766caff",
"build_date" : "2022-04-19T08:11:19.070913226Z",
"build_snapshot" : false,
"lucene_version" : "8.11.1",
"minimum_wire_compatibility_version" : "6.8.0",
"minimum_index_compatibility_version" : "6.0.0-beta1"
},
"tagline" : "You Know, for Search"
}
浏览器不能访问,关闭CentOs防火墙:systemctl stop firewalld