ElasticSearch8.0.0安装(一)
一、运行环境
centos7.0
JDK1.8
二、安装过程
2.1.ElasticSearch8.0.0下载
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-8.0.0-linux-x86_64.tar.gz
2.创建ES用户
#不可使用root用户直接启动elasticsearch,需要创建一个用户来启动ES。 $ groupadd es $ useradd -g es es $ passwd es
3.解压ElasticSearch8.0.0
#解压缩 $tar -zxvf elasticsearch-8.0.0-linux-x86_64.tar.gz #移动到/home/es下 $mv elasticsearch-8.0.0 /usr/local/es/es8 #授权给es用户组和es用户 $chown -R es:es /usr/local/es/es8
4.修改elasticsearch.yml
cluster.name: es8 node.name: node-1 node.attr.rack: r1 # 设置数据目录 path.data: /usr/local/es/es8/data # # Path to log files: path.logs: /usr/local/es/es8/log # network.host: 0.0.0.0 # # By default Elasticsearch listens for HTTP traffic on the first free port it # finds starting at 9200. Set a specific HTTP port here: # 设置端口号 http.port: 9200 # 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"] # # Bootstrap the cluster using an initial set of master-eligible nodes: # cluster.initial_master_nodes: ["node-1", "node-2"] # #开启xpack xpack.security.enabled: false xpack.security.transport.ssl.enabled: false #允许跨域 http.cors.enabled: true http.cors.allow-origin: "*" http.cors.allow-headers: Authorization,X-Requested-With,Content-Type,Content-Length
5.切换es用户
su es
6.启动elasticsearch
#进入es/bin目录 $cd /usr/local/es/es8/bin #启动es $./elasticsearch
7.设置防火墙 配置防火墙和网络访问 开放Elasticsearch端口: 默认情况下,Elasticsearch使用9200端口进行HTTP通信。你需要确保防火墙规则允许对该端口的入站连接。 使用firewall-cmd命令开放端口:(或者直接关闭防火墙。)
sudo firewall-cmd --zone=public --add-port=9200/tcp --permanent sudo firewall-cmd --reload
8.浏览器访问elasticsearch
至此,elasticsearch8.0.0安装完成!