Centos安装Elasticsearch环境

由于Es是Java写的,安装ES的前提先安装好JDK。
 

Es环境搭建:

1.下载ES包上传到服务器,下载地址:
 
Centos安装Elasticsearch环境
2.解压下载的Tar包

[ software]# tar -zxvf elasticsearch-7.6.0-linux-x86_64.tar.gz

3.重命名文件夹名称

[ software]# mv elasticsearch-7.6.0 elasticsearch

4.进入elasticsearch目录下

[ software]# cd elasticsearch

5.根据自身条件调整JVM大小

[ elasticsearch]# vim config/jvm.options

# Xms 表示总堆空间的初始大小 --默认1G
# Xmx 表示总堆空间的最大大小 --默认1G
-Xms1g

-Xmx1g

5.修改elasticsearch.yml配置

[ elasticsearch]# vim config/elasticsearch.yml

# Set the bind address to a specific IP (IPv4 or IPv6):
# 取消注释,服务器IP地址
network.host: 192.168.0.1
#
# Set a custom port for HTTP:
# 取消注释,Restful 对外接口提供的端口
http.port: 9200
#
# For more information, consult the network module documentation.
#
# Bootstrap the cluster using an initial set of master-eligible nodes:
# 取消注释,目前单台机器部署,只需保留node-1节点即可

cluster.initial_master_nodes: ["node-1"]

6.由于elasticsearch安全性问题不能使用root启动,如需启动则新建用户,并赋予文件夹权限或者启动命令后追加 --allow-root
[ elasticsearch]# groupadd esgroup # "eschenxi" (组名)
[ elasticsearch]# useradd esuser # "eschenxi" (用户名)

[ elasticsearch]# chown -R eschenxi:esgroup /chenxi/software/elasticsearch #"/chenxi/software/elasticsearch" 为安装目录

7.切换用户

[ elasticsearch]# su esuser

8.启动ES

[ elasticsearch]# bin/elasticsearch

#保持后台运行增加-d即可
[ elasticsearch]# bin/elasticsearch -d
#查看es日志

[ elasticsearch]# tail -f  logs/elasticsearch.log

##注意防火墙开启9200端口

测试Es启动是否正常:

http://IP:9092

{
     "name" : "chenxi",
     "cluster_name" : "elasticsearch",
     "cluster_uuid" : "_na_",
     "version" : {
               "number" : "7.6.0",
                "build_flavor" : "default",
                "build_type" : "tar",
                "build_hash" : "7f634e9f44834fbc12724506cc1da681b0c3b1e3",
                "build_date" : "2020-02-06T00:09:00.449973Z",
                "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"

}

Es启动常见问题http://chenxitag.es.problem.com

相关推荐