一、安装准备
1、ES安装包
Elasticsearch下载,选择Linux版本。
地址: https://www.elastic.co/cn/downloads/elasticsearch
2、安装JDK环境
根据ES版本选择jdk版本。
地址: https://www.elastic.co/cn/support/matrix#matrix_jvm
到Oracle官网下载jdk。
地址: https://www.oracle.com/technetwork/java/javase/downloads/index.html
3、环境变量配置
vi /etc/profile
在文件尾部加入如下内容:
export JAVA_HOME=java目录
export JRE_HOME=/$JAVA_HOME/jre
export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin
通过source命令重新加载/etc/profile文件,使得修改后的内容生效,命令如下。
source /etc/profile
输入java –version查看jdk版本,输出成功,这代表安装成功。
二、Elasticsearch安装配置
1、Elasticsearch安装
解压
tar -zxvf elasticsearch-7.10.0-linux-86_64.tar.gz
同样为了后续使用方面将解压后的目录文件重命名为elasticsearch,重命名命令如下。
mv elasticsearch-7.10.0 elasticsearch
mkdir -pv 目录/data/es/{data,logs} # 创建数据和日志目录
配置目录用户及权限(新版ES不支持root用户启动,我使用的es用户)
useradd es #创建用户 es
groupadd es #创建组es
useradd es -g es #将用户添加到组
修改文件所有者
chown -R es:es /data/es/
chown -R es:es 安装目录
2、系统参数修改
设置内核参数
vi /etc/sysctl.conf
增加以下参数:
vm.max_map_count=655360
执行以下命令确保配置生效。
sysctl -p
设置资源参数
vi /etc/security/limits.conf
修改如下:
* soft nofile 65536
* hard nofile 65536
* soft nproc 4096
* hard nproc 4096
设置用户资源参数
vi /etc/security/limits.d/20-nproc.conf
* soft nproc 4096
*代表所有用户,可改为Elasticsearch运行用户
3、Elasticsearch配置
修改 安装目录/config/elasticsearch.yml
# ======================== 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 : ess
#
# ------------------------------------ Node ------------------------------------
#
# Use a descriptive name for the node:
#节点
node.name : es-1
#
# 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 : /data/esdata
#
# Path to log files:
#日志存储目录
path.logs : /data/eslogs
#
# ----------------------------------- 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 -----------------------------------
#
# Set the bind address to a specific IP (IPv4 or IPv6):
#ip 主服务设置为0.0.0.0便于外网访问
network.host : 0.0.0.0
#
# Set a custom port for HTTP:
#端口号
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]"]
#集群节点ip
#discovery.seed_hosts: ["host1", "host2"]
#
# Bootstrap the cluster using an initial set of master-eligible nodes:
#集群节点
cluster.initial_master_nodes: ["es-1"]
#
# For more information, consult the discovery and cluster formation module documentation.
#
# ---------------------------------- Gateway -----------------------------------
#
# Block initial recovery after a full cluster restart until N nodes are started:
#
#gateway.recover_after_nodes: 3
#
# For more information, consult the gateway module documentation.
#
# ---------------------------------- Various -----------------------------------
#
# Require explicit names when deleting indices:
#
#action.destructive_requires_name: true
4、启动
安装目录下bin目录下执行
./elasticsearch -d #-d或者&是以守护进程方式开启
ps -ef | grep elasticsearch #查看ES进程
5、访问
ip:9200
结果:
{
"name" : "es-1",
"cluster_name" : "ess",
"cluster_uuid" : "nT_Uz_tvQRqpFGjnjDeUCA",
"version" : {
"number" : "7.6.2",
"build_flavor" : "default",
"build_type" : "tar",
"build_hash" : "ef48eb35cf30adf4db14086e8aabd07ef6fb113f",
"build_date" : "2020-03-26T06:34:37.794943Z",
"build_snapshot" : false,
"lucene_version" : "8.4.0",
"minimum_wire_compatibility_version" : "6.8.0",
"minimum_index_compatibility_version" : "6.0.0-beta1"
},
"tagline" : "You Know, for Search"
}
2 comments
看到你的文章,我仿佛感受到了生活中的美好。 https://www.yonboz.com/video/83265.html
《一路繁花相送》国产剧高清在线免费观看:https://www.jgz518.com/xingkong/40148.html