elasticsearch(ES)
*参考链接
*参考配置
- 安装JAVA_JDK
-
安装elasticsearch
cd /root wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.6.2.tar.gz tar -zxvf elasticsearch-5.6.2.tar.gz mv /root/elasticsearch-5.6.2 /usr/local/elasticsearch
-
修改配置文件
vim /usr/local/elasticsearch/config/elasticsearch.yml # node.name node.name: node-1 # node.attr node.attr.rack: r1 # 数据路径 path.data: /usr/local/elasticsearch/data # 日志路径 path.logs: /usr/local/elasticsearch/logs # IP绑定 network.host: [局域网ip] # 设置端口 http.port: 9200 ESC :wq
-
系统配置
su root # 编辑sysctl.conf vim /etc/sysctl.conf # 设置最大内存占用1G(1024x1024) vm.max_map_count=1048576 ESC :wq # 重载sysctl.conf配置 sysctl -p # 编辑limits.conf vim /etc/security/limits.conf elasticsearch hard nofile 65536 elasticsearch soft nofile 65536 ESC :wq
-
启动elasticsearch
useradd elasticsearch chown -R elasticsearch:elasticsearch /usr/local/elasticsearch su elasticsearch /usr/local/elasticsearch/bin/elasticsearch -d \ -p /usr/local/elasticsearch/logs/elasticsearch.pid
-
防火墙配置
su root systemctl enable firewalld systemctl start firewalld firewall-cmd --zone=public --add-port=9200/tcp --permanent firewall-cmd --zone=public --add-port=9300/tcp --permanent firewall-cmd --reload
-
检查是否成功运行
curl http://[服务器局域网]:9200
-
开机启动
su root vim /etc/rc.local su elasticsearch -c "/usr/local/elasticsearch/bin/elasticsearch -d -p /usr/local/elasticsearch/logs/elasticsearch.pid" ESC :wq
CURL管理所有索引
-
创建一个索引
curl -XPUT 'http://[ip]:[port]/[index_name]?pretty'
-
查看所有索引
curl 'http://[ip]:[port]/_cat/indices'
-
删除指定索引
curl -XDELETE 'http://[ip]:[port]/[index_name]?pretty'
Console管理所有索引
-
创建一个索引
PUT /[index_name]
-
删除多个索引
DELETE /index_* DELETE /index_1,index_2
-
删除所有索引
DELETE /* DELETE /_all