elasticsearch-7.8安装

下载

可以从 elastic 的官网 elastic.co/downloads/elasticsearch 获取最新版本的 Elasticsearch。

部署

  1. 在服务器上直接解压es压缩包;
  2. 创建elasticsearch用户(用于elasticsearch服务启动);
adduser elasticsearch
passwd elasticsearch
chown -R elasticsearch elasticsearch-7.8.0 给es用户赋权
  1. 修改配置文件的IP、端口等信息;
  2. 后台启动
 ./elasticsearch -d
  1. 查看是否成功
http://localhost:9200

问题1:
max file descriptors [4096] for elasticsearch process is too low, increase to at least [65535]
每个进程同时打开文件数太小ulimit -Hn ulimit -Sn 命令查看
修改/etc/security/limits.conf文件,增加配置,用户退出后重新登录生效

soft    nofile          65536
hard    nofile          65536

问题2:
max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
修改/etc/sysctl.conf文件,增加配置vm.max_map_count=262144

vi /etc/sysctl.conf
sysctl -p

安装elasticsearch-head

1、安装node.js
下载地址:https://nodejs.org/en/download/
tar -xJf node-v10.16.3-linux-x64.tar.xz

vi /etc/profile
export NODE_HOME=/usr/local/node-v10.16.3-linux-x64
export PATH=$NODE_HOME/bin:$PATH
source /etc/profile

2、配置elasticsearch,允许head插件远程访问

cd /opt/es/elasticsearch-7.8.0/config
vi elasticearch.yml

在配置文件末尾添加如下内容,重新启动elasticsearch服务

http.cors.enabled: true
http.cors.allow-origin: "*"

安装grunt

npm install -g grunt

3、启动elastic-search-master

npm install
npm run start
nohup npm run start & # 后端运行
curl -X GET http://localhost:9100/

中文分词插件

下载地址:
https://github.com/medcl/elasticsearch-analysis-ik
在plugins下创建文件夹

mkdir ik

解压到plugins/ik中 重启es

curl -X GET -H "Content-Type: application/json"  "http://localhost:9200/_analyze?pretty=true" -d'{"text":"中华五千年华夏"}';

效果:

{
  "tokens" : [
    {
      "token" : "中",
      "start_offset" : 0,
      "end_offset" : 1,
      "type" : "<IDEOGRAPHIC>",
      "position" : 0
    },
    {
      "token" : "华",
      "start_offset" : 1,
      "end_offset" : 2,
      "type" : "<IDEOGRAPHIC>",
      "position" : 1
    },
    {
      "token" : "五",
      "start_offset" : 2,
      "end_offset" : 3,
      "type" : "<IDEOGRAPHIC>",
      "position" : 2
    },
    {
      "token" : "千",
      "start_offset" : 3,
      "end_offset" : 4,
      "type" : "<IDEOGRAPHIC>",
      "position" : 3
    },
    {
      "token" : "年",
      "start_offset" : 4,
      "end_offset" : 5,
      "type" : "<IDEOGRAPHIC>",
      "position" : 4
    },
    {
      "token" : "华",
      "start_offset" : 5,
      "end_offset" : 6,
      "type" : "<IDEOGRAPHIC>",
      "position" : 5
    },
    {
      "token" : "夏",
      "start_offset" : 6,
      "end_offset" : 7,
      "type" : "<IDEOGRAPHIC>",
      "position" : 6
    }
  ]
}

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值