LINUX 安装elasticsearch RPM
1、安装公开签名,设置环境变量
rpm --import https://artifacts.elastic.co/GPG-KEY-elasticsearch ES_PATH_CONF=/path/to/my/config ./bin/elasticsearch
2、在/etc/yum.repos.d/下创建elasticsearch.repo
cd /etc/yum.repos.d/ touch elasticsearch.repo
elasticsearch.repo文件内容
[elasticsearch] name=Elasticsearch repository for 7.x packages baseurl=https://artifacts.elastic.co/packages/7.x/yum gpgcheck=1 gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch enabled=0 autorefresh=1 type=rpm-md
3、接下来就可以安装了
sudo yum install --enablerepo=elasticsearch elasticsearch
4、创建系统索引
action.auto_create_index: .monitoring*,.watches,.triggered_watches,.watcher-history*,.ml*
5、系统启动时自动启动
sudo chkconfig --add elasticsearch
6、修改配置文件
vim /etc/elasticsearch/elasticsearch.yml
#network.host: 192.168.0.1 改为 network.host: 0.0.0.0 #http.port: 9200 改为 http.port: 9200 #discovery.seed_hosts: ["host1", "host2"] 改为 discovery.seed_hosts: ["0.0.0.0"] # 在文件末尾写入 # 初始主节点IP地址 node.name: node-1 cluster.initial_master_nodes: ["node-1"]
path.data: /data/es/elasticsearch path.logs: /data/es/log/elasticsearch
创建数据目录和日志目录
mkdir /data/es/elasticsearch mkdir /data/es/log/elasticsearch
修改目录权限(每个es节点都执行)
cd /data chown -R elasticsearch:elasticsearch es
7、启动
sudo -i service elasticsearch start
停止
sudo -i service elasticsearch stop
访问 http://你的IP:9200 反馈内容即为成功