ElasticSearch5.4.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 - 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 - 安装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 - 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 - 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 - 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 - 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 - 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 搜索引擎搭建文档的更多相关文章
- 环境搭建文档——Windows下的Python3环境搭建
前言 背景介绍: 自己用Python开发了一些安卓性能自动化测试的脚本, 但是想要运行这些脚本的话, 本地需要Python的环境. 测试组的同事基本都没有安装Python环境, 于是乎, 我就想直接在 ...
- 生产环境轻量级dns服务器dnsmasq搭建文档
dnsmasq搭建文档 一.生产环境域名解析问题 之前生产环境设备较少,是通过维护master(192.168.1.1)设备的hosts文件实现的.每次新增设备后,需要在master的hosts文件中 ...
- kafka集群搭建文档
kafka集群搭建文档 一. 下载解压 从官网下载Kafka,下载地址http://kafka.apache.org/downloads.html 注意这里最好下载scala2.10版本的kafka, ...
- VUE CLI环境搭建文档
VUE CLI环境搭建文档 1.安装Node.js 下载地址 https://nodejs.org/zh-cn/download/ 2.全局安装VUE CLI win+R键打开运行cmd窗口输入一下代 ...
- OpenStack Pike超详细搭建文档 LinuxBridge版
前言 搭建前必须看我 本文档搭建的是分布式P版openstack(1 controller + N compute + 1 cinder)的文档. openstack版本为Pike. 搭建的时候,请严 ...
- OpenStack Ocata 超详细搭建文档
前言 搭建前必须看我本文档搭建的是分布式O版openstack(controller+ N compute + 1 cinder)的文档.openstack版本为Ocata.搭建的时候,请严格按照文档 ...
- 使用ghpage(github服务)搭建文档网站几种方式
可以通过github提供的ghpage服务来搭建网站,有以下三种方式来实现: 1.文档放在master分支,作为一个子目录. 仓库:https://github.com/Ourpalm/ILRunti ...
- Readthedocs+Github搭建文档
一.文档撰写前提 环境部署: > git clone https://github.com/toooney/demo-readthedocs.git > pip install sphin ...
- 推荐一个vuepress模板,一键快速搭建文档站
介绍 vuepress-template是一个简单的VuePress案例模板,目的是让用户可以直接clone这个仓库,作为初始化一个VuePress网站启动项目,然后在这个项目的基础上新增自定义配置和 ...
随机推荐
- Python入门-Hello Word
1.python语言介绍 Python创始人:Guido Van Rossum 2.python是一种解释型.动态类型计算机程序设计语言. 解释型:程序无需编译成二进制代码,而是在执行时对语句一条一条 ...
- c++之sizeof的用法
在此温习一下c语言中sizeof的用法以及c++11.0的标准中,关于初始化的新方式,先上代码: # include "iostream" # include "stri ...
- Zabbix appliance manual
https://www.zabbix.com/documentation/4.0/manual/appliance If the appliance fails to start up in Hype ...
- IdentityServer4【Topic】之登陆注册
Sign-in 登陆注册 为了让标识服务器(identity server)代表用户发出令牌,该用户必须登录到标识服务器. Cookie authentication Cookie认证 身份验证是由来 ...
- vue二次实战(二)
https://www.cnblogs.com/jellify/p/9522477.html install的弹出框中输入sublimeTmpl,找到sublimeTmpl这个插件后回车 Vue路由 ...
- git上传本地代码到github
1.(先进入项目文件夹)通过命令 git init 把这个目录变成git可以管理的仓库 git init 2.把文件添加到版本库中,使用命令 git add .添加到暂存区里面去,不要忘记后面的小 ...
- Linux 文件及目录管理命令基础
pwd 显示当前所在目录 cd 切换目录 cd 命令语法 cd [选项] 目录 cd 的常用选项: cd ~ /cd 切换到当前用户的加目录 cd . 保持当前目录不变 cd .. 切换到上级目录 ...
- elasticsearch介绍,安装,安装错误解决及相应插件安装
一.elasticsearch介绍 1.简介(使用的是nosql,更新比mongodb慢): ElasticSearch是一个基于Lucene的搜索服务器.它提供了一个分布式多用户能力的全文搜索引擎, ...
- 集合之HashSet(含JDK1.8源码分析)
一.前言 我们已经分析了List接口下的ArrayList和LinkedList,以及Map接口下的HashMap.LinkedHashMap.TreeMap,接下来看的是Set接口下HashSet和 ...
- SSH的使用
1.如何设置SSH的超时时间 使用SSH客户端软件登录linux服务器后,执行 echo $TMOUT可以查看SSH链接超时时间: 使用vim /etc/profile可以编辑配置页面 修改TMOUT ...