liunx安装es和ik分词器,kibana

本文档详细介绍了如何在Linux上安装Elasticsearch 7.14.2版本,包括下载、解压、配置YML文件、修改系统参数、启动服务等步骤。同时,指导了安装IK分词器和Kibana的过程,包括配置Kibana连接Elasticsearch的地址以及启动Kibana。完成这些步骤后,可以通过访问Linux IP的9200端口验证Elasticsearch是否正常运行。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

liunx安装es和ik分词器,kibana

1、到es官网下载压缩文件

https://www.elastic.co/cn/downloads/elasticsearch

2、选择对应的版本,如果选择低版本的话可以点击 View past releases跳转到查看历史版本来下载(我这里选择的是 7.14.2版本,注意下载ik分词器时也是该版本)
3、上传到Liunx中,我这里选择的是 /usr/local文件夹下
4、解压

cd /usr/local
tar -zxvf elasticsearch-7.14.2-linux-x86_64.tar.gz

4、修改 yml 配置文件等等 (可以复制下面的直接粘贴到elasticsearch.yml文件中,注意是整个文件内容)
属性说明如下

elasticsearch.yml的其它可配置信息:
属性名 说明
cluster.name 配置elasticsearch的集群名称,默认是elasticsearch。建议修改成一个有意义的名称。
node.name 节点名,es会默认随机指定一个名字,建议指定一个有意义的名称,方便管理
path.conf 设置配置文件的存储路径,tar或zip包安装默认在es根目录下的config文件夹,rpm安装默认在/etc/ elasticsearch
path.data 设置索引数据的存储路径,默认是es根目录下的data文件夹,可以设置多个存储路径,用逗号隔开
path.logs 设置日志文件的存储路径,默认是es根目录下的logs文件夹
path.plugins 设置插件的存放路径,默认是es根目录下的plugins文件夹
bootstrap.memory_lock 设置为true可以锁住ES使用的内存,避免内存进行swap
network.host 设置bind_host和publish_host,设置为0.0.0.0允许外网访问
http.port 设置对外服务的http端口,默认为9200。
transport.tcp.port 集群结点之间通信端口
discovery.zen.ping.timeout 设置ES自动发现节点连接超时的时间,默认为3秒,如果网络延迟高可设置大些
discovery.zen.minimum_master_nodes 主结点数量的最少值 ,此值的公式为:(master_eligible_nodes / 2) + 1 ,比如:有3个符合要求的主结点,那么这里要设置为2
# ======================== Elasticsearch Configuration =========================
#
# NOTE: Elasticsearch comes with reasonable defaults for most settings.
#       Before you set out to tweak and tune the configuration, make sure you
#       understand what are you trying to accomplish and the consequences.
#
# The primary way of configuring a node is via this file. This template lists
# the most important settings you may want to configure for a production cluster.
#
# Please consult the documentation for further information on configuration options:
# https://www.elastic.co/guide/en/elasticsearch/reference/index.html
#
# ---------------------------------- Cluster -----------------------------------
#
# Use a descriptive name for your cluster:
#
cluster.name: putao-es
#
# ------------------------------------ Node ------------------------------------
#
# Use a descriptive name for the node:
#
node.name: putao-node
#
# Add custom attributes to the node:
#
#node.attr.rack: r1
#
# ----------------------------------- Paths ------------------------------------
#
# Path to directory where to store the data (separate multiple locations by comma):
#
path.data: /usr/local/es/data
#
# Path to log files:
#
path.logs: /usr/local/es/logs
#
# ----------------------------------- Memory -----------------------------------
#
# Lock the memory on startup:
#
bootstrap.memory_lock: false
bootstrap.system_call_filter: false
#
# Make sure that the heap size is set to about half the memory available
# on the system and that the owner of the process is allowed to use this
# limit.
#
# Elasticsearch performs poorly when the system is swapping the memory.
#
# ---------------------------------- Network -----------------------------------
#
# By default Elasticsearch is only accessible on localhost. Set a different
# address here to expose this node on the network:
#
network.host: 0.0.0.0
#
# By default Elasticsearch listens for HTTP traffic on the first free port it
# finds starting at 9200. Set a specific HTTP port here:
#
#http.port: 9200
#
# For more information, consult the network module documentation.
#
# --------------------------------- Discovery ----------------------------------
#
# Pass an initial list of hosts to perform discovery when this node is started:
# The default list of hosts is ["127.0.0.1", "[::1]"]
#
#discovery.seed_hosts: ["host1", "host2"]
#
# Bootstrap the cluster using an initial set of master-eligible nodes:
#
cluster.initial_master_nodes: ["aliyun"]
#
# For more information, consult the discovery and cluster formation module documentation.
#
# ---------------------------------- Various -----------------------------------
#
# Require explicit names when deleting indices:
#
#action.destructive_requires_name: true

5、添加用户来启动es,并创建文件夹,因为上面的Yml配置文件中的文件夹不存在

## 添加用户
useradd 用户名字
## 给用户设置密码
passwd 用户名字

mkdir /usr/local/es/logs
mkdir /usr/local/es/data

chgrp -R 用户名字 /usr/local/es
chown -R 用户名字 /usr/local/es
chmod 777 /usr/local/es


6、修改 jvm.options 配置文件

vi jvm.options

启动参数设置如下,该行是注释掉的,打开然后修改即可。服务器配置好的可以多给点
# 初始化堆空间
-Xms256m
# 最大堆空间
-Xmx256m

7、修改系统参数,否则启动可能会报错

# 查看系统环境变量 vm.max_map_count
[root@aliyun elasticsearch]# sysctl -a | grep vm.max_map_count
vm.max_map_count = 65530

# 修改系统环境变量 vm.max_map_count
[root@aliyun elasticsearch]# vim /etc/sysctl.conf
	# 末尾添加 
	vm.max_map_count = 262144

# 配置文件修改完后需要重启才能生效 可使用下面命令使得本次启动有效
[root@aliyun ~]# sysctl -w vm.max_map_count=262144
vm.max_map_count = 262144

8、启动

su 刚刚新建的用户名字

/usr/local/elasticsearch/bin/elasticsearch -d

9、访问 liunxip:9200 出现json字符串信息表示成功,信息中包含es的版本

10、将下载好的ik分词器压缩包解压到 elasticSearch的plugs的ik目录下,ik目录需要新建

# 切换回root用户
su root
cd /usr/local/elasticsearch/plugins
mkdir ik
cd ik
# 移动到插件目录
mv /usr/local/elasticsearch-analysis-ik-7.14.2.zip /usr/local/elasticsearch/plugins/ik/
unzip elasticsearch-analysis-ik-7.14.2.zip

11、安装kibana,到官网下载解压
https://www.elastic.co/cn/downloads/kibana
12、修改es的连接地址
config文件下的 kibana.yml文件,打开后修改为如下

elasticsearch.hosts: ['http://远程服务器ip:9200']

还可以设置语言

# 设置kibana为中文
i18n.locale: "zh-CN"

13、运行 kibana.bat 即可

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值