zoukankan      html  css  js  c++  java
  • elasticsearch5.6.8安装和配置

    index(索引库) type(类型) _id(文档) 基于RESTful风格的索引库

    put localhost:9200/tensquare_elasticsearch 增加index库
    post localhost:9200/tensquare_elasticsearch/article 增加type类型json数据
    get localhost:9200/tensquare_elasticsearch/article/_search 查询所有type类型数据
    put localhost:9200/tensquare_elasticsearch/article/AWpnv2jwq3Et8kEDbn2C 按_id修改文档
    put localhost:9200/tensquare_elasticsearch/article/222 如果没有该_id则增加此_Id文档
    get localhost:9200/tensquare_elasticsearch/article/222 按_id查找文档
    get localhost:9200/tensquare_elasticsearch/article/_search?q=title:*s* 按_id模糊词条查找文档(英文按词模糊,中文按单个汉字模糊,所以需要分词)
    delete localhost:9200/tensquare_elasticsearch/article/222 按_id删除文档

    安装elasticsearch-head-master插件图形化
    安装node.js环境
    安装cnpm
    npm install -g cnpm --registry=https://registry.npm.taobao.org
    将grunt命令设为全局命令
    npm install -g grunt-cli
    为elasticsearch-head-master插件安装package.json依赖(需要在pacjage.json目录下)
    cnpm install
    启动插件访问localhost:9100即可(需要在pacjage.json目录下)
    grunt server

    安装ik分词器 解压后直接放到elasticsearch的plugins插件文件夹中即可
    测试 最细粒度
    http://localhost:9200/_analyze?analyzer=ik_max_word&pretty=true&text=我是程序员
    测试 最少分
    http://localhost:9200/_analyze?analyzer=ik_smart&pretty=true&text=我是程序员
    增加词条 在ik config下增加文件custom.dic第一行空 第二行加空格 添加词条保存为UTF-8编码重启elasticsearch即可

    logstash -f ../mysqletc/mysql.conf 同步数据库 默认每分钟更新一次
    ------------------------------------------------------------------------------------
    linux版
    cd /home/wuyou/elasticsearch-5.6.8/config
    vi jvm.options
    -Xms256m
    -Xmx256m
    vi elasticsearch.yml
    path.data: /home/wuyou/elasticsearch-5.6.8/data
    path.logs: /home/wuyou/elasticsearch-5.6.8/log

    #允许任何主机访问
    network.host: 0.0.0.0
    如果centos版本过低 在最后加上
    bootstrap.system_call_filter: false
    如果进程描述符过低
    vi /etc/security/limits.conf
    添加内容
    * soft nofile 65536
    * hard nofile 131072
    * soft nproc 4096
    * hard nproc 4096
    如果还报错
    vi /etc/sysctl.conf
    添加
    vm.max_map_count=655360
    然后执行
    sysctl -p
    最后重启配置才能生效
    elasticsearch默认不允许root用户启动 需要更改文件夹所属用户和所属组
    要安装使用head插件还需要修改配置文件
    vi elasticsearch.yml
    在文件最末尾添加允许跨域
    http.cors.enabled: true
    http.cors.allow-origin: "*"

  • 相关阅读:
    深入浅出RxJava
    android 图像处理系列合集
    WebView·开发指南
    LocalBroadcastManager 的实现原理,Handler还是 Binder?
    TCP协议中的三次握手和四次挥手(图解)
    Android进程保活
    Android只能动态注册的广播Action
    WakeLock, AlarmManager, JobScheduler
    jQuery验证控件jquery.validate.js使用说明+中文API
    IntelliJ IDEA的自动提示貌似是区分大小写的,首字母小写的话,怎么都提示不出来。
  • 原文地址:https://www.cnblogs.com/agasha/p/11302563.html
Copyright © 2011-2022 走看看