环境配置
安装openjdk(依赖)
yum -y install java-1.8.0-openjdk.x86_64
安装elasticsearch
yum -y install elasticsearch
配置 /etc/elasticsearch/elasticsearch.yml
cluster.name: myelknode.name: es1 # 本机的主机名network.host: 0.0.0.0 # 主机监听的地址discovery.zen.ping.unicast.hosts: ["es1", "es2","es3"] # 集群成员,不用列出全部成员
启动服务,查看9200、9300端口
systemctl restart elasticsearchsyetemctl enable elasticsearchss -palntu | grep 9200ss -plantu | grep 9300
ES集群验证
firefox http://192.168.1.61:9200/_cluster/health?pretty
ES 常用http请求
- PUT # 增
- DELETE # 删 - POST # 改- GET # 查
curl 常用参数
- A #修改请求agent
- X # 设置请求方法
- i # 显示返回头信息
ES插件
安装插件 ,(本地安装时,绝对路径前加file:///)
[root@es5 ~]# /usr/share/elasticsearch/bin/plugin install ftp://192.168.4.254/package/soft/elasticsearch-head-master.zip[root@es5 ~]# /usr/share/elasticsearch/bin/plugin install ftp://192.168.4.254/package/soft/bigdesk-master.zip[root@es5 ~]# /usr/share/elasticsearch/bin/plugin install ftp://192.168.4.254/package/soft/elasticsearch-kopf-master.zip
查看安装的插件
[root@es5 ~]# /usr/share/elasticsearch/bin/plugin listInstalled plugins in /usr/share/elasticsearch/plugins: - bigdesk - head - kopf
使用插件
[root@ray nsd1810]# firefox http://192.168.1.65:9200/_plugin/head