CentOS7安装ElasticSearch

CentOS7
在这里插入图片描述
ElasticSearch7.8
官网下载,https://www.elastic.co/cn/downloads/
在这里插入图片描述
在这里插入图片描述
上传到
在这里插入图片描述
解压
cd /soft/elastic
tar -zxvf elasticsearch-7.8.0-linux-x86_64.tar.gz
mv elasticsearch-7.8.0-linux-x86_64 /home/elasticsearch
在这里插入图片描述
adduser news
cd /home
mkdir -p elastic/data
mkdir -p elastic/logs
chown -R news elasticsearch
chown -R news elastic
接下来非常重要
cd /home/elasticsearch/conf/
vim 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: my-application
#
# ------------------------------------ Node ------------------------------------
#
# Use a descriptive name for the node:
#
node.name: node-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: /path/to/data
path.data: /home/elastic/data
#
# Path to log files:
#
#path.logs: /path/to/logs
path.logs: /home/elastic/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 -----------------------------------
#
# Set the bind address to a specific IP (IPv4 or IPv6):
#
#network.host: 192.168.0.1
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]"]
#
#discovery.seed_hosts: ["host1", "host2"]
discovery.zen.ping.unicast.hosts: ["host1", "host2"]
#
# Bootstrap the cluster using an initial set of master-eligible nodes:
#
#cluster.initial_master_nodes: ["node-1", "node-2"]
cluster.initial_master_nodes: ["node-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: 1
#
# For more information, consult the gateway module documentation.
#
# ---------------------------------- Various -----------------------------------
#
# Require explicit names when deleting indices:
#my
action.destructive_requires_name: true
xpack.ml.enabled: false

接下来配置一些内核参数

vim /etc/security/limits.conf

到文件末尾添加如下内容

esuser hard nofile 65536
esuser soft nofile 65536
esuser soft memlock unlimited
esuser hard memlock unlimited

为了防止报错[65530] is too low, increase to at least [262144]
修改vim /etc/sysctl.conf 文件,在末尾添加 vm.max_map_count
使生效:sysctl -p
vim /etc/security/limits.d/def.conf文件尾添加

  • soft nofile 204800
  • hard nofile 204800
    让news用户具有和root一样的权限,visudo,添加如下,保存并退出。
    在这里插入图片描述

错误:JVM is using the client VM [Java HotSpot™ Client VM] but should be using a server VM for the best performance

修改文件
JAVA_HOME\jre\lib\i386\jvm.cfg
-server KNOWN //原来在第二行
-client IF_SERVER_CLASS -server
-minimal KNOWN

错误
unable to load JNA native support library, native methods will be disabled.
java.lang.UnsatisfiedLinkError: Native library (com/sun/jna/linux-x86/libjnidispatch.so) not found

解决办法
直接删除或备份Elasticsearch-a.b.c/lib目录下面的jna文件:
mv jna-4.5.1.jar jna-4.5.1.jar.bak
在lib目录下载:
wget http://repo1.maven.org/maven2/net/java/dev/jna/jna/5.0.0/jna-5.0.0.jar
在这里插入图片描述
执行如下命令

在这里插入图片描述
没有报错,如果报错,要去找到日志,拖到windows下查看,效果明显。
日志目录 /home/elastic/logs

打开浏览器
在这里插入图片描述

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

汤永红

一分也是爱

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值