一 Elasticsearch基础
1.1 官网地址
https://www.elastic.co
1.2 安装包下载地址
https://mirrors.huaweicloud.com/elasticsearch/?C=N&O=D
1.3 插件下载地址
https://github.com/mobz/elasticsearch-head
1.4 概念
Elasticsearch,简称es,是一个开源的高扩展的分布式全文检索引擎,它可以近乎实时的存储、检索数据。
二 安装
2.1 安装jdk1.8环境
jdk下载地址:
https://www.oracle.com/java/technologies/downloads/#java18
tar xf jdk-8u361-linux-x64.tar.gz -C /web
配置环境变量
vim /etc/profile
增加如下内容
export JAVA_HOME=/web/jdk1.8.0_361
export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH
export CLASSPATH=$CLASSPATH:$JAVA_HOME/lib:$JAVA_HOME/jre/lib
export JRE_HOME=${JAVA_HOME}/jre
使环境变量生效
source /etc/profile
java -version
2.2 nodejs环境准备
curl --silent --location https://rpm.nodesource.com/setup_10.x | bash -
yum install -y nodejs npm
npm install -g cnpm --registry=https://registry.npm.taobao.org
2.3 插件安装
cd /web
unzip elasticsearch-head-master.zip
cd elasticsearch-head-master/
npm install
报错:
core-js@2.6.12: core-js@<3.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Please, upgrade your dependencies to the actual version of core-js.
原因:
在github clone上克隆好的项目,在使用npm install 或者 cnpm install 经常会因为该包版本过高而导致漏包现象。
解决办法:
需要使用较低版本手动单独安装:cnpm install core-js@2 --save
npm install -g grunt-cli
启动
npm start &
2.4 设置内核参数
vim /etc/sysctl.conf
vm.max_map_count = 655360
sysctl -p
2.5 设置文件打开数
cat >>/etc/security/limits.conf< * soft nofile 65555 * hard nofile 65555 * soft nofile 65555 * hard nofile 65555 EOF 2.6 下载安装包 cd /web wget https://mirrors.huaweicloud.com/elasticsearch/7.6.2/elasticsearch-7.6.2-linux-x86_64.tar.gz 2.7 解压缩安装包 tar xf elasticsearch-7.6.2-linux-x86_64.tar.gz 2.8 修改配置文件 cd /web/elasticsearch-7.6.2/config vim elasticsearch.yml discovery.seed_hosts: ["192.168.0.103"] cluster.initial_master_nodes: ["node01"] cluster.name: es node.name: node-1 path.data: /opt/elasticsearch/data path.logs: /opt/elasticsearch/logs network.host: 192.168.0.103 http.port: 9200 #discovery.zen.ping.unicast.hosts: ["192.168.0.103"] http.cors.enabled: true http.cors.allow-origin: "*" 2.9 创建数据目录 cd /web/elasticsearch-7.6.2 mkdir data 2.10 创建es用户 useradd es 2.11 授权 cd /web chown -R es.es elasticsearch-7.6.2/ 2.12 启动elasticsearch 切换到es用户 su - es cd /web/elasticsearch-7.6.2/bin ./elasticsearch -d 查看服务状态 ps -ef|grep elasticsearch 2.13 浏览器访问 http://192.168.103:9200 http://192.168.0.103:9100 至此,Elasticsearch安装完成,感谢观看,记得点赞和关注哦,坚持下去,一起努力加油吧。
页面更新:2024-04-03
本站资料均由网友自行发布提供,仅用于学习交流。如有版权问题,请与我联系,QQ:4156828
© CopyRight 2020-2024 All Rights Reserved. Powered By 71396.com 闽ICP备11008920号-4
闽公网安备35020302034903号