arm64下启动redis官方容器报错处理
2020-07-14 06:23
3351 查看
arm64下启动redis官方容器报错处理
问题
在飞腾服务器(FT2000+,操作系统centos7.4)上启动redis容器报错:
docker run --rm redis
报错内容
<jemalloc>: Unsupported system page size
经过尝试发现redis:4、redis:5、redis:6-rc镜像均会报以上错误,redis:3启动正常。
分析
redis在新版本中默认使用了jemalloc进行内存管理。
由于jemalloc 在编译时就决定了page size的大小,而这个page size 会由于kernel的配置而改变,因此jemalloc在某个机器上编译,然后运行在其它机器上时可能会出现问题。
推测可能是由于官方arm镜像的编译环境的page size与当前运行环境的page size不一致导致报错。
参考:
https://github.com/jemalloc/jemalloc/issues/467
解决
在运行环境下,重新编译构建redis镜像,即可解决报错
- 取得redis官方镜像的dockerfile
git clone https://github.com/docker-library/redis.git
- 进入对应版本的dockerfile目录
cd redis
cd 5.0 #准备构建5.0版本的redis镜像
- 构建镜像
docker build -t redis:5.0 .
- 运行redis:5.0镜像
docker run --rm redis:5.0
查看控制台输出,确认redis成功启动
1:C 18 Mar 2020 03:39:21.405 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo 1:C 18 Mar 2020 03:39:21.405 # Redis version=5.0.8, bits=64, commit=00000000, modified=0, pid=1, just started 1:C 18 Mar 2020 03:39:21.405 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf 1:M 18 Mar 2020 03:39:21.407 * Running mode=standalone, port=6379. 1:M 18 Mar 2020 03:39:21.407 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128. 1:M 18 Mar 2020 03:39:21.407 # Server initialized 1:M 18 Mar 2020 03:39:21.407 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect. 1:M 18 Mar 2020 03:39:21.407 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled. 1:M 18 Mar 2020 03:39:21.407 * Ready to accept connections
其它
在arm64环境下,centos的pagesize是64k,ubuntu的pagesize是4k,一般来说64k下编译的镜像是可以在小于或者等于64k的环境下运行的,但如果是在4k下编译的镜像,那么是不能在pagesize大于4k的环境下运行的。这个是jemalloc造成的。如果在编译构建镜像时使用libc就不会有这种问题。
在构建的Dockerfile的
RUN make xxxx指令前加上
ENV USE_JEMALLOC no即可使得编译redis时不使用jemalloc。
当然,jemalloc在某些场景下性能要优于libc,这个在选择用何种方式编译redis时,需要考虑清楚。
相关文章推荐
- linux-3.2.36内核启动1-启动参数(arm平台 启动参数的获取和处理,分析setup_arch)【转】
- ARM64 Linux的启动分析
- 通达OA MQ和Redis服务无法启动问题的处理(图文)
- linux-3.2.36内核启动1-启动参数(arm平台 启动参数的获取和处理,分析setup_arch)
- 【081】使用Nginx的官方Docker镜像,启动容器后无法显示自己网站页面,总显示Nginx官方默认页面的问题的解决方法
- ARM64 AArch64 Linux启动
- Java Web容器的启动与处理请求的过程
- Redis启动告警错误---优化处理
- ios开发使用xcode6打包protobuf静态库 解决了 官方引用 protobuf 导致的冲突问题 包含 arm64 支持
- linux 内核启动 arm64 汇编 head.s
- 由Docker的MySQL官方镜像配置的容器无法启动问题的解决办法
- redis启动,停止,及端口占用处理
- Java Web容器的启动与处理请求的过程
- redis 启动警告及处理
- linux-3.2.36内核启动1-启动参数(arm平台 启动参数的获取和处理,分析setup_arch)
- redis 启动警告及处理
- docker 容器启动并自启动redis
- ARM64的启动过程之(三):为打开MMU而进行的CPU初始化
- 第二篇:官方下载的redis镜像如何自己指定启动的配置文件
- LK ARM64 arch_init处理