栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 前沿技术 > 大数据 > 大数据系统

ElasticSearch Linux 5 步快速部署

ElasticSearch Linux 5 步快速部署

ElasticSearch Linux 5 步快速部署 第一步 创建用户

创建一个用户,命名为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


注:有些系统需要退出登录,重新登录才会生效

错误2

描述:

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

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/721706.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号