Elasticsearch 单机部署

Elasticsearch 单机部署,第1张

Elasticsearch 单机部署

下载Elasticsearch
地址: https://www.elastic.co/cn/downloads/elasticsearch 最新版本

1.解压三个tar.gz文件

tar -zxvf jdk-8u171-linux-x64.tar.gz
tar -zxvf elasticsearch-7.3.0-linux-x86_64.tar.gz

2.配置jdk环境变量

vim /etc/profile

在profile结尾添加如下内容:

export JAVA_HOME=/opt/yyjzy/servers/jdk1.8.0_231
export CLASSPATH=$:CLASSPATH:$JAVA_HOME/lib/
export PATH=$PATH:$JAVA_HOME/bin

修改生效:

source /etc/profile

检查jdk

java -version

jdk配置完成!

配置Elasticsearch

1.编辑vim /opt/yyjzy/servers/elasticsearch-7.3.0
/config/elasticsearch.yml ,注意冒号后面有个空格。

vim /opt/yyjzy/servers/elasticsearch-7.3.0
/config/elasticsearch.yml 

单机安装请取消注释:node.name: node-1,否则无法正常启动
修改网络和端口,取消注释master节点,单机只保留一个node

node.name: node-1
network.host: 192.168.211.136
#
# Set a custom port for HTTP:
#
http.port: 9200
cluster.initial_master_nodes: ["node-1"]

2.按需修改vim /opt/yyjzy/servers/elasticsearch-7.3.0/config/jvm.options内存设置

vim /opt/yyjzy/servers/elasticsearch-7.3.0/config/jvm.options

根据实际情况修改占用内存,默认都是1G,单机1G内存,启动会占用700m+然后在安装kibana 后,基本上无法运行了,运行了一会就挂了报内存不足。 内存设置超出物理内存,也会无法启 动,启动报错。

-Xms1g
-Xmx1g

3.添加es用户,es默认root用户无法启动,需要改为其他用户

useradd  estest
修改密码
passwd   estest

改变es目录拥有者账号

chown -R estest  /opt/yyjzy/servers/elasticsearch-7.3.0

4.修改/etc/sysctl.conf

vim /etc/sysctl.conf

末尾添加:vm.max_map_count=655360

执行sysctl -p 让其生效

sysctl -p

5.修改/etc/security/limits.conf

vim /etc/security/limits.conf

末尾添加:

*               soft    nofile          65536
*               hard    nofile          65536
*               soft    nproc           4096
*               hard    nproc           4096

6.启动es

切换刚刚新建的用户

su estest

启动命令

/opt/yyjzy/servers/elasticsearch-7.3.0/bin/elasticsearch

7.配置完成:浏览器访问测试。 ip:9200
页面会返回一个json字符串
{
“name” : “node-1”,
“cluster_name” : “elasticsearch”,
“cluster_uuid” : “Fr8NPTEkSFCbNAJHwaCdsw”,
“version” : {
“number” : “7.3.0”,
“build_flavor” : “default”,
“build_type” : “tar”,
“build_hash” : “de777fa”,
“build_date” : “2019-07-24T18:30:11.767338Z”,
“build_snapshot” : false,
“lucene_version” : “8.1.0”,
“minimum_wire_compatibility_version” : “6.8.0”,
“minimum_index_compatibility_version” : “6.0.0-beta1”
},
“tagline” : “You Know, for Search”
}

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/zaji/5678776.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-17
下一篇 2022-12-17

发表评论

登录后才能评论

评论列表(0条)

保存