gpt4 book ai didi

elasticsearch - 我应该定期更新 GeoLiteCity.dat 吗?

转载 作者:行者123 更新时间:2023-11-29 02:46:08 25 4
gpt4 key购买 nike

Logstash 可以使用捆绑的 GeoLiteCity.dat 数据库进行 IP 地址地理查找。这个数据库和the one provided by MaxMind一样吗? ? MaxMind 在每个月的第一个星期二更新数据库。

设置一个作业来自动刷新数据库而不是等待 ElasticSearch 对 Logstash 的更新是否明智?

编辑:2014 年 12 月 1 日这是我编写的用于执行数据库自动更新的 bash 脚本。我读了the source code for this filter是可能需要重新启动服务才能占用更新的数据库文件。

#!/bin/bash

# Downloads the latest GeoLight DBs from maxmind.
# Updates/replaces the databases that logstash uses.
# These are the IP-to-location databases that logstash uses.
# Maxmind updates them once a month on the first Tuesday of the month.
# See http://dev.maxmind.com/geoip/legacy/geolite/

echo Beginning update of GeoIP databases for logstash.
cd /tmp
rm -f GeoIPASNum.dat.gz GeoIPASNum.dat GeoLiteCity.dat.gz GeoLiteCity.dat
echo Downloading latest files.
wget --quiet --output-document GeoIPASNum.dat.gz http://download.maxmind.com/download/geoip/database/asnum/GeoIPASNum.dat.gz || { echo 'Download of GeoIPASNum.dat.gz failed' ; exit 1; }
wget --quiet --output-document GeoLiteCity.dat.gz http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz || { echo 'Download of GeoLiteCity.dat.gz failed' ; exit 1; }

echo Unzipping
gunzip GeoIPASNum.dat.gz
gunzip GeoLiteCity.dat.gz

echo Setting permissions
chmod 664 GeoIPASNum.dat GeoLiteCity.dat
chown logstash:logstash GeoIPASNum.dat GeoLiteCity.dat

echo Replacing existing files and backing up the old.
cd /opt/logstash/vendor/geoip/
mv -f GeoIPASNum.dat GeoIPASNum.dat.bak && mv /tmp/GeoIPASNum.dat .
mv -f GeoLiteCity.dat GeoLiteCity.dat.bak && mv /tmp/GeoLiteCity.dat .

echo Restarting logstash
# Modify for your distro services model.
service logstash restart

echo Done

最佳答案

是的,这是同一个数据库,是的,您可以使用来自 maxmind 网站的更新。我在 ubuntu 中使用 geoip-database-contrib 包,其中包含一个 cronjob,可以自动从 maxmind 更新数据库文件。

我不知道 maxmind 数据集的变化有多快,但由于 logstash(包括数据库文件)的发布时间表很慢(当前的 1.4.2 是 5 个月前发布的),我使用的是最新的数据库.

关于elasticsearch - 我应该定期更新 GeoLiteCity.dat 吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27131211/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com