Centos7安装Elasticsearch及集群
来源:互联网 发布:齐鲁软件大赛奖金 编辑:程序博客网 时间:2024/05/16 11:11
在官方下载elasticsearch.rpm后安装好,配置主要是http地址绑定和port
删除数据:curl -XDELETE 'http://192.168.1.1:9200/user-log*'
集群配置:
主要的是cluster-name要一样,node.master,node.data及discovery.zen.ping.unicast.hosts的配置
比如二个如下配置就行:
node-6206配置:
cluster.name: my-application
node.name: node-6206
path.data: /home/elasticsearch/data
path.logs: /home/elasticsearch/log
network.host: 192.168.6.206
http.port: 9200
http.cors.enabled: true
http.cors.allow-origin: "*"
node.master: true
node.data: false
discovery.zen.ping.unicast.hosts: ["192.168.6.206"]
node-6207配置:
cluster.name: my-application
node.name: node-6207
path.data: /home/elasticsearch/data
path.logs: /home/elasticsearch/log
network.host: 192.168.6.207
http.port: 9200
http.cors.enabled: true
http.cors.allow-origin: "*"
node.master: false
node.data: true
discovery.zen.ping.unicast.hosts: ["192.168.6.206"]
然后先启动master再启动slave就行
查看cluster状态:
http://192.168.6.206:9200/_cat/health?v
查看nodes:
http://192.168.6.206:9200/_cat/nodes?v
查看索引:
http://192.168.6.206:9200/_cat/indices?v
基本操作:
curl -XPUT '192.168.6.206:9200/customer'//创建索引
//插入数据
curl -XPUT '192.168.6.206:9200/customer/external/1'-d '
{
"name": "John Doe"
}'
curl '192.168.6.206:9200/customer/external/1'//查询数据
curl -XDELETE '192.168.6.206:9200/customer'//删除索引
定时删除(非原创):
#!/bin/bash
# filename:deleteEsData.sh
# 每天2点定时删除es中指定日期的数据
# crontab: 0 2 * * * sh /Application/enterprise/deengine/deleteEsData.sh >> /Application/enterprise/deengine/run.log 2>&1
# 如今天是2015-09-09,删除3天前数据,就是删除2015-09-06的数据
# createdate: 20150909
# author: yuanlong.zhou
today=`date +%Y-%m-%d`;
echo "今天是${today}"
# 获得要删除的日期
# 不指定参数时,默认删除30天前以nginx-开头的数据(因为是凌晨删除,所以不含当天)
daynum=15
# 当参数个数大于1时,提示参数错误
if [ $# -gt 1 ] ;then
echo "要么不传参数,要么只传1个参数!"
exit 101;
fi
# 当参数个数为1时,获取指定的参数
if [ $# == 1 ] ;then
daynum=$1
fi
esday=`date -d '-'"${daynum}"' day' +%Y.%m.%d`;
echo "${daynum}天前是${esday}"
curl -XDELETE http://192.168.6.11:9200/nginx-${esday}
echo "${today}执行完成"
- Centos7安装Elasticsearch及集群
- centos7下elasticsearch 集群安装、配置及示例
- ElasticSearch及插件安装,集群安装
- centos7中配置elasticsearch集群和离线安装x-pack
- centos7中配置elasticsearch集群和离线安装x-pack
- ElasticSearch集群安装及配置方法
- ElasticSearch集群搭建及插件安装
- Elasticsearch 5.x_Elasticsearch集群及插件安装
- elasticsearch centos7集群部署案例
- Ambari-Hadoop集群、Elasticsearch集群及nginx安装
- elasticsearch centos7安装
- elasticsearch centos7安装
- Centos7上安装ElasticSearch
- centos7-elasticsearch安装配置
- CentOS7 安装Elasticsearch
- Elasticsearch Centos7 安装
- centos7安装elasticsearch
- CentOS7 安装Elasticsearch 5.5
- LeetCode 203. Remove Linked List Elements
- Java多线程导出,单线程压缩
- 宏定义(define)
- 原生js倒计时,距离51放假还有多长时间
- RXTX javafx串口编程 关键代码
- Centos7安装Elasticsearch及集群
- 程序员在在哪个网站上找工作?
- Django 基础教程
- Retrofit2.0:上传图片到PHP
- Hibenate HQL运算符和QBC运算符
- Android开发之利用ZXing库实现二维码的生成
- 【算法】程序猿不写代码是不对的44
- AOJ ALDS1_7_A 树
- Qt5_随机产生MAC地址并在QLabel中显示