官网
下载es安装包
下载Kibana
下载ik分词器
一、elasticsearch的安装
选择一个文件夹,创建elasticsearch和kibana文件夹
# 创建elasticsearch用来安装es服务
mkdir /usr/local/elasticsearch
# 创建kibana,kibana可以理解为一个操作es的可视化界面
mkdir /usr/local/kibana
#将下载好的es和kibana安装包分别放到对应的文件夹内
#解压es
tar -zxvf elasticsearch-7.13.0-linux-x86_64.tar.gz
#解压kibana
修改 elasticsearch.yml
# 进入目录
/usr/local/elasticsearch/elasticsearch-7.13.0/config
#编辑elasticsearch.yml文件
vim elasticsearch.yml
elasticsearch.yml修改后
# ======================== Elasticsearch Configuration =========================
# ---------------------------------- Cluster -----------------------------------
#
# 集群名,同一集群名称必须一样,es启动的时候,会把相同名称的放在同一个集群下,这里单台不做集群
cluster.name: elasticsearch-test
#
# ------------------------------------ Node ------------------------------------
#
# 当前节点名,默认就行了
node.name: node-1
#
# ----------------------------------- Paths ------------------------------------
#
# Path to directory where to store the data (separate multiple locations by comma):
# 设置索引数据的存储路径
path.data: /usr/local/elasticsearch/data
#
# Path to log files:
# 设置日志文件的存储路径
path.logs: /usr/local/elasticsearch/logs
#
# ----------------------------------- Memory -----------------------------------
#
# Lock the memory on startup:
# 关闭自我检测
bootstrap.memory_lock: false
bootstrap.system_call_filter: false
# ---------------------------------- Network -----------------------------------
#
# 当前节点绑定的ip,我这里设置虚拟机的ip
network.host: 192.168.19.130
#
# By default Elasticsearch listens for HTTP traffic on the first free port it
# finds starting at 9200. Set a specific HTTP port here:
# 端口默认9200,9200是用来浏览器访问的端口,9300是集群节点间通信的端口
http.port: 9200
# 对应node.name
cluster.initial_master_nodes: ["node-1"]
修改es的config目录下的jvm.options,因为默认内存太大了,xms和xmx要设置成一样的数值,注意这里的-Xms512m的一行,前面不能有空格
################################################################
##
## The heap size is automatically configured by Elasticsearch
## based on the available memory in your system and the roles
## each node is configured to fulfill. If specifying heap is
## required, it should be done through a file in jvm.options.d,
## and the min and max should be set to the same value. For
## example, to set the heap to 4 GB, create a new file in the
## jvm.options.d directory containing these lines:
##
-Xms512m
-Xmx512m
##
## See https://www.elastic.co/guide/en/elasticsearch/reference/current/heap-size.html
## for more information
##
################################################################
创建es的启动用户,因为es不允许通过root启动
image.png
# 创建用户
useradd es -p 123456
# 更改 目录文件夹及内部文件的所属用户
chown -R es /usr/local/elasticsearch/
启动es
/usr/local/elasticsearch/elasticsearch-7.13.0/bin
./elasticsearch
报错
vim /etc/sysctl.conf
# 在结尾添加
vm.max_map_count=262144
# 刷新配置
sysctl -p
image.png
再次启动es
/usr/local/elasticsearch/elasticsearch-7.13.0/bin
./elasticsearch
启动成功
开放9200端口,访问
安装成功访问
http://ip:9200
二、kibana的安装,注意kibana和head插件都是可视化界面,两个都可以安装
进入目录修改配置文件
cd /usr/local/kibana/kibana-7.13.0-linux-x86_64/config
vim kibana.yml
# Kibana is served by a back end server. This setting specifies the port to use.
server.port: 5601
# Specifies the address to which the Kibana server will bind. IP addresses and host names are both valid values.
# The default is 'localhost', which usually means remote machines will not be able to connect.
# To allow connections from remote users, set this parameter to a non-loopback address.
server.host: "0.0.0.0"
# Enables you to specify a path to mount Kibana at if you are running behind a proxy.
# Use the `server.rewriteBasePath` setting to tell Kibana if it should remove the basePath
# from requests it receives, and to prevent a deprecation warning at startup.
# This setting cannot end in a slash.
#server.basePath: ""
# Specifies whether Kibana should rewrite requests that are prefixed with
# `server.basePath` or require that they are rewritten by your reverse proxy.
# This setting was effectively always `false` before Kibana 6.3 and will
# default to `true` starting in Kibana 7.0.
#server.rewriteBasePath: false
# Specifies the public URL at which Kibana is available for end users. If
# `server.basePath` is configured this URL should end with the same basePath.
#server.publicBaseUrl: ""
# The maximum payload size in bytes for incoming server requests.
#server.maxPayload: 1048576
# The Kibana server's name. This is used for display purposes.
#server.name: "your-hostname"
# The URLs of the Elasticsearch instances to use for all your queries.
elasticsearch.hosts: ["http://192.168.19.130:9200"]
# Kibana uses an index in Elasticsearch to store saved searches, visualizations and
# dashboards. Kibana creates a new index if the index doesn't already exist.
kibana.index: ".kibana"
# The default application to load.
#kibana.defaultAppId: "home"
# If your Elasticsearch is protected with basic authentication, these settings provide
# the username and password that the Kibana server uses to perform maintenance on the Kibana
# index at startup. Your Kibana users still need to authenticate with Elasticsearch, which
# is proxied through the Kibana server.
#elasticsearch.username: "kibana_system"
#elasticsearch.password: "pass"
# Enables SSL and paths to the PEM-format SSL certificate and SSL key files, respectively.
# These settings enable SSL for outgoing requests from the Kibana server to the browser.
#server.ssl.enabled: false
#server.ssl.certificate: /path/to/your/server.crt
#server.ssl.key: /path/to/your/server.key
# Optional settings that provide the paths to the PEM-format SSL certificate and key files.
# These files are used to verify the identity of Kibana to Elasticsearch and are required when
# xpack.security.http.ssl.client_authentication in Elasticsearch is set to required.
#elasticsearch.ssl.certificate: /path/to/your/client.crt
#elasticsearch.ssl.key: /path/to/your/client.key
# Optional setting that enables you to specify a path to the PEM file for the certificate
# authority for your Elasticsearch instance.
#elasticsearch.ssl.certificateAuthorities: [ "/path/to/your/CA.pem" ]
# To disregard the validity of SSL certificates, change this setting's value to 'none'.
#elasticsearch.ssl.verificationMode: full
# Time in milliseconds to wait for Elasticsearch to respond to pings. Defaults to the value of
# the elasticsearch.requestTimeout setting.
#elasticsearch.pingTimeout: 1500
# Time in milliseconds to wait for responses from the back end or Elasticsearch. This value
# must be a positive integer.
#elasticsearch.requestTimeout: 30000
# List of Kibana client-side headers to send to Elasticsearch. To send *no* client-side
# headers, set this value to [] (an empty list).
#elasticsearch.requestHeadersWhitelist: [ authorization ]
# Header names and values that are sent to Elasticsearch. Any custom headers cannot be overwritten
# by client-side headers, regardless of the elasticsearch.requestHeadersWhitelist configuration.
#elasticsearch.customHeaders: {}
# Time in milliseconds for Elasticsearch to wait for responses from shards. Set to 0 to disable.
#elasticsearch.shardTimeout: 30000
# Logs queries sent to Elasticsearch. Requires logging.verbose set to true.
#elasticsearch.logQueries: false
# Specifies the path where Kibana creates the process ID file.
#pid.file: /run/kibana/kibana.pid
# Enables you to specify a file where Kibana stores log output.
#logging.dest: stdout
# Set the value of this setting to true to suppress all logging output.
#logging.silent: false
# Set the value of this setting to true to suppress all logging output other than error messages.
#logging.quiet: false
# Set the value of this setting to true to log all events, including system usage information
# and all requests.
#logging.verbose: false
# Set the interval in milliseconds to sample system and process performance
# metrics. Minimum is 100ms. Defaults to 5000.
#ops.interval: 5000
# Specifies locale to be used for all localizable strings, dates and number formats.
# Supported languages are the following: English - en , by default , Chinese - zh-CN .
#i18n.locale: "en"
xpack.reporting.capture.browser.chromium.disableSandbox: false
用root用户启动
# 进入到bin目录
./kibana --allow-root
启动成功
三、安装ik分词器
# 在es的安装包下的plugins文件夹下创建文件夹
/usr/local/elasticsearch/elasticsearch-7.13.0/plugins/ik
# 将压缩包拷贝到ik目录下,然后解压
unzip elasticsearch-analysis-ik-7.13.0.zip
# 这次让es后台启动
./elasticsearch -d
#重启kibana后台启动
nohup ../kibana-7.13.0-linux-x86_64/bin/kibana --allow-root &
出现这行提示,按下回车即可
查看分词效果查看分词效果
更多ik分词器测试命令
网友评论