es7.4安装
Posted hxlasky
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了es7.4安装相关的知识,希望对你有一定的参考价值。
环境:
OS:Centos 7
ES:7.4.2
1.下载二进制安装包
我这里下载的是:elasticsearch-7.4.2-linux-x86_64.tar.gz
2.解压缩并创建数据目录
[root@localhost soft]# tar -xvf elasticsearch-7.4.2-linux-x86_64.tar.gz
[root@localhost soft]# mv elasticsearch-7.4.2 /opt/
[root@localhost soft]#cd /opt/elasticsearch-7.4.2
3.创建用户
因为启动es不能在root用户下启动,所以要事先创建非root用户
[root@localhost opt]# useradd esuser
[root@localhost opt]# chown -R esuser.esuser ./elasticsearch-7.4.2/
4.修改配置文件
[esuser@localhost config]$ more elasticsearch.yml
##集群名称
cluster.name: my-application
#
# ------------------------------------ Node ------------------------------------
#
# Use a descriptive name for the node:
#节点名称
node.name: node-1
# Path to directory where to store the data (separate multiple locations by comma):
#数据目录
path.data: /opt/elasticsearch-7.4.2/data
#日志目录
path.logs: /opt/elasticsearch-7.4.2/logs
#
# Set the bind address to a specific IP (IPv4 or IPv6):
## 设置绑定的ip,设置为本机的ip
network.host: 192.168.1.118
# Set a custom port for HTTP:
#端口
http.port: 9200
#设置在集群中的所有节点名称,这个节点名称就是之前所修改的,当然你也可以采用默认的也行,目前是单机,放入一个节点即可
#注意这里,如果目前是单节点的话,一定要修改该值为节点的名称,否则虽然启动成功了,但是通过curl命令向elasticsearch服务中新增数据时,会出现 "master_not_discovered_exception"错误
cluster.initial_master_nodes: ["node-1"]
xpack.security.transport.ssl.enabled: true
xpack.security.enabled: true
5.启动
[esuser@localhost bin]$ ./elasticsearch -d
OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.
6.设置密码
6.8之后的版本,x-pack已经免费,不需要单独破解
[esuser@localhost bin]$ ./elasticsearch-setup-passwords interactive
Initiating the setup of passwords for reserved users elastic,apm_system,kibana,logstash_system,beats_system,remote_monitoring_user.
You will be prompted to enter passwords as the process progresses.
Please confirm that you would like to continue [y/N]y
Enter password for [elastic]:
Reenter password for [elastic]:
Enter password for [apm_system]:
Reenter password for [apm_system]:
Enter password for [kibana]:
Reenter password for [kibana]:
Enter password for [logstash_system]:
Reenter password for [logstash_system]:
Enter password for [beats_system]:
Reenter password for [beats_system]:
Enter password for [remote_monitoring_user]:
Reenter password for [remote_monitoring_user]:
Changed password for user [apm_system]
Changed password for user [kibana]
Changed password for user [logstash_system]
Changed password for user [beats_system]
Changed password for user [remote_monitoring_user]
Changed password for user [elastic]
7.验证
[esuser@localhost bin]$ curl -u elastic:elastic http://192.168.1.118:9200/?pretty
{
"name" : "node-1",
"cluster_name" : "elasticsearch",
"cluster_uuid" : "zbra9WCcRZGZ_DdsBDX7eg",
"version" : {
"number" : "7.4.2",
"build_flavor" : "default",
"build_type" : "tar",
"build_hash" : "2f90bbf7b93631e52bafb59b3b049cb44ec25e96",
"build_date" : "2019-10-28T20:40:44.881551Z",
"build_snapshot" : false,
"lucene_version" : "8.2.0",
"minimum_wire_compatibility_version" : "6.8.0",
"minimum_index_compatibility_version" : "6.0.0-beta1"
},
"tagline" : "You Know, for Search"
}
[esuser@localhost bin]$ curl -u elastic:elastic "192.168.1.118:9200/_license"
{
"license" : {
"status" : "active",
"uid" : "d1db35c6-7537-4aba-b480-530e61b8099b",
"type" : "basic",
"issue_date" : "2019-12-17T06:13:25.909Z",
"issue_date_in_millis" : 1576563205909,
"max_nodes" : 1000,
"issued_to" : "elasticsearch",
"issuer" : "elasticsearch",
"start_date_in_millis" : -1
}
}
-- The End --
以上是关于es7.4安装的主要内容,如果未能解决你的问题,请参考以下文章