ES 冷热分离

一.为了方便查看管理es的索引,安装head插件

    1.安装node

cd /usr/local/src/

wget https://npm.taobao.org/mirrors/node/latest-v4.x/node-v4.4.7-linux-x64.tar.gz


tar -zxvf node-v4.4.7-linux-x64.tar.gz -C /usr/local/

mv /usr/local/node-v4.4.7-linux-x64  /usr/local/node

cat >> /etc/profile <<EOF
export NODE_HOME=/usr/local/node
export PATH=$PATH:$NODE_HOME/bin
export NODE_PATH=$NODE_HOME/lib/node_modules

EOF

source  /etc/profile

 

    2.下载head插件

 

wget  https://github.com/mobz/elasticsearch-head/archive/master.zip

unzip master.zip  -d /usr/local/

 

 

    3.安装grunt

 

npm config set registry https://registry.npm.taobao.org --global

npm config set disturl https://npm.taobao.org/dist --global

cd /usr/local/elasticsearch-head-master/

npm install -g grunt-cli //执行后会生成node_modules文件夹

    4.修改head插件

       修改es的 config/elasticsearch.yml,加两行配置


http.cors.enabled: true 

 http.cors.allow-origin: "*"

   修改服务器监听地址:Gruntfile.js


修改连接地址:_site/app.js

 

    5.启动head

 

npm install

grunt server

二.   es 节点级别配置

在 hot 组的节点的 elasticsearch.yml 配置文件 Node 配置段中增加

node.attr.box_type: hot

在 cold 组的节点 elasticsearch.yml 配置文件 Node 配置段中增加

node.attr.box_type: cold

 

三.  索引级别配置

curl -XPUT http://192.168.1.165:9200/_template/jsonlog/ -d '
{
"order": 0,
"template": "jsonlog*",
"settings": {
"index.routing.allocation.include.tag": "hot",
"index.refresh_interval": "30s",
"index.number_of_replicas": "1",
"index.number_of_shards": "1",
"index.translog.flush_threshold_ops": "30000"
}
}
'

四. 定时任务将历史索引分配到cold下面

1.安装pip

 yum -y install epel-release

yum -y install python-pip

pip install elasticsearch-curator==3.5

 

 

2.定时分配老索引到cold节点下


curator allocation --rule tag=cold --type  include  indices   --time-unit  days  --older-than  7  --timestring  '%Y.%m.%d'  --prefix  jsonlog

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值