创建一个用户,命名为es
useradd es passwd es
*** 作如下:
原因:elasticsearch不支持root用户启动
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.12.1-linux-x86_64.tar.gz
进入刚创建用户es的文件夹下
解压到当前文件夹
tar -zxf elasticsearch-7.12.1-linux-x86_64.tar.gz
给es用户赋予elasticsearch-7.12.1文件夹的 *** 作权限
chown -R es /home/es/elasticsearch-7.12.1
*** 作如下
其他版本下载
https://www.elastic.co/guide/en/elastic-stack/index.html
vim elasticsearch-7.12.1/config/elasticsearch.yml
添加内容如下
#配置所有节点都可访问 network.host: 0.0.0.0 #设置端口 http.port: 9200 #设置集群节点 cluster.initial_master_nodes: ["node-1"] #允许跨域访问 http.cors.enabled: true http.cors.allow-origin: "*"
修改JVM配置,如果主机性能好可以不用配置
vim elasticsearch-7.12.1/config/jvm.options第四步 启动ElasticSearch
切换到es用户并在bin目录下启动elasticsearch
su es ./elasticsearch第五步 排错 错误1
描述:
ERROR: [1] bootstrap checks failed. You must address the points described in the following [1] lines before starting Elasticsearch. bootstrap check failure [1] of [1]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65535]
解决办法
vim /etc/security/limits.conf
文件末尾添加
* soft nofile 65536 * hard nofile 65536
注:有些系统需要退出登录,重新登录才会生效
描述:
max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
解决方法
vim /etc/sysctl.conf sysctl -p
文件末尾添加
vm.max_map_count=655360警告
warning: usage of JAVA_HOME is deprecated, use ES_JAVA_HOME Future versions of Elasticsearch will require Java 11; your Java version from [/usr/local/java/jdk1.8.0_311/jre] does not meet this requirement. Consider switching to a distribution of Elasticsearch with a bundled JDK. If you are already using a distribution with a bundled JDK, ensure the JAVA_HOME environment variable is not set. warning: usage of JAVA_HOME is deprecated, use ES_JAVA_HOME Future versions of Elasticsearch will require Java 11; your Java version from [/usr/local/java/jdk1.8.0_311/jre] does not meet this requirement. Consider switching to a distribution of Elasticsearch with a bundled JDK. If you are already using a distribution with a bundled JDK, ensure the JAVA_HOME environment variable is not set.
解决办法
vim elasticsearch-env
添加内容,elasticsearch自带jdk的位置
export ES_JAVA_HOME=/home/es/elasticsearch-7.12.1/jdk
排错思路
1.java环境是否配置好
2.防火墙是否打开,端口是否放行
3.修改的配置文件是否生效
4.权限,权限,文件夹一定要非root
curl 'http://localhost:9200/?pretty'
使用head-master进行连接管理
在elasticsearch-head-master_siteapp.js中修改为自己的ip地址
参考文章:https://www.cnblogs.com/weibanggang/p/11589464.html
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)