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

最新最全的:安装Elasticsearch,Kibana,IKfen分词器

最新最全的:安装Elasticsearch,Kibana,IKfen分词器


https://www.elastic.co/cn/downloads/past-releases/elasticsearch-7-10-1
https://www.elastic.co/cn/downloads/past-releases/kibana-7-10-1
https://github.com/medcl/elasticsearch-analysis-ik/releases/tag/v7.10.1

---------------------------  安装es, 并安装插件elasticsearch-analysis-ik  ----------------------------
1.官网下载elasticsearch,选择自己需要的版本(备注:es,kibana,ik等版本要统一)

https://www.elastic.co/cn/downloads/past-releases/elasticsearch-7-10-1


2.解压到自己存放的目录
1)cd /usr/local
2)tar -zxvf elasticsearch-7.10.1-linux-x86_64.tar.gz

3.修改配置文件elasticsearch.yml
1)cd /usr/local/elasticsearch-7.10.1
2)mkdir data
3)vim ./config/elasticsearch.yml
    cluster.name: my-application #集群名称
    node.name: node-1 #节点名称
    path.data: /usr/local/elasticsearch-7.10.1/data    #数据的存储目录
    path.logs: /usr/local/elasticsearch-7.10.1/logs    #日志的存储目录
    network.host: 0.0.0.0    #设置绑定的ip,设置为0.0.0.0,可以让任何计算机节点访问
    http.port: 9200 #端口
    cluster.initial_master_nodes: ["node-1"]    #设置在集群中的所有节点名称,这个节点名称就是之前所修改的,当然你也可以采用默认的也行,目前是单机,放入一个节点即可 

4.修改limits.conf文件(myes是启动elasticsearch的账户,elasticsearch是不能再root账户下启动的)
vim /etc/security/limits.conf
myes soft nofile 65536
myes hard nofile 65536
myes soft nproc 4096
myes hard nproc 4096

5.修改sysctl.conf文件(添加 vm.max_map_count = 655360)
vim /etc/sysctl.conf
文件末尾添加:vm.max_map_count = 655360
***退出文件后执行:sysctl -p看信息是否已经添加上去

6.修改/usr/local/elasticsearch-7.10.1/config/jvm.options
1)根据服务器内存设置合适的值
1)cd /usr/local/elasticsearch-7.10.1/config/
2)vim jvm.options添加如下值
    -Xms512m
    -Xmx512m

7.添加用户
不能使用root用户去启动elasticsearch,因为elasticsearch内置的安全性
添加es用户,密码为es,并修改elasticsearch-7.10.1目录的权限:
adduser es -p es
chown -R es /usr/local/elasticsearch-7.10.1/
chown -R es /usr/local/kibana-7.10.1-linux-x86_64/ 

8.上传elasticsearch-analysis-ik-7.10.1.zip插件到/usr/local/elasticsearch-7.10.1/plugins目录下
1)解压
cd /usr/local/elasticsearch-7.10.1/plugins
unzip -d  elasticsearch-analysis-ik-7.10.1  elasticsearch-analysis-ik-7.10.1.zip
rm -rf elasticsearch-analysis-ik-7.10.1.zip 
2)同步权限
chown -R es ./elasticsearch-analysis-ik-7.10.1
     
9.启动elasticsearch
-前台启动
1)切换账户:su es
2)启动服务:/usr/local/elasticsearch-7.10.1/bin/elasticsearch 
-后台启动:
1)切换账户:su es
2)启动服务:/usr/local/elasticsearch-7.10.1/bin/elasticsearch -d

-看日志,去查看启动有无异常:
1)cd /usr/local/elasticsearch-7.10.1/logs
2)tail -f my-application.log 

10.测试是否启动成功
-网页输入:http://ip:9200/
-服务器上输入:curl 127.0.0.1:9200
返回如下信息,则启动OK:
{
  "name" : "node-1",
  "cluster_name" : "my-application",
  "cluster_uuid" : "RqDrF8pyQfaNTDf_lNf_Ow",
  "version" : {
    "number" : "7.10.1",
    "build_flavor" : "default",
    "build_type" : "tar",
    "build_hash" : "1c34507e66d7db1211f66f3513706fdf548736aa",
    "build_date" : "2020-12-05T01:00:33.671820Z",
    "build_snapshot" : false,
    "lucene_version" : "8.7.0",
    "minimum_wire_compatibility_version" : "6.8.0",
    "minimum_index_compatibility_version" : "6.0.0-beta1"
  },
  "tagline" : "You Know, for Search"
}

-----------------------------------  安装kibana  ----------------------------------------

1.修改/config/kibana.yml
vim /usr/local/kibana-7.10.1-linux-x86_64/config/kibana.yml 
    server.host: "0.0.0.0"
    elasticsearch.hosts: ["http://localhost:9200"]  
 

2.启动kibana(*启动 Kibana 需要先启动 ElasticSearch)
-前台启动
1)切换账户:su myes
2)启动kibana:/usr/local/kibana-7.10.1-linux-x86_64/bin/kibana 
-后台启动
1)切换账户:su myes
2)启动kibana: 
1)后台启动:nohup /usr/local/kibana-7.15.2/bin/kibana &          
2)看日志:tail -f nohup.out


3.访问kibana,进入devtool可以测试elasticsearch,写sql去判断中文插件等是否安装正常
http://ip:5601  

运行下面指令不会智能分词:
GET _analyze
{
  "analyzer":"ik_max_word",
  "text":"大家好,我们都是中国人"
}

运行下面指令会智能分词:
GET _analyze
{
  "analyzer":"ik_smart",
  "text":"大家好,我们都是中国人"
}

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

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

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