1. 安装配置JDK环境
    JDK安装(不能安装JRE)
    JDK下载地址:http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
    下载包:jdk-8u131-linux-x64.rpm
    yum localinstall jdk-8u131-linux-x64.rpm
  2. mvn 安装
    MVN下载地址
    cd /usr/local
    wget http://www-eu.apache.org/dist/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz
    tar xzf apache-maven-3.3.9-bin.tar.gz
    mv apache-maven-3.3.9 maven
    vi /etc/profile.d/maven.sh
    export M2_HOME=/usr/local/maven
    export PATH=${M2_HOME}/bin:${PATH}
    source /etc/profile.d/maven.sh
    mvn -version
  3. 安装ElasticSearch5.41
    yum install epel-release
    yum install npm nodejs
    centos7 若安装nodejs失败,请执行如下命令再重试
    rpm -ivh https://kojipkgs.fedoraproject.org//packages/http-parser/2.7.1/3.el7/x86_64/http-parser-2.7.1-3.el7.x86_64.rpm
    wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.4.1.rpm
    yum localinstall elasticsearch-5.4.1.rpm
    修改配置文件
    vim /etc/elasticsearch/elasticsearch.yml
    修改network.host:localhost 为当前服务器ip地址
    追加2行
    # 增加新的参数,这样head插件可以访问es
    http.cors.enabled: true
    http.cors.allow-origin: "*"
    若安装了xpack,关闭密码,需添加如下一行,默认无需添加
    xpack.security.enabled: false
    启动: systemctl start elasticsearch
    开机启动:systemctl enable elasticsearch
    测试
    访问 http://localhost:9200/地址
    默认密码Username: elastic Password: changeme
    注意network.host参数,不能使用外网ip,若需要开发外网访问,设置为:0.0.0.0
  4. elasticsearch-head (此操作巨慢)
    git clone git://github.com/mobz/elasticsearch-head.git
    cd elasticsearch-head
    '''
    添加淘宝源(依然慢)
    npm install -g cnpm --registry=https://registry.npm.taobao.org
    '''
    npm install
    vim _site/app.js
    查找9200修改参数localhost为本机ip
    npm run start
    测试
    访问 http://localhost:9100/地址,页面显示正常,es连接正常即ok
  5. kibana
    wget https://artifacts.elastic.co/downloads/kibana/kibana-5.4.1-x86_64.rpm
    yum localinstall kibana-5.4.1-x86_64.rpm
    修改配置文件
    vim /etc/kibana/kibana.yml 
    修改elasticsearch.url localhost 为当前服务器ip地址,用户名及密码
    elasticsearch.url: http://localhost:9200
    elasticsearch.username: "elastic"
    elasticsearch.password: "changeme"
    测试:
    curl -u elastic:changeme http://localhost
    http://localhost/status
  6. nginx配置
    安装软件
    yum install nginx httpd-tools
    为 Kibana 创建一个配置文件
    vi /etc/nginx/conf.d/kibana.conf
    加入以下这一段内容:
    server {
    listen ;
    server_name server_ip;
    location / {
    proxy_pass http://localhost:5601;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection 'upgrade';
    proxy_set_header Host $host;
    proxy_cache_bypass $http_upgrade;
    }
    }

    注意修改配置文件,server_name ip
    启动Nginx服务
    systemctl start nginx
    systemctl enable nginx
    验证http://localhost

  7. 5.x以上版本的Elasticsearch,Marvel 更换成了X-Pack (收费插件,免费的只有监控功能)
    cd /usr/share/elasticsearch/bin
    ./elasticsearch-plugin install x-pack
    cd /usr/share/kibana/bin
    ./kibana-plugin install x-pack
    systemctl restart elasticsearch
    systemctl restart kibana
  8. elasticsearch-analysis-ik 分词插件 (此步安装巨慢)
    对应免安装版本下载地址:https://github.com/medcl/elasticsearch-analysis-ik/releases
    git clone https://github.com/medcl/elasticsearch-analysis-ik
    cd elasticsearch-analysis-ik
    mvn clean
    mvn compile
    mvn package
    拷贝和解压 release 下的文件: #{project_path}/elasticsearch-analysis-ik/target/releases/elasticsearch-analysis-ik-*.zip 到你的 elasticsearch 插件目录, 如: plugins/ik 重启 elasticsearch
    分词插件测试脚本
    创建一个index
    curl -u elastic:changeme -XPUT http://localhost:9200/index
    创建一个mapping
    curl -u elastic:changeme -XPOST http://localhost:9200/index/fulltext/_mapping -d'
    {
    "fulltext": {
    "_all": {
    "analyzer": "ik_max_word",
    "search_analyzer": "ik_max_word",
    "term_vector": "no",
    "store": "false"
    },
    "properties": {
    "content": {
    "type": "text",
    "analyzer": "ik_max_word",
    "search_analyzer": "ik_max_word",
    "include_in_all": "true",
    "boost":
    }
    }
    }
    }'
    创建index
    curl -u elastic:changeme -XPOST http://localhost:9200/index/fulltext/1 -d'
    {"content":"世界如此之大"}
    '
    curl -u elastic:changeme -XPOST http://localhost:9200/index/fulltext/2 -d'
    {"content":"世界如此美好"}
    '
    查询
    curl -u elastic:changeme -XPOST http://localhost:9200/index/fulltext/_search -d'
    {
    "query" : { "match" : { "content" : "世界" }},
    "highlight" : {
    "pre_tags" : ["<tag1>", "<tag2>"],
    "post_tags" : ["</tag1>", "</tag2>"],
    "fields" : {
    "content" : {}
    }
    }
    }
    '

    ik-test

ElasticSearch5.4.1 搜索引擎搭建文档的更多相关文章

  1. 环境搭建文档——Windows下的Python3环境搭建

    前言 背景介绍: 自己用Python开发了一些安卓性能自动化测试的脚本, 但是想要运行这些脚本的话, 本地需要Python的环境. 测试组的同事基本都没有安装Python环境, 于是乎, 我就想直接在 ...

  2. 生产环境轻量级dns服务器dnsmasq搭建文档

    dnsmasq搭建文档 一.生产环境域名解析问题 之前生产环境设备较少,是通过维护master(192.168.1.1)设备的hosts文件实现的.每次新增设备后,需要在master的hosts文件中 ...

  3. kafka集群搭建文档

    kafka集群搭建文档 一. 下载解压 从官网下载Kafka,下载地址http://kafka.apache.org/downloads.html 注意这里最好下载scala2.10版本的kafka, ...

  4. VUE CLI环境搭建文档

    VUE CLI环境搭建文档 1.安装Node.js 下载地址 https://nodejs.org/zh-cn/download/ 2.全局安装VUE CLI win+R键打开运行cmd窗口输入一下代 ...

  5. OpenStack Pike超详细搭建文档 LinuxBridge版

    前言 搭建前必须看我 本文档搭建的是分布式P版openstack(1 controller + N compute + 1 cinder)的文档. openstack版本为Pike. 搭建的时候,请严 ...

  6. OpenStack Ocata 超详细搭建文档

    前言 搭建前必须看我本文档搭建的是分布式O版openstack(controller+ N compute + 1 cinder)的文档.openstack版本为Ocata.搭建的时候,请严格按照文档 ...

  7. 使用ghpage(github服务)搭建文档网站几种方式

    可以通过github提供的ghpage服务来搭建网站,有以下三种方式来实现: 1.文档放在master分支,作为一个子目录. 仓库:https://github.com/Ourpalm/ILRunti ...

  8. Readthedocs+Github搭建文档

    一.文档撰写前提 环境部署: > git clone https://github.com/toooney/demo-readthedocs.git > pip install sphin ...

  9. 推荐一个vuepress模板,一键快速搭建文档站

    介绍 vuepress-template是一个简单的VuePress案例模板,目的是让用户可以直接clone这个仓库,作为初始化一个VuePress网站启动项目,然后在这个项目的基础上新增自定义配置和 ...

随机推荐

  1. Python入门-用户登录程序

    _flag = Falsecount = 0users = [['ziv', '123'], ['alex', '12345']]while count < 3: username = inpu ...

  2. CSS scroll-behavior属性: 滚动框指定滚动行为

    概念 当用户手动导航或者 CSSOM scrolling API 触发滚动操作时,CSS 属性 scroll-behavior 为一个滚动框指定滚动行为,其他任何的滚动,例如那些由于用户行为而产生的滚 ...

  3. 软件工程(FZU2015) 赛季得分榜,第六回合

    SE_FZU目录:1 2 3 4 5 6 7 8 9 10 11 12 13 积分规则 积分制: 作业为10分制,练习为3分制:alpha30分: 团队项目分=团队得分+个人贡献分 个人贡献分: 个人 ...

  4. 转:Linux下查看tomcat占用端口

    https://blog.csdn.net/liufuwu1/article/details/71123597[root@server-crm mysql]# ps -ef | grep " ...

  5. 启动Tomcat的时候8080被占用

    异常来源:启动Tomcat服务器报错: Several ports (8080, 8009) required by Tomcat v7.0 Server at localhost are alrea ...

  6. 关于Vue-cli 组件引入CSS样式文件

    在 Vue-cli 组件 .vue 文件中引入 css 样式表出错   由于使用Vue-cli后, 引入css 样式表 不需要 多余../../ 之类路径  现在写法也发生了改变 <style ...

  7. 字符串正则替换replace第二个参数是函数

    zepto中 //将字符串转成驼峰式的格式 camelize = function (str) { return str.replace(/-+(.)?/g, function (match, chr ...

  8. PHP5.4.0新特性研究

    PHP5.4.0新特性研究 1.内建Web Server 这的确是个好的改进,大大的方便了开发人员.以后开发机不装nginx,httpd也行 cd $PHP_INSTALL_PATH ./bin/ph ...

  9. Golang的时间生成,格式化,以及获取函数执行时间的方法

    最近都在通过完成一些列功能强化自己对常用api的熟悉. 然而关于时间的api几乎是最常用的api类型,所以总结一些常用的. 以YY-mm-dd HH:MM:SS.9位 输出当前时间: func mai ...

  10. Delphi (Library Path Browsing Path)

    首先要明白的一个概念是dcu文件 *.dcu是*.pas的编译后单元文件(Delphi Compiled Unit), 编译器把它和库文件连接起来就构成了可执行文件*.exe 或*.dll等,相当于C ...