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

Elasticsearch安装、Ik分词器安装、head管理界面安装(Windows && Linux)

Elasticsearch安装、Ik分词器安装、head管理界面安装(Windows && Linux)

Elasticsearch 安装与使用(Windows && Linux)

官方下载地址:https://www.elastic.co/cn/downloads/elasticsearch

head插件安装(es可视化界面)

github地址:https://github.com/mobz/elasticsearch-head

Ik分词器安装

github地址:https://github.com/medcl/elasticsearch-analysis-ik

Windows版本安装 1、安装Es 1.1 下载es安装包,版本:7.15.2

1.2 修改es配置,以便能够正确使用插件(解决跨域问题)
# cd D:elasticsearches7.15.2config
# vim elasticsearch.yml

# 添加两行配置
http.cors.enabled: true
http.cors.allow-origin: "*"
1.3 配置es环境变量

1.4 启动
# cd D:elasticsearches7.15.2bin
# 双击 elasticsearch.bat

PS: es7是自带java11版本的,可能与本地java版本发生冲突,可在elasticsearch.bat文件中做兼容处理

1.5 浏览器访问:http://localhost:9200

2、安装Ik插件 2.1 下载ik
# cd D:elasticsearches7.15.2bin

# 7.15.2 替换成你自己的es的版本号,两处都要替换
# elasticsearch-plugin install https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v7.15.2/elasticsearch-analysis-ik-7.15.2.zip 

Linux安装 1、安装Es 1.1 下载es安装包,版本:7.15.2

1.2 安装步骤
# 将下载好的文件上传到服务器
# cd /use/local
# tar -zxvf elasticsearch-7.15.2-linux-x86_64.tar.gz

# 创建新用户(es不能使用root用户启动)
# groupadd els
# useradd els -g els -p 密码

# 更新权限
# chown -R els:els elasticsearch-7.15.2

# 启动
# su els
# ./elasticsearch-7.15.2/bin/elasticsearch

# 错误一:内存过大
解决方法:
# vim usr/local/elasticsearch-7.15.2/config/jvm.options
# 新增两行(根据系统内容自行定义大小):-Xms512m -Xms512m
1.3 解决外网无法访问问题

1.3.1 开启服务器白名单
1.3.2 防火墙放行9200端口
1.3.3 云服务器上安装 Elasticsearch7.x,外网无法通过 ip:9200 访问?
本地可访问:

进入/usr/local/elasticsearch-7.15.2/config目录,编辑elasticsearch.yml文件,打开并设置host和port,然后重启

继续报错:
ERROR: [3] bootstrap checks failed. You must address the points described in the following [3] lines before starting Elasticsearch.
bootstrap check failure [1] of [3]: initial heap size [268435456] not equal to maximum heap size [482344960]; this can cause resize pauses
bootstrap check failure [2] of [3]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]

# vim /etc/sysctl.conf

# 添加配置
vm.max_map_count=655360

# 内核配置立即生效
# sysctl -p

继续报错:
ERROR: [2] bootstrap checks failed. You must address the points described in the following [2] lines before starting Elasticsearch.
bootstrap check failure [1] of [2]: initial heap size [268435456] not equal to maximum heap size [482344960]; this can cause resize pauses
bootstrap check failure [2] of [2]: the default discovery settings are unsuitable for production use; at least one of [discovery.seed_hosts, discovery.seed_providers, cluster.initial_master_nodes] must be configured
ERROR: Elasticsearch did not exit normally - check the logs at /usr/local/elasticsearch-7.15.2/logs/elasticsearch.log

# cd /usr/local/elasticsearch-7.15.2/config

# vim elasticsearch.yml
# 打开 node.name: node-1 注释
# 打开 cluster.initial_master_nodes: ["node-1"] 注释,去掉里面的“node-2”
1.4 修改es配置,以便能够正确使用插件(解决跨域问题)
# vim elasticsearch.yml

# 添加两行配置
http.cors.enabled: true
http.cors.allow-origin: "*"

大功告成

2、 安装Ik分词器
# cd /usr/local/elasticsearch-7.15.2/bin
# 注意下载的版本必须与es版本相同
# ./elasticsearch-plugin install https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v7.15.2/elasticsearch-analysis-ik-7.15.2.zip
3、安装head

作用:es可视化管理界面
前提:安装好npm和node环境,可参考我的文章Npm、Node安装

# git clone git://github.com/mobz/elasticsearch-head.git

# cd elasticsearch-head

# 执行失败,可尝试使用淘宝镜像
# npm install 

# npm run start

# 访问 http://localhost:9100

大功告成:

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

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

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