ES数据迁移工具esm
# ESM增量同步ES数据
逻辑:每3分钟同步一次10分钟之前的数据
vim /usr/local/bin/esm.sh
#!/bin/bash
while [ true ]; do
now=$(date +%s000)
ten_min_ago=$(($now - 600000))
echo $now $ten_min_ago
/usr/bin/esm -s http://172.30.3.127:9200 -x "myindex" -d http://172.30.3.137:9200 -w 10 -t 5m -b 10 -q "updatetime:[$ten_min_ago TO $now]"
sleep 180
done
1
2
3
4
5
6
7
8
2
3
4
5
6
7
8
vim /usr/lib/systemd/system/esm.service
[Unit]
Description=esm
After=network.target
[Service]
Type=simple
PIDFile=/var/run/esm.pid
WorkingDirectory=/usr/local/
ExecStart=/usr/local/bin/esm.sh
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s QUIT $MAINPID
PrivateTmp=true
Restart=on-failure
RestartSec=5
LimitNOFILE=65536
[Install]
WantedBy=multi-user.target
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
启动
systemctl daemon-reload
systemctl start esm.service
systemctl status esm.service -l
1
2
3
2
3
上次更新: 10/2/2024
- 02
- Flink 集群部署指南 原创09-20
- 03
- MongoDB 集群Config Server 复制集的工作原理09-14