elasticsearch启动采坑

  1. 安装

wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.3.1-linux-x86_64.tar.gz
tar -zxvf elasticsearch-*.tar.gz

  1. 启动 Run bin/elasticsearch (or bin\elasticsearch.bat on Windows)

3.坑点

  • 不能用root用户运行es,切换普通用户就好。
groupadd elk  # 创建用户组elk
useradd elk -g elk -p 111111  # 创建新用户elk,-g elk 设置其用户组为 elk,-p 111 设置其密码6个1
chown -R elk:elk /opt  # 更改 /opt 文件夹及内部文件的所属用户及组为 elk:elk
su elk # 切换到非root用户elk下来
  • 本机无法访问虚拟机的es
###修改es目录中config下elasticsearch.yml,末尾添加
network.host: 0.0.0.0
http.port: 9200
transport.host: localhost
transport.tcp.port: 9300

本机访问 虚拟机ip:9200出现如下即可

{
"name": "localhost.centos-1",
"cluster_name": "elasticsearch",
"cluster_uuid": "qaFgH4p_SpqUPOlThF3m_w",
"version": {
"number": "7.3.1",
"build_flavor": "default",
"build_type": "tar",
"build_hash": "4749ba6",
"build_date": "2019-08-19T20:19:25.651794Z",
"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"
}

访问前先关闭防火墙
CentOS 7.0默认使用的是firewall作为防火墙

  • 查看防火墙状态
firewall-cmd --state
  • 停止firewall
systemctl stop firewalld.service
  • 禁止firewall开机启动
systemctl disable firewalld.service

你可能感兴趣的:(elasticsearch启动采坑)