Redis报错Failed to configure LOCALE for invalid locale name

报错信息应该长成大概这么个样子

119967:C 27 Jul 2024 09:15:23.799 * oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
119967:C 27 Jul 2024 09:15:23.799 * Redis version=7.2.4, bits=64, commit=00000000, modified=0, pid=119967, just started
119967:C 27 Jul 2024 09:15:23.799 * Configuration loaded
119967:M 27 Jul 2024 09:15:23.799 # Failed to configure LOCALE for invalid locale name.

网上搜过来基本上是说让你用locale-gen en_US.UTF-8去生成语言文件

但是我测试下来不顶用,locale -a还是只有C.UTF8

当然也有说什么修改/etc/default/locale或者/etc/profile的
添加环境变量直接指明LC_ALL和LANG的值为en_US.UTF-8

事实就是,这个语言包都没有,你指定了也只会多几个报错罢了......

甚至原来兼容C.UTF8不会炸的地方也炸了

具体的原因也很简单: redis必须指定一个或多个准确的语言包(en-us)

所以,我们要做的是,执行下面这行

dpkg-reconfigure locales

然后按住键盘上的下方向键

一路翻,找到en_US和zh_CN

按空格选中,回车确定(整个菜单)

后面会问你是否要修改系统语言,选中en_US,回车

这个时候应该就行了

附上一个正常启动的redis的日志

121987:C 27 Jul 2024 09:39:57.562 * oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
121987:C 27 Jul 2024 09:39:57.562 * Redis version=7.2.4, bits=64, commit=00000000, modified=0, pid=121987, just started
121987:C 27 Jul 2024 09:39:57.562 * Configuration loaded
121987:M 27 Jul 2024 09:39:57.563 * Increased maximum number of open files to 10032 (it was originally set to 1024).
121987:M 27 Jul 2024 09:39:57.563 * monotonic clock: POSIX clock_gettime
_._
_.-``__ ''-._
_.-`` `. `_. ''-._ Redis 7.2.4 (00000000/0) 64 bit
.-`` .-```. ```\/ _.,_ ''-._
( ' , .-` | `, ) Running in standalone mode
|`-._`-...-` __...-.``-._|'` _.-'| Port: 6379
| `-._ `._ / _.-' | PID: 121987
`-._ `-._ `-./ _.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' | https://redis.io
`-._ `-._`-.__.-'_.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' |
`-._ `-._`-.__.-'_.-' _.-'
`-._ `-.__.-' _.-'
`-._ _.-'
`-.__.-'

121987:M 27 Jul 2024 09:39:57.563 * Server initialized
121987:M 27 Jul 2024 09:39:57.563 * Ready to accept connections tcp

嘛,这shell的图形绘制的着实有点抽象就是

参考资料

https://bbs.tskms.org/index.php?threads/%E8%A7%A3%E5%86%B3redis%E6%9C%8D%E5%8A%A1%E5%90%AF%E5%8A%A8%E6%97%B6failed-to-configure-locale-for-invalid-locale-name.56557

https://blog.csdn.net/DeliaPu/article/details/127245725

https://juejin.cn/post/7294563074920022035

点赞

赞助商广告

如果您的网络和设备条件允许,这里可能会显示来自Google的广告

发表回复

电子邮件地址不会被公开。必填项已用 * 标注