通过geoip自动更新GeoLite2-ASN GeoLite2-City GeoLite2-Country

1、首先注册登录

Sign In | MaxMind

登录地址、填写邮箱、用户名、密码信息

2、同意GeoLite2 End User License Agreement协议

注册登录成功之后,要想获取到免费产品的订阅信息,还需要同意GeoLite2 End User License Agreement协议,否则登录之后,在个人账号门户是看不到GeoLite2下载信息的。

GeoLite sign up | MaxMind

3、登录个人中心获取license

生成license的时候复制备用。

4、下载geoipupdate执行更新

下载地址

github.com

上传到linux服务器上解压,修改GeoIP.conf文件
GeoIP.conf,填写对应的AccountID 账号IDLicenseKey 复制的License,都可在登录后的个人中心获取

复制代码
# Please see https://dev.maxmind.com/geoip/updating-databases?lang=en for
# instructions on setting up geoipupdate, including information on how to
# download a pre-filled GeoIP.conf file.

# Replace YOUR_ACCOUNT_ID_HERE and YOUR_LICENSE_KEY_HERE with an active account
# ID and license key combination associated with your MaxMind account. These
# are available from https://www.maxmind.com/en/my_license_key.
AccountID 账号ID
LicenseKey 复制的License

# Enter the edition IDs of the databases you would like to update.
# Multiple edition IDs are separated by spaces.
EditionIDs GeoLite2-ASN GeoLite2-City GeoLite2-Country

# The remaining settings are OPTIONAL.

# The directory to store the database files. Defaults to /usr/local/share/GeoIP
# DatabaseDirectory /usr/local/share/GeoIP

# The server to use. Defaults to "https://updates.maxmind.com".
# Host https://updates.maxmind.com

# The proxy host name or IP address. You may optionally specify a
# port number, e.g., 127.0.0.1:8888. If no port number is specified, 1080
# will be used.
# Proxy 127.0.0.1:8888

# The user name and password to use with your proxy server.
# ProxyUserPassword username:password

# Whether to preserve modification times of files downloaded from the server.
# Defaults to "0".
# PreserveFileTimes 0

# The lock file to use. This ensures only one geoipupdate process can run at a
# time.
# Note: Once created, this lockfile is not removed from the filesystem.
# Defaults to ".geoipupdate.lock" under the DatabaseDirectory.
# LockFile /usr/local/share/GeoIP/.geoipupdate.lock

# The amount of time to retry for when errors during HTTP transactions are
# encountered. It can be specified as a (possibly fractional) decimal number
# followed by a unit suffix. Valid time units are "ns", "us" (or "µs"), "ms",
# "s", "m", "h".
# Defaults to "5m" (5 minutes).
# RetryFor 5m

# The number of parallel database downloads.
# Defaults to "1".
# Parallelism 1

执行命令,例如解压到了home下,可以配置crontab定时执行

复制代码
/home/geoipupdate_7.1.1_linux_amd64/geoipupdate -v -f /home/geoipupdate_7.1.1_linux_amd64/GeoIP.conf
相关推荐
java_logo1 小时前
Docker 部署 Milvus:轻松搭建高性能向量数据库平台
数据库·docker·私有化部署·milvus·向量数据库·rag·轩辕镜像
A心有千千结2 小时前
GO 使用 OpenTelemetry 进行编译时插桩,实现零码注入
数据库·golang·可观测性·观测云
GreatVicent2 小时前
腾讯AI产业大会解读:Agent进场,企业基础设施怎么搭
大数据·数据库·人工智能·llm·agent·企业信息化
大模型码小白3 小时前
告别造假数据,直接连数据库查真实时序数据喂给 TimechoAI 大模型
java·数据库·人工智能·microsoft·架构
晚安日记wanna3 小时前
大表 DDL 面试翻车现场Online DDL 为什么还会锁死业务
数据库·面试·架构
IvorySQL3 小时前
PostgreSQL 日报|建库策略致备库静默丢数据(9 月 12 日)
数据库·人工智能·postgresql
这个DBA有点耶3 小时前
当Agent从“写SQL”变成“执行SQL”:数据库安全模型需要重新设计
数据库·aigc·dba
晚安日记wanna3 小时前
MySQL 主从延迟别只答并行复制
数据库·面试·架构
qq_401700414 小时前
Qt QUrl 详解与代码示例
开发语言·数据库·qt
程序员阿鹏4 小时前
如何实现MySQL分库分表?
数据结构·数据库·sql·mysql·缓存