1. 下载安装包并解压
安装包下载地址:https://elasticsearch.cn/download/
这里我使用的6.6.0版本;
使用wget命令或者下载到本地后复制到机器上,wget命令如下:
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.6.0.tar.gz
解压安装包到自己想要放置的目录
2. 环境配置
2.1 设置内核参数
# 需要root权限
vim /etc/sysctl.conf
# 添加如下内容
fs.file-max=655366
vm.max_map_count = 262144
# 使用 sysctl -p 刷新配置,sysctl -a 查看是否生效,如果不生效,可能会启动es会失败,可以使用下边的命令
rm -f /sbin/modprobe
ln -s /bin/true/sbin/modprobe
rm -f /sbin/sysctl
ln -s /bin/true/sbin/sysctl
2.2 设置资源参数
vi /etc/security/limits.conf
添加一下内容,
* soft nofile 65535
* hard nofile 131072
* soft nproc 2048
* hard nproc 4096
2.3 修改进程数
vi /etc/security/limits.d/20-nproc.conf
* soft nproc 4096
配置完成后,重新打开新的窗口,则前边的配置对当前用户不生效
3 配置并启动ElasticSearch
3.1 配置elasticsearch.yml文件
# Use a descriptive name for your cluster:
cluster.name: my-es-app
# Use a descriptive name for the node:
node.name: node-171
# Set the bind address to a specific IP (IPv4 or IPv6):
network.host: 0.0.0.0
# Set a custom port for HTTP:
http.port: 19200
# For more information, consult the network module documentation.
transport.tcp.port: 19300
#discovery.zen.ping.unicast.hosts: ["127.0.0.1:9300"]
#discovery.zen.minimum_master_nodes: 3
http.cors.enabled: true
http.cors.allow-origin: "*"
#这两个配置必须要由
bootstrap.memory_lock: false
bootstrap.system_call_filter: false
3.2 修改jvm.conf配置文件
# Xms represents the initial size of total heap space
# Xmx represents the maximum size of total heap space
-Xms512m
-Xmx512m
3.3 启动elasticsearch
./bin/elasticsearch
# 后台启动
./bin/elasticsearch -d
由于需要非root用户才能启动,需要看新增的用户时候有各个文件的权限
使用 ps aux | grep elas 查看是否启动成功
4. 安装 kibana
下载安装包
wget https://artifacts.elastic.co/downloads/kibana/kibana-6.6.0-linux-x86_64.tar.gz
解压后,修改config目录下的kibana.yaml文件
server.port: 15601
server.host: "0.0.0.0"
elastucsearch.hosts: ["http://localhost:18200"]